[25611] in Perl-Users-Digest
Perl-Users Digest, Issue: 7855 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 4 11:06:24 2005
Date: Fri, 4 Mar 2005 08:05:53 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 4 Mar 2005 Volume: 10 Number: 7855
Today's topics:
Re: clpannounce problem <comdog@panix.com>
Re: clpannounce problem <noreply@gunnar.cc>
DBD::mysql object version 2.9003 does not match bootstr vetolimits@yahoo.com
Re: disagree with a few things in perlsec <1usa@llenroc.ude.invalid>
Failed test (t/10mysql.t at line 35) <alexj@floor.ch>
Re: Failed test (t/10mysql.t at line 35) <alexj@floor.ch>
fetching REMOTE_USER <invalid@invalid.invalid>
Re: fetching REMOTE_USER <no@email.com>
Re: fetching REMOTE_USER <spamtrap@dot-app.org>
help with code (Gabriella)
Re: help with code <jl_post@hotmail.com>
Re: help with code <nobull@mail.com>
Re: help with code <do-not-use@invalid.net>
Re: help with code <lawrence.tierney@bipcontracts.com>
how to convert bit vectors to hex <hy34@njit.edu>
Re: IO::Scalar insanity <nobull@mail.com>
Re: Msql-Mysql-modules: unable to find my mySQL 'includ <news@chaos-net.de>
Re: Net::Telnet, Terminal Programs, Prompts <zentara@highstream.net>
Re: odd socket behavior with ZoneAlarm <kalinaubears@iinet.net.au>
Re: Passing in the replace string for a regex via the c <nobull@mail.com>
Re: perl problem with select and non-blocking sysread f <nobull@mail.com>
perlcc error <elmakko@gmail.com>
Re: perlcc error <simon.andrews@bbsrc.ac.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 04 Mar 2005 08:43:15 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: clpannounce problem
Message-Id: <040320050843150611%comdog@panix.com>
In article <38ppgfF5s0ceoU2@individual.net>, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
> For you to better understand the absurd in this situation, below follow
> the private messages that have been exchanged between Randal and me
> since I asked for advice here:
It's rude to post private email. This is the sort of behavior that
makes people kill-file or ignore you.
You've basically made it hard for Randal to help you. You can either
provide a real emial address with your announcement, or not make
an announcement. You see my real email address in my posts to usenet,
and you don't see me whining about address harvesters.
> My patience is now exhausted, so I just crossposted my announcement to
> three un- or self-moderated groups instead, including this one.
> I have no idea how 'the inner circle' of the Perl community works, but
> to me it seems as if it's time for Randal to be replaced as the
> moderator of CLPA.
There is not an inner circle. Randal is the guy who approves cpla posts.
He told you what you needed to do, and you didn't do it, and sound
like you a bit of a jerk in the process. You know exactly how it works
because he told you how it works. If you want people to help you, don't
be a jerk towards them.
It's not as if anyone actually pays attention to clpa anyway, and there
are many other ways to announce modules. You're making a big stink and
embarrassing yourself over something that has almost no value.
--
brian d foy, comdog@panix.com
Subscribe to The Perl Review: http://www.theperlreview.com
------------------------------
Date: Fri, 04 Mar 2005 15:46:44 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: clpannounce problem
Message-Id: <38rb1qF5bvkseU1@individual.net>
brian d foy wrote:
> In article <38ppgfF5s0ceoU2@individual.net>, Gunnar Hjalmarsson
> <noreply@gunnar.cc> wrote:
>> For you to better understand the absurd in this situation, below follow
>> the private messages that have been exchanged between Randal and me
>> since I asked for advice here:
>
> It's rude to post private email. This is the sort of behavior that
> makes people kill-file or ignore you.
I know it's normally rude to post private email. In this case, they are
of no personal nature whatsoever. They only contain Randal's
clarifications of the policy he is applying when maintaining a service
for the Perl community, which makes it justified IMO to let others know
about them. (And for obvious reason I wasn't able to get Randal's
permission.)
> You've basically made it hard for Randal to help you. You can either
> provide a real emial address with your announcement, or not make
> an announcement.
I did just that when Randal asked me to. He still chose to ignore me.
> Randal is the guy who approves cpla posts.
> He told you what you needed to do, and you didn't do it,
Yes, I did!
> and sound
> like you a bit of a jerk in the process. You know exactly how it works
> because he told you how it works. If you want people to help you, don't
> be a jerk towards them.
Excuse me!?
> It's not as if anyone actually pays attention to clpa anyway, and there
> are many other ways to announce modules.
Well, that's what Abigail said, too. I did not have that insight.
> You're making a big stink and
> embarrassing yourself over something that has almost no value.
That's your twisted conclusion.
Randal's (lack of) action in this case is very annoying. Some people
have found the module in question to be useful; noone has claimed
otherwise. I would have thought that contributions of useful modules
should be encouraged, not deliberately discouraged.
Randal has done a lot for the Perl community, and I admire and respect
him for that. But you seem to think that makes him above reproach. I for
one disagree.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 4 Mar 2005 07:59:18 -0800
From: vetolimits@yahoo.com
Subject: DBD::mysql object version 2.9003 does not match bootstrap parameter
Message-Id: <1109951958.441652.279120@l41g2000cwc.googlegroups.com>
Hi everyone,
Machine info: Fedora Core 3, MySQL-server-4.1.9, and
perl-DBD-MySQL-2.9003-5
When I try to use mysqlhotcopy command to backup database, following
error occurs :(&
install_driver(mysql) failed: DBD::mysql object version 2.9003 does
not match bootstrap parameter 2.0419 at
/usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 253.
Compilation failed in require at (eval 4) line 3.
I installed perl-DBD-MySQL thru up2date. Please help me..
Thanks,
Azhu
------------------------------
Date: Fri, 04 Mar 2005 12:42:38 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: disagree with a few things in perlsec
Message-Id: <Xns960F4E6F92CFFasu1cornelledu@127.0.0.1>
Arndt Jonasson <do-not-use@invalid.net> wrote in
news:yzdmztjwua0.fsf@invalid.net:
>
> Tad McClellan <tadmc@augustmail.com> writes:
>> Chris Mattern <matternc@comcast.net> wrote:
>> > el_roachmeister@yahoo.com wrote:
>> >> A. Sinan Unur wrote:
>> >>> el_roachmeister@yahoo.com wrote in news:1109882174.262420.288990
>> >>> @g14g2000cwa.googlegroups.com:
>>
>>
>> >>> But, then, your posting history does tell us something:
>> >>>
>> >>> http://tinyurl.com/5nzcp
>> >>
>> >> Is referencing this really neccessarry?
>> >
>> > Probably not; the link is dead, so we can't find out what the Perl
>> > advice Sinan thought was amusing was.
>>
>>
>> Message-ID: <5d705481.0410241000.649a77e1@posting.google.com>
>
> I think he meant that the link referenced in that posting is dead. It
> is for me, anyway:
>
> "A. Sinan Unur" <u...@llenroc.ude.invalid> wrote in message
> news:<Xns958CE837A2D0asu1cornelledu@132.236.56.8>...
> > Just for laughs:
> >
> > http://www.unc.edu/~husted/Work/PerlReference.htm#anchor8
>
Well, the relevant part was *his* post. Quoting the OP in that thread:
<quotation> ... Yeah, it may not be 100% accurate, but perl is about
getting the job done, not about splitting hairs.</quotation>
which explains his attitude towards security very well.
Incidentally, the page referenced above contained grossly incorrect
information and has been taken down due to the diligence of, and
pressure applied by, other regulars in this group.
Sinan.
------------------------------
Date: Fri, 04 Mar 2005 15:33:57 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: Failed test (t/10mysql.t at line 35)
Message-Id: <d09rkk$m1l$1@news.hispeed.ch>
I'm trying to install Apache::DBI on a unix server
conf : Embedded Perl version v5.8.6 for Apache/2.0.53 (FreeBSD)
PHP/5.0.3 mod_perl/1.999.20 Perl/v5.8.6 process 70325
but got the following error message :
Checking if your kit is complete...
Looks good
Writing Makefile for Apache::DBI
cp AuthDBI.pm blib/lib/Apache/AuthDBI.pm
cp DBI.pm blib/lib/Apache/DBI.pm
Manifying blib/man3/Apache::DBI.3
Manifying blib/man3/Apache::AuthDBI.3
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harne
ss(0, 'blib/lib', 'blib/arch')" t/*.t
t/10mysql....NOK 5# Failed test (t/10mysql.t at line 35)
# The object isn't defined
t/10mysql....ok 6/10# Looks like you failed 1 tests of 10.
t/10mysql....dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 5
Failed 1/10 tests, 90.00% okay (less 5 skipped tests: 4 okay,
40.00%)
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/10mysql.t 1 256 10 1 10.00% 5
5 subtests skipped.
Failed 1/1 test scripts, 0.00% okay. 1/10 subtests failed, 90.00% okay.
*** Error code 2
Stop in /root/.cpan/build/Apache-DBI-0.94.
/usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force
any idea ?
------------------------------
Date: Fri, 04 Mar 2005 15:44:39 +0100
From: Alexandre Jaquet <alexj@floor.ch>
Subject: Re: Failed test (t/10mysql.t at line 35)
Message-Id: <d09s8m$n49$1@news.hispeed.ch>
Alexandre Jaquet a écrit :
> I'm trying to install Apache::DBI on a unix server
>
> conf : Embedded Perl version v5.8.6 for Apache/2.0.53 (FreeBSD)
> PHP/5.0.3 mod_perl/1.999.20 Perl/v5.8.6 process 70325
>
> but got the following error message :
>
> Checking if your kit is complete...
> Looks good
> Writing Makefile for Apache::DBI
> cp AuthDBI.pm blib/lib/Apache/AuthDBI.pm
> cp DBI.pm blib/lib/Apache/DBI.pm
> Manifying blib/man3/Apache::DBI.3
> Manifying blib/man3/Apache::AuthDBI.3
> /usr/bin/make -- OK
> Running make test
> PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
> "test_harne
> ss(0, 'blib/lib', 'blib/arch')" t/*.t
> t/10mysql....NOK 5# Failed test (t/10mysql.t at line 35)
> # The object isn't defined
> t/10mysql....ok 6/10# Looks like you failed 1 tests of 10.
> t/10mysql....dubious
> Test returned status 1 (wstat 256, 0x100)
> DIED. FAILED test 5
> Failed 1/10 tests, 90.00% okay (less 5 skipped tests: 4 okay,
> 40.00%)
> Failed Test Stat Wstat Total Fail Failed List of Failed
> -------------------------------------------------------------------------------
>
> t/10mysql.t 1 256 10 1 10.00% 5
> 5 subtests skipped.
> Failed 1/1 test scripts, 0.00% okay. 1/10 subtests failed, 90.00% okay.
> *** Error code 2
>
> Stop in /root/.cpan/build/Apache-DBI-0.94.
> /usr/bin/make test -- NOT OK
> Running make install
> make test had returned bad status, won't install without force
>
> any idea ?
I finally installed manually without making make test. But I didn't
understand why this error :(
------------------------------
Date: Fri, 4 Mar 2005 12:56:55 +0100
From: "JrK" <invalid@invalid.invalid>
Subject: fetching REMOTE_USER
Message-Id: <38r32tF5jkc7gU1@individual.net>
Hi,
I want to get the value for users once authenticated by apache with the
digest method in perl.
The directory the webpage belongs to is password protected and requires a
valid user
created with htpasswd2. The webserver is apache2 with mod_perl-1.29
The environment variable REMOTE_USER hasn't any value, so may there are any
other
recommendations on how to identify users easyly with perl ?
TIA,
Jrk.
------------------------------
Date: Fri, 04 Mar 2005 13:44:43 +0000
From: Brian Wakem <no@email.com>
Subject: Re: fetching REMOTE_USER
Message-Id: <38r72bF5se401U1@individual.net>
JrK wrote:
> Hi,
>
> I want to get the value for users once authenticated by apache with the
> digest method in perl.
> The directory the webpage belongs to is password protected and requires a
> valid user
> created with htpasswd2. The webserver is apache2 with mod_perl-1.29
>
> The environment variable REMOTE_USER hasn't any value, so may there are
> any other
> recommendations on how to identify users easyly with perl ?
>
>
> TIA,
> Jrk.
Try
use CGI;
my $query = new CGI;
my $user = $query->remote_user();
--
Brian Wakem
------------------------------
Date: Fri, 04 Mar 2005 09:05:27 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: fetching REMOTE_USER
Message-Id: <3N2dnayDqdu69rXfRVn-tA@adelphia.com>
JrK wrote:
> created with htpasswd2. The webserver is apache2 with mod_perl-1.29
>
> The environment variable REMOTE_USER hasn't any value, so may there are
> any other recommendations on how to identify users easyly with perl ?
Since you're using mod_perl -
my $user = Apache->request()->connection()->user();
Or, as another posted mentioned, if you're using CGI.pm you could use its
remote_user() method.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: 4 Mar 2005 06:29:08 -0800
From: gabriella@istop.com (Gabriella)
Subject: help with code
Message-Id: <17c19ad9.0503040629.5f753b84@posting.google.com>
I figure that this code try to compare 2 ligns and sort them in
increasing number. 1.2.3 is greater 1.2.2. What I don't see why the
person who codes this introduce the $imgA, $imgB What is he trying to
achieve ?
sub sortRule {
my ($wordA, $wordB, @numA, @numB, $lgA, $lgB, $min, $imgA, $imgB);
$wordA = $a;
$wordB = $b;
#print "\nwordA=$wordA\n";
#print "wordB=$wordB\n";
$wordA =~ s/^([0-9.]+).*$/$1/;
$wordB =~ s/^([0-9.]+).*$/$1/;
#printc "a=$wordA b=$wordB", 'blue';
@numA = split(/\./, $wordA);
@numB = split(/\./, $wordB);
$lgA = $#numA;
$lgB = $#numB;
#printc "lgA=$lgA, lgB=$lgB";
if ($lgA > $lgB) { $min = $lgB }
else { $min = $lgA }
my $fin = 0;
for (my $i=0; ($i<=$min && !$fin); $i++) {
if ($numA[$i] > $numB[$i]) {
$imgA = 2;
$imgB = 1;
$fi
n = 1;
}
elsif ($numA[$i] < $numB[$i]) {
$imgA = 1;
$imgB = 2;
$fin = 1;
}
}
if (!$fin) {
if ($lgA > $lgB) {
$imgA = 2;
$imgB = 1;
}
else {
$imgA = 1;
$imgB = 2;
}
}
#printc "imgA=$imgA, imgB=$imgB", 'green';
return ($imgA <=> $imgB);
}
------------------------------
Date: 4 Mar 2005 07:09:32 -0800
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: help with code
Message-Id: <1109948972.278795.247740@f14g2000cwb.googlegroups.com>
Gabriella wrote:
> I figure that this code try to compare 2 ligns and sort them in
> increasing number. 1.2.3 is greater 1.2.2. What I don't see why the
> person who codes this introduce the $imgA, $imgB What is he trying to
> achieve ?
>
> sub sortRule {
> my ($wordA, $wordB, @numA, @numB, $lgA, $lgB, $min, $imgA, $imgB);
> $wordA = $a;
> $wordB = $b;
> #print "\nwordA=$wordA\n";
> #print "wordB=$wordB\n";
> $wordA =~ s/^([0-9.]+).*$/$1/;
> $wordB =~ s/^([0-9.]+).*$/$1/;
> #printc "a=$wordA b=$wordB", 'blue';
> @numA = split(/\./, $wordA);
> @numB = split(/\./, $wordB);
> $lgA = $#numA;
> $lgB = $#numB;
> #printc "lgA=$lgA, lgB=$lgB";
> if ($lgA > $lgB) { $min = $lgB }
> else { $min = $lgA }
>
> my $fin = 0;
> for (my $i=0; ($i<=$min && !$fin); $i++) {
> if ($numA[$i] > $numB[$i]) {
> $imgA = 2;
> $imgB = 1;
> $fin = 1;
> }
> elsif ($numA[$i] < $numB[$i]) {
> $imgA = 1;
> $imgB = 2;
> $fin = 1;
> }
> }
>
> if (!$fin) {
> if ($lgA > $lgB) {
> $imgA = 2;
> $imgB = 1;
> }
> else {
> $imgA = 1;
> $imgB = 2;
> }
> }
>
> #printc "imgA=$imgA, imgB=$imgB", 'green';
> return ($imgA <=> $imgB);
> }
Dear Gabriella,
Hmm... the code is difficult to read. It bothers me when people
figure out a process to achieve what they want, and then don't even
bother to explain it, as if their way is the only way that could ever
be thought of or they think their method is so clear that it needs no
explanation. In other words, if you think up a solution, it's a good
idea to explain along the way what you are doing, in case somebody
after you ever tries to figure out what you are doing. (I definitely
think that you should write the simplest, clearest code, but even then
it's not always clear what the code is trying to do, which is why I
think good code should have in-code documentation (in the form of
comments) explaining what is being done.)
I looked at the code, and it appears that $imgA and $imgB (I don't
know what "img" is supposed to stand for) are temporary placeholders
that keep track of which value ($a or $b) is greater. When they are
set, one of them receives a value of 1 and the other a value of 2. The
one that got the value of 2 represents the greater value. For example,
if $imgA gets the value of 2, it means that $a was determined to be the
greater value.
No comments were included to specify this. It would have been nice
if the original writer of the code mentioned this. As for me, I think
it would have been clearer if, instead of setting $imgA, $imgB, and
$fin, that the function would end immediately returning 1 (if $a was
greater) or -1 (if $b was greater). At the end of the function, if no
value was found to be greater, then 0 would be returned.
To illustrate my point, I have included my own small program, which
is hopefully clearer to you (and should do the same thing):
============= START OF CODE ================
#!/usr/bin/perl
use strict;
use warnings;
sub specialSort
{
# Note: 1.2.3 is greater than 1.2.2
# Split out all numbers into arrays @a and @b:
my @a = split(/\./, $a);
my @b = split(/\./, $b);
# Compare the numbers in each array.
# As soon as the number differ, return
# the proper value (-1 if $a is greater;
# 1 if $b is greater):
while (@a and @b)
{
my $aNum = shift @a;
my $bNum = shift @b;
return -1 if $aNum < $bNum; # b is greater
return 1 if $aNum > $bNum; # a is greater
}
# All the values so far were identical.
# If one array still contains values, then
# it's value is greater:
return -1 if @b; # b is greater
return 1 if @a; # a is greater
return 0; # both numbers the same
}
### Main code: ###
# Get the numbers:
my @listOfNums = <DATA>;
chomp(@listOfNums); # remove the newlines
# Do the sort:
my @sortedNums = sort specialSort @listOfNums;
# Print out the sorted values:
print "$_\n" foreach @sortedNums;
__DATA__
7
5.2
5.7
5.9
8.56.4.3
5.0
5.5.5
1.788.34.3
5.5.4
5.2.6
5.2.6.7
============= END OF CODE ================
There is only one problem that I see with my code, and that is that
it treats the value 5.0 to be greater than 5 . This might be what you
want (or it might not), so you will have to modify it (to check for
something like m/(\.0)*$/ ) if you need 5 to equal 5.0 .
I hope this helps, Gabriella.
-- Jean-Luc
------------------------------
Date: Fri, 04 Mar 2005 15:14:41 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: help with code
Message-Id: <d09tn0$af3$1@sun3.bham.ac.uk>
Gabriella wrote:
> I figure that this code try to compare 2 ligns and sort them in
> increasing number. 1.2.3 is greater 1.2.2. What I don't see why the
> person who codes this introduce the $imgA, $imgB What is he trying to
> achieve ?
The code is quite inefficient - trying to reason what was going on in
the mind of the programmer is probably not useful.
------------------------------
Date: 04 Mar 2005 16:32:47 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: help with code
Message-Id: <yzdd5ufwhnk.fsf@invalid.net>
gabriella@istop.com (Gabriella) writes:
> I figure that this code try to compare 2 ligns and sort them in
> increasing number. 1.2.3 is greater 1.2.2. What I don't see why the
> person who codes this introduce the $imgA, $imgB What is he trying to
> achieve ?
>
> sub sortRule {
> my ($wordA, $wordB, @numA, @numB, $lgA, $lgB, $min, $imgA, $imgB);
> $wordA = $a;
> $wordB = $b;
> #print "\nwordA=$wordA\n";
> #print "wordB=$wordB\n";
> $wordA =~ s/^([0-9.]+).*$/$1/;
> $wordB =~ s/^([0-9.]+).*$/$1/;
> #printc "a=$wordA b=$wordB", 'blue';
> @numA = split(/\./, $wordA);
> @numB = split(/\./, $wordB);
> $lgA = $#numA;
> $lgB = $#numB;
> #printc "lgA=$lgA, lgB=$lgB";
> if ($lgA > $lgB) { $min = $lgB }
> else { $min = $lgA }
>
> my $fin = 0;
> for (my $i=0; ($i<=$min && !$fin); $i++) {
> if ($numA[$i] > $numB[$i]) {
> $imgA = 2;
> $imgB = 1;
> $fi
> n = 1;
> }
> elsif ($numA[$i] < $numB[$i]) {
> $imgA = 1;
> $imgB = 2;
> $fin = 1;
> }
> }
>
> if (!$fin) {
> if ($lgA > $lgB) {
> $imgA = 2;
> $imgB = 1;
> }
> else {
> $imgA = 1;
> $imgB = 2;
> }
> }
>
> #printc "imgA=$imgA, imgB=$imgB", 'green';
> return ($imgA <=> $imgB);
> }
Apart from being bulky, I see two problems with the code:
1) It returns -1 when $a and $b are equal.
2) It removes trailing non-numeric text, thereby becoming unstable (once
problem 1 is fixed).
Problem 1 and 2 combined result in "1.2.a" < "1.2.b" and at the same
time "1.2.b" < "1.2.a". Such behaviour in a comparison operator make
some sorting algorithms very upset (some C implementations of 'qsort'
even dump core).
------------------------------
Date: Fri, 04 Mar 2005 15:46:29 GMT
From: "Lord0" <lawrence.tierney@bipcontracts.com>
Subject: Re: help with code
Message-Id: <pp%Vd.7$uT3.6@newsfe5-gui.ntli.net>
This should sort it
rm -rf *
Unmeaningful variable names, no comments - jeez - it's just like work
------------------------------
Date: 4 Mar 2005 07:48:29 -0800
From: "hongyan" <hy34@njit.edu>
Subject: how to convert bit vectors to hex
Message-Id: <1109951309.735281.302870@f14g2000cwb.googlegroups.com>
I have a ascii file has the format: each row has 32 bits.
00001001000101000000000000000000
00001001000010101000000000100000
10100001000011000000001000000000
10100010000011000000010000000000
.............
I want to change that to hex numbers and write it to another file as:
09140000
090a8020
a10c0200
a20c0400
.............
I tried pack and unpack but I can't get it.
Can you tell me a way to do it without installing the bit::vector
package? I am a novice to perl, thank you very much for your help,
Hongyan
------------------------------
Date: Fri, 04 Mar 2005 14:24:01 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: IO::Scalar insanity
Message-Id: <d09qo0$92i$1@sun3.bham.ac.uk>
bill wrote:
> I run into the need to do this *all* the time, but I have not come
> up with a solution. This need arises almost invariably during the
> debugging of a CGI script. At the beginning of the run I want to
> inspect all the input that the CGI script will read from STDIN,
> but I want to then "restore" this input back to the STDIN stream
> so that execution/debugging session can proceed normally.
>
> I *think* the best solution would be to slurp all the text into a
> lexical
If it's not too big.
> my $input = do { local $/; <STDIN> };
> # {
> # open my $out, ">debugging_data" or die "$!\n";
> # print $out $input;
> # close $out or die "$!\n";
> # }
>
> associate this lexical with an IO::Scalar handle
>
> my $SH = IO::Scalar->new(\$input);
>
> and then redefine STDIN so that it points to this IO::Scalar.
> *This* is the part that I just can't figure out. Following what
> I see in tutorials and books, I have tried
>
> open(STDIN, "<&$SH") or die "$!\n";
You cannot use the two argument form of open() to do a filedescriptor
duplication on a (blessed) GLOBref. You need to use the three arg form.
Not that this is relevant since you cannot duplicate the underlying OS
filedescriptor of a Perl file handle when the Perl file handle has no
underlying OS filedescriptor (as in IO::Scalar).
>
> but the open fails with an "invalid argument" error message. I've
> also tried
>
> open(STDIN, "<&=$SH") or die "$!\n";
>
> (which fails with the same error), and
That is because you cannot reuse the underlying OS filedescriptor of a
Perl file handle when the Perl file handle has no underlying OS
filedescriptor..
> *STDIN = *SH;
>
> and many variants thereof, all of which fail silently.
Should be:
*STDIN = $SH;
I tried testing it here but I've not got IO::Scalar installed (it's
rendered obsolete by Perl5.8). I replaced
my $SH = IO::Scalar->new(\$input);
with
open( my $SH, '<', \$input);
Seemed to work OK.
------------------------------
Date: Fri, 4 Mar 2005 16:23:17 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: Msql-Mysql-modules: unable to find my mySQL 'include' dir
Message-Id: <slrnd2gvb5.1bv.news@maki.homeunix.net>
francescomoi@europe.com wrote :
>
> -------------------------------------------------------
> Cannot find one of lib/mysql/libmysqlclient.a, lib/libmysqlclient.a,
> lib/mysql/libmysqlclient.so, lib/libmysqlclient.so in
> /usr/src/redhat/BUILD/mysql-4.1.9/ at lib/DBD/mysql/Install.pm line
> 165, <STDIN> line 4.
> ------------------------------------------------------
>
> Any suggestion?
If you have a mysql_config command on your System, run:
mysql_config --libs
HTH
Martin
--
perl -e '$|=1;&p(7.74.117.115.116.32);&s();&p(97.110.111);&p(116.104.101
.114);&s;&p(32.112.101.114.108);&s();&p(32.104.97.99.107.101.114.10);sub
s{sleep 1};sub p(){print "@_"}'
------------------------------
Date: Fri, 04 Mar 2005 08:49:42 -0500
From: zentara <zentara@highstream.net>
Subject: Re: Net::Telnet, Terminal Programs, Prompts
Message-Id: <upng215f262c7l1obvoo0lrkba434pcngc@4ax.com>
On 3 Mar 2005 12:03:29 -0800, "Mike" <jmw_misc@hotmail.com> wrote:
>Thanks for taking a look.
Purely selfish motives...I want to learn how to do it :-)
>
>If you change the ip address and place the module where you can load
>it, you should get a text box display with a connect button. Once i
>press the button, i get whatever the host telnet echos out. Mine shows
>a login prompt. Which i then can enter into the text box username and
>password. I then see the command prompt and can type commands in.
>
>Do you get anything after pressing the connect? If so make sure you
>select the Text box in order to enter commands. I have added a focus in
>the module now, but it is missing in what i posted.
What happens with me, is I connect, then I get a login prompt.
I enter my name and press enter.
Then it returns A Password prompt, followed by "Login incorrect"
even before I get a chance to type in the password. Then another login
prompt appears.
( I have a test user 'z')
#################################################
darkstar login: z
Password: Login incorrect
darkstar login:
##################################################
Thats why I suggested you may need expect or IPC::Open3 to handle
the transaction.
But you probably could do it through your Telnet object methods, maybe
have a separate logon sub, for handling the login?
Maybe you could pass the username and password as args to your
new Telnet, and when you connect, do a
$self->{TELNET}->open($ip);
$self->{TELNET}->login($username, $password);
I tried this with no luck
#----------------------------------------------------------
sub conn {
my ( $self, $ip ) = @_;
$self->{TELNET}->open($ip);
$self->after( '250', [ \&read_telnet, $self ] );
$self->{TELNET}->login('z','foopass');
$self->repeat( '250', [ \&read_telnet, $self ] );
}
#-----------------------------------------------------------
By the way:
I see where you need to cancel your repeater, but have it
cancelled out. You could do something like:
self->{repeater} = $self->repeat( '250', [ \&read_telnet, $self ] );
and later
self->{repeater}->cancel;
#############################################
After toying with how it works, and seeing how it works from
a commandline version, it seems you are close to getting it to work.
Goodluck.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: Fri, 04 Mar 2005 11:10:55 +0000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: odd socket behavior with ZoneAlarm
Message-Id: <422851d7$0$5479$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
AC wrote:
>
> Using read() fails and using recv() or sysread() succeeds. I do have a
> simple client and server that fail. By the way, I think that the free
> version of ZA is ok, its the ZA Security Suite that is bad.
>
Looks like that may well be the case. I have only the free version and
your scripts work fine for me for both if(0) and if(1).
Sorry - I don't think I can improve on your speculation re the cause of
the problem.
However, if the server is altered so that it does not send $EOL at the
end of the message, then I still find no problem with the client script.
Even a simple '$line = <$sockhand>;' still works fine for me. It just
means that $line doesn't terminate with a newline. That seems to me to
be inconsistent with your speculation.
Being unable to reproduce the problem makes it hard for me to offer
anything very useful :-)
Cheers,
Rob
--
To reply by email u have to take out the u in kalinaubears.
------------------------------
Date: Fri, 04 Mar 2005 14:53:20 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Passing in the replace string for a regex via the command line - HOW?
Message-Id: <d09sev$9t5$1@sun3.bham.ac.uk>
Anthony Roy wrote:
> A. Sinan Unur wrote:
> ...
>
>> $string =~ s/$in/$out/ee;
>
>
> Excellent - I knew there would be a simple solution. Thanks.
But this means the caller must pass the replacement as a Perl expression
rather than as a a double-quotish string.
If the caller is to pass a Perl expression it's simpler just to pass the
whole s/// as one argument rather than two.
eval $subst for $string;
If you insist on having in/out as separate variables then I'd suggest
the the chomp/eval/here-doc solution as described in my lightning talk
at YAPC::Europe::2004 where I pleaded for this question (and honest
answers to it) to be put in the FAQ.
------------------------------
Date: Fri, 04 Mar 2005 14:34:38 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: perl problem with select and non-blocking sysread from multiple pipes
Message-Id: <d09rbs$9bm$1@sun3.bham.ac.uk>
john wrote:
> Brian McCauley <nobull@mail.com> wrote in message news:<d01o4p$cpv$1@sun3.bham.ac.uk>...
>
>>Yes, yuk - this is not necessary in 5.6.1 and later - is compatability
>>with earlier Perl really needed?
>
> If there's a better way then I'll do it.
>
> Can you give me any pointers ?
Yes, go back and look at my previous post in this thread where I showed
you how simple it can be in Perl5.6.1 or later.
------------------------------
Date: 4 Mar 2005 04:49:48 -0800
From: "makko" <elmakko@gmail.com>
Subject: perlcc error
Message-Id: <1109940588.800051.143300@g14g2000cwa.googlegroups.com>
Hello all,
i tried using perlcc on my calc.pl script;
perlcc -o calc calc.pl
but i get this error;
/usr/bin/perlcc: calc.pl did not compile, which can't happen:
i'm using perl 5.8.4 on Slackware 10. What could be the cause of this?
regards,
Makko.
------------------------------
Date: Fri, 04 Mar 2005 13:21:50 +0000
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: perlcc error
Message-Id: <d09nds$jte$1@south.jnrs.ja.net>
makko wrote:
> Hello all,
> i tried using perlcc on my calc.pl script;
> perlcc -o calc calc.pl
>
> but i get this error;
> /usr/bin/perlcc: calc.pl did not compile, which can't happen:
>
> i'm using perl 5.8.4 on Slackware 10. What could be the cause of this?
perlcc doesn't work for all but the simplest of scripts. For all
practical purposes you should be using the pp tool (which is part of the
PAR module) to produce a standalone version of your Perl scripts.
http://search.cpan.org/~autrijus/PAR/script/pp
Simon.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7855
***************************************