[22480] in Perl-Users-Digest
Perl-Users Digest, Issue: 4701 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 12 18:11:26 2003
Date: Wed, 12 Mar 2003 15:10:16 -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 Wed, 12 Mar 2003 Volume: 10 Number: 4701
Today's topics:
Re: Problem matching a value in hash <tore@aursand.no>
Re: problem redefining a function <nobull@mail.com>
process name of own <VVVshengh_ccc@xxxspamxxx.com>
Re: process name of own <Ben_Vargo@Yahoo.com>
Re: process name of own <noreply@gunnar.cc>
Re: Remote File <johnthompson1@hotmail.com>
Re: search script <kenrose@rogers.com>
Re: select ip-adress out of pipe delimited file (aka ? the Platypus)
Re: select ip-adress out of pipe delimited file <abigail@abigail.nl>
Re: small parsing problem <noreply@gunnar.cc>
Re: small parsing problem <Graham.T.Wood@oracle.com>
Re: small parsing problem <cbk047@email.mot.com>
Re: small parsing problem <noreply@gunnar.cc>
Re: small parsing problem <cbk047@email.mot.com>
Re: small parsing problem (Nataku)
Re: small parsing problem (Sara)
Telnet.pm, buffering output (sean)
test posting <?!!@aol.com>
Re: test posting <abigail@abigail.nl>
Uninitialised variable - no it isn't! <s.patterson@freeuk.com>
what does this "$exitStatus>>8;" do <ben_altman@deadspam.com>
Re: what does this "$exitStatus>>8;" do <tony_curtis32@yahoo.com>
Re: what does this "$exitStatus>>8;" do <ben_altman@deadspam.com>
Re: WWW::Mechanize - Can't add via PPM3 in ActiverPerl <45673&5@yahoo.co.uk>
Re: XS, SWIG? Accessing C API easily <mgjv@tradingpost.com.au>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 12 Mar 2003 18:45:16 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Problem matching a value in hash
Message-Id: <pan.2003.03.12.16.55.50.12361@aursand.no>
On Wed, 12 Mar 2003 07:53:48 -0800, Steph wrote:
> Holly cow! How more embarassing could this get?
It became more embarassing when you top-posted.
--
Tore Aursand <tore@aursand.no>
------------------------------
Date: 12 Mar 2003 19:45:26 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: problem redefining a function
Message-Id: <u93cls74ix.fsf@wcl-l.bham.ac.uk>
Thens <thens@nospam.com> writes:
> *myFatal = \&scriptFatal; # From now when i say myFatal it will be scriptFatal
> The issue with this the perl compiler issues a warning saying
> 'subroutine myFatal is redefined'. Is there any other way i can do this.
> I tried using no strict before the globbing.
Why no strict? You are not using any of the three features that are
switched off by strict.
Surely no warnings 'redefine' would be more relevant :-)
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 12 Mar 2003 18:23:29 +0100
From: Sheng Han <VVVshengh_ccc@xxxspamxxx.com>
Subject: process name of own
Message-Id: <3E6F6D11.639C98B4@xxxspamxxx.com>
Hi folks,
I wonder if there is a way to get the processing perl script file name
from within the program itself,
i.e. running a perl script abc.pl from shell, how can I print out the
file name of itself in the program?
thanks in advance,
sean
------------------------------
Date: Wed, 12 Mar 2003 12:39:27 -0500
From: "The_Shadow" <Ben_Vargo@Yahoo.com>
Subject: Re: process name of own
Message-Id: <b4nrcf$l00$1@mailgate2.lexis-nexis.com>
This will give you the path and filename.
print "$0\n";
Use this to get just the file name.
my @file = split(/\\/, $0);
print "$file[-1]\n";
"Sheng Han" <VVVshengh_ccc@xxxspamxxx.com> wrote in message
news:3E6F6D11.639C98B4@xxxspamxxx.com...
> Hi folks,
>
> I wonder if there is a way to get the processing perl script file name
> from within the program itself,
> i.e. running a perl script abc.pl from shell, how can I print out the
> file name of itself in the program?
>
>
> thanks in advance,
> sean
>
------------------------------
Date: Wed, 12 Mar 2003 21:46:50 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: process name of own
Message-Id: <b4o6ar$2104q6$1@ID-184292.news.dfncis.de>
The_Shadow wrote:
> Use this to get just the file name.
> my @file = split(/\\/, $0);
--------------------^^
You are on Windows, I presume? Modifying your expression, this would
make it work on *nix as well:
my @file = split(/[\/\\]/, $0);
print "$file[-1]\n";
But an even more OS independent reply to Sean's question would be:
use File::Basename;
print basename($0);
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 12 Mar 2003 11:52:26 -0500
From: "Johnny" <johnthompson1@hotmail.com>
Subject: Re: Remote File
Message-Id: <3e6f65c0$1@news.xetron.com>
"Johnny" <johnthompson1@hotmail.com> wrote in message
news:3e6e459e$1@news.xetron.com...
> Hello,
>
> I'm trying to read a file on the proc file system. I figured I would use
> the File-Remote-1.16 module. However, I can't find an example anywhere
that
> shows how to send your username and password to the server.
>
> Can anybody help me?
>
> Thanks,
> John
>
>
In case anyone else has this problem, you don't supply a password to the
server. You use keys. See the manpage for ssh-keygen.
-- John
------------------------------
Date: Wed, 12 Mar 2003 11:59:15 -0500
From: Kenneth Rose <kenrose@rogers.com>
Subject: Re: search script
Message-Id: <b4np14$k64$1@tabloid.uwaterloo.ca>
The first thing that you want to do is to get the keywords from Excel.
Not sure about Excel support for Perl, but you may want to check out:
http://search.cpan.org/author/KWITKNR/Spreadsheet-ParseExcel-0.2602/ParseExcel.pm
Also, there is a DBI interface to Excel (which in fact uses the above
package). See:
http://search.cpan.org/author/KWITKNR/DBD-Excel-0.06/Excel.pm
For each keyword, you want to detect if it's in a particular document
(you'll have to parse the document). To do this, you may want to store
the keywords as keys in a hash table. (the values could be true).
Lookup time in a hash table is O(1), so this will allow you to very
quickly tell if a certain word in the document is a keyword.
With respect to parsing:
Plain text is easy to parse, use grep.
HTML is a bit harder cause you have to get around the markup. See:
http://search.cpan.org/search?module=HTML::Parser
For parsing PDF, you'll want to use:
http://search.cpan.org/author/ANTRO/PDF-111/PDF.pm
As a final note, have you considered not keeping the keywords in an
Excel worksheet? Excel is a proprietary format and does not have a good
programmatic interface. You may be able to save yourself a lot of grief
by using a more standard approach like the keywords into a database
table (or even into a plain-text file, one per line).
/<en
Marco wrote:
> Hi,
> I am searching a perl/cgi script that can solve my problem.
> I download some txt or html or even pdf files from Internet and I
> want to check if there are some keywords in it.
> The keywords are in an excel or in a text file. There are more that
> 4.000.
> I would like to check if the keywords are present in these files and
> know which are these keywords.
>
> Thanks for you help
>
> Marco
------------------------------
Date: Wed, 12 Mar 2003 21:55:08 GMT
From: "David Formosa (aka ? the Platypus)" <dformosa@dformosa.zeta.org.au>
Subject: Re: select ip-adress out of pipe delimited file
Message-Id: <slrnb6vbeq.s3t.dformosa@dformosa.zeta.org.au>
On 11 Mar 2003 19:56:28 GMT, Abigail <abigail@abigail.nl> wrote:
[...]
> ^^ $line=<FILE>;
> ^^ ($one,$two,$three,$four,$five,$sic,$seven)=split /[|]/, $line,7;
> ^^ print "$six\n";
> ^^
> ^^ Anybody a better idea ?
>
>
> That's a fine way of doing it (after fixing the typo). You could do
>
> my ($ip) = (split /[|]/ => $line, 7) [5];
Why do you need a list context here?
--
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
------------------------------
Date: 12 Mar 2003 22:18:40 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: select ip-adress out of pipe delimited file
Message-Id: <slrnb6vci0.1ud.abigail@alexandra.abigail.nl>
David Formosa (aka ? the Platypus) (dformosa@dformosa.zeta.org.au) wrote
on MMMCDLXXX September MCMXCIII in <URL:news:slrnb6vbeq.s3t.dformosa@dformosa.zeta.org.au>:
}} On 11 Mar 2003 19:56:28 GMT, Abigail <abigail@abigail.nl> wrote:
}}
}} [...]
}}
}} > ^^ $line=<FILE>;
}} > ^^ ($one,$two,$three,$four,$five,$sic,$seven)=split /[|]/, $line,7;
}} > ^^ print "$six\n";
}} > ^^
}} > ^^ Anybody a better idea ?
}} >
}} >
}} > That's a fine way of doing it (after fixing the typo). You could do
}} >
}} > my ($ip) = (split /[|]/ => $line, 7) [5];
}}
}} Why do you need a list context here?
You don't. It doesn't matter.
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: Wed, 12 Mar 2003 17:22:16 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: small parsing problem
Message-Id: <b4nmtd$214jed$1@ID-184292.news.dfncis.de>
Please post text plain messages!
gary wrote:
> If I had a line in a file that resembled this:
>
> Firstname Lastname <firstnamelastname@someisp.com> 1234
>
> -or-
>
> Name <firstnamelastname@someisp.com> 1234
>
> how can I get three fields from this line. They are:
> $1 - (which is the user's name whether or not its one word or many)
> $2 - (email- which is everything between the <>)
> $3 - (the number at the end of the line)
$string =~ s/^([^<]+?) +<([^>])> +(\d+)//;
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 12 Mar 2003 16:39:52 +0000
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: small parsing problem
Message-Id: <3E6F62D8.810B5E3@oracle.com>
This is a multi-part message in MIME format.
--------------94488AE88445F95DEC695413
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Gunnar Hjalmarsson wrote:
> Please post text plain messages!
>
> gary wrote:
> > If I had a line in a file that resembled this:
> >
> > Firstname Lastname <firstnamelastname@someisp.com> 1234
> >
> > -or-
> >
> > Name <firstnamelastname@someisp.com> 1234
> >
> > how can I get three fields from this line. They are:
> > $1 - (which is the user's name whether or not its one word or many)
> > $2 - (email- which is everything between the <>)
> > $3 - (the number at the end of the line)
>
> $string =~ s/^([^<]+?) +<([^>])> +(\d+)//;
This will only get a single non ">" character between the < and >. I
wouldn't assume there would be spaces before the < and after the >
either. Why the substitution?
($name,$email,$number)= $string =~ /^([^<]+?)\s*<([^>]+)>\s*(\d+)/;
Graham
--------------94488AE88445F95DEC695413
Content-Type: text/x-vcard; charset=UTF-8;
name="Graham.T.Wood.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Graham Wood
Content-Disposition: attachment;
filename="Graham.T.Wood.vcf"
begin:vcard
n:;Graham
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:Graham.Wood@oracle.com
fn:Graham Wood
end:vcard
--------------94488AE88445F95DEC695413--
------------------------------
Date: Wed, 12 Mar 2003 10:24:31 -0600
From: Bryan Krone <cbk047@email.mot.com>
Subject: Re: small parsing problem
Message-Id: <3E6F5F3F.4623ED16@email.mot.com>
--------------683689739547A01D14E1B5A0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
gary wrote:
> Hi There, If I had a line in a file that resembled this: Firstname
> Lastname <firstnamelastname@someisp.com> 1234 -or- Name
> <firstnamelastname@someisp.com> 1234 how can I get three fields from
> this line. They are:$1 - (which is the user's name whether or not its
> one word or many)$2 - (email- which is everything between the <>)$3 -
> (the number at the end of the line) Thanks for your help
#!/usr/bin/perl
$s1 = "Firstname Lastname <firstnamelastname\@someisp.com> 1234";
$s2 = "Name <firstnamelastname\@someisp.com> 1234";
foreach ( split /<|>/, $s1 )
{
print;
print "\n";
}
print "\n";
foreach ( split /<|>/, $s2 )
{
print;
print "\n";
}
--------------683689739547A01D14E1B5A0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<body bgcolor="#FFFFFF">
gary wrote:
<blockquote TYPE=CITE><style></style>
<font face="Arial"><font size=-1>Hi
There,</font></font> <font face="Arial"><font size=-1>If I had
a line in a file that resembled this:</font></font> <font face="Arial"><font size=-1>Firstname
Lastname <<a href="mailto:firstnamelastname@someisp.com">firstnamelastname@someisp.com</a>>
1234</font></font> <font face="Arial"><font size=-1>-or-</font></font> <font face="Arial"><font size=-1>Name
<<a href="mailto:firstnamelastname@someisp.com">firstnamelastname@someisp.com</a>>
1234</font></font> <font face="Arial"><font size=-1>how can
I get three fields from this line. They are:</font></font><font face="Arial"><font size=-1>$1
- (which is the user's name whether or not its one word or many)</font></font><font face="Arial"><font size=-1>$2
- (email- which is everything between the <>)</font></font><font face="Arial"><font size=-1>$3
- (the number at the end of the line)</font></font> <font face="Arial"><font size=-1>Thanks
for your help</font></font> </blockquote>
<p><br>#!/usr/bin/perl
<p>$s1 = "Firstname Lastname <firstnamelastname\@someisp.com> 1234";
<p>$s2 = "Name <firstnamelastname\@someisp.com> 1234";
<p>foreach ( split /<|>/, $s1 )
<br>{
<br> print;
<br> print "\n";
<br>}
<p>print "\n";
<p>foreach ( split /<|>/, $s2 )
<br>{
<br> print;
<br> print "\n";
<br>}
<br>
</body>
</html>
--------------683689739547A01D14E1B5A0--
------------------------------
Date: Wed, 12 Mar 2003 18:00:18 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: small parsing problem
Message-Id: <b4np21$1v7acc$1@ID-184292.news.dfncis.de>
Graham Wood wrote:
> Gunnar Hjalmarsson wrote:
>
>> $string =~ s/^([^<]+?) +<([^>])> +(\d+)//;
>
> This will only get a single non ">" character between the < and >.
Yeah, I missed that + modifier. Should have tested. Bad!!
> Why the substitution?
Unnecessary.
> ($name,$email,$number)= $string =~ /^([^<]+?)\s*<([^>]+)>\s*(\d+)/;
Thanks for your correction and improvement!
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 12 Mar 2003 11:06:28 -0600
From: Bryan Krone <cbk047@email.mot.com>
Subject: Re: small parsing problem
Message-Id: <3E6F6914.B38F9810@email.mot.com>
--------------55A43232DCEE3E8ADD232B1D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Bryan Krone wrote:
> gary wrote:
>
>> Hi There, If I had a line in a file that resembled this: Firstname
>> Lastname <firstnamelastname@someisp.com> 1234 -or- Name
>> <firstnamelastname@someisp.com> 1234 how can I get three fields
>> from this line. They are:$1 - (which is the user's name whether or
>> not its one word or many)$2 - (email- which is everything between
>> the <>)$3 - (the number at the end of the line) Thanks for your help
>
>
> #!/usr/bin/perl
>
> $s1 = "Firstname Lastname <firstnamelastname\@someisp.com> 1234";
>
> $s2 = "Name <firstnamelastname\@someisp.com> 1234";
>
> foreach ( split /<|>/, $s1 )
> {
> print;
> print "\n";
> }
>
> print "\n";
>
> foreach ( split /<|>/, $s2 )
> {
> print;
> print "\n";
> }
>
#!/usr/bin/perl
@strings = ( 'Firstname Lastname <firstnamelastname@someisp.com> 1234',
'Name <firstnamelastname@someisp.com> 1234' );
foreach $s ( @strings )
{
@rhash{( "Name", "Address", "Number" )} = split /\s+<|>\s+/, $s;
print "Name: $rhash{Name}\n";
print "Address: $rhash{Address}\n";
print "Number: $rhash{Number}\n";
print "\n";
}
--------------55A43232DCEE3E8ADD232B1D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<body bgcolor="#FFFFFF">
Bryan Krone wrote:
<blockquote TYPE=CITE>gary wrote:
<blockquote TYPE=CITE><style></style>
<font face="Arial"><font size=-1>Hi
There,</font></font> <font face="Arial"><font size=-1>If I had a
line in a file that resembled this:</font></font> <font face="Arial"><font size=-1>Firstname
Lastname <<a href="mailto:firstnamelastname@someisp.com">firstnamelastname@someisp.com</a>>
1234</font></font> <font face="Arial"><font size=-1>-or-</font></font>
<font face="Arial"><font size=-1>Name <<a href="mailto:firstnamelastname@someisp.com">firstnamelastname@someisp.com</a>>
1234</font></font> <font face="Arial"><font size=-1>how can I get
three fields from this line. They are:$1 - (which is the user's name whether
or not its one word or many)$2 - (email- which is everything between the
<>)$3 - (the number at the end of the line)</font></font> <font face="Arial"><font size=-1>Thanks
for your help</font></font></blockquote>
<p><br>#!/usr/bin/perl
<p>$s1 = "Firstname Lastname <firstnamelastname\@someisp.com> 1234";
<p>$s2 = "Name <firstnamelastname\@someisp.com> 1234";
<p>foreach ( split /<|>/, $s1 )
<br>{
<br> print;
<br> print "\n";
<br>}
<p>print "\n";
<p>foreach ( split /<|>/, $s2 )
<br>{
<br> print;
<br> print "\n";
<br>}
<br> </blockquote>
#!/usr/bin/perl
<p>@strings = ( 'Firstname Lastname <firstnamelastname@someisp.com>
1234', 'Name <firstnamelastname@someisp.com> 1234' );
<p>foreach $s ( @strings )
<br>{
<br> @rhash{( "Name", "Address", "Number" )} = split /\s+<|>\s+/,
$s;
<p> print "Name: $rhash{Name}\n";
<br> print "Address: $rhash{Address}\n";
<br> print "Number: $rhash{Number}\n";
<br> print "\n";
<br>}
<br>
</body>
</html>
--------------55A43232DCEE3E8ADD232B1D--
------------------------------
Date: 12 Mar 2003 11:40:40 -0800
From: Crapnut566@yahoo.com (Nataku)
Subject: Re: small parsing problem
Message-Id: <7e48fc99.0303121140.16468c50@posting.google.com>
m/(\w* ?\w*) <(.*)> (\d*)/
produces this output for both
P:\>perl C:\WINNT\Profiles\bimp\Desktop\test.pl
1 - Firstname Lastname
2 - firstnamelastname@someisp.com
3 - 1234
P:\>perl C:\WINNT\Profiles\bimp\Desktop\test.pl
1 - Name
2 - firstnamelastname@someisp.com
3 - 1234
"gary" <grobitaille@mail.com> wrote in message news:<syIba.29238$cB3.140530@nnrp1.uunet.ca>...
> Hi There,
>
>
> If I had a line in a file that resembled this:
>
> Firstname Lastname <firstnamelastname@someisp.com> 1234
>
> -or-
>
> Name <firstnamelastname@someisp.com> 1234
>
>
> how can I get three fields from this line. They are:
> $1 - (which is the user's name whether or not its one word or many)
> $2 - (email- which is everything between the <>)
> $3 - (the number at the end of the line)
>
> Thanks for your help
>
> --
------------------------------
Date: 12 Mar 2003 12:54:18 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: small parsing problem
Message-Id: <776e0325.0303121254.7decb7a0@posting.google.com>
"gary" <grobitaille@mail.com> wrote in message news:<syIba.29238$cB3.140530@nnrp1.uunet.ca>...
> Hi There,
>
>
> If I had a line in a file that resembled this:
>
> Firstname Lastname <firstnamelastname@someisp.com> 1234
>
> -or-
>
> Name <firstnamelastname@someisp.com> 1234
>
>
> how can I get three fields from this line. They are:
> $1 - (which is the user's name whether or not its one word or many)
> $2 - (email- which is everything between the <>)
> $3 - (the number at the end of the line)
>
> Thanks for your help
>
> --
I'm not entirely sure of what the difference is between your "Name"
and your "Firstname Lastname". Aren't they the same thing? Maybe you
mean like "Cher" which has no last name? At any rate, we can make it
work for both:
ok lessee..
#!/usr/bin/perl -wd
$_ = 'Firstname Lastname <firstnamelastname@someisp.com> 1234';
print "$1, $2, $3\n\n" if /\s* (\w+\s*\w*) \s* <([^\>]+)>
\s*(\d+)/x;
$_ = 'Name <firstnamelastname@someisp.com> 1234';
print "$1, $2, $3\n\n" if /\s* (\w+\s*\w*) \s* <([^\>]+)>
\s*(\d+)/x;
print "wasn't that fun??\n\n";
Cheers,
-Gx
------------------------------
Date: 12 Mar 2003 12:55:46 -0800
From: oxandrolone@hotmail.com (sean)
Subject: Telnet.pm, buffering output
Message-Id: <2b051f5c.0303121255.46e680d9@posting.google.com>
I'm fairly green with PERL.
I have a need to retrieve the output from a bunch of commands from a
large number of Cisco routers. For some reason, which i think is due
to buffering, i never get all the data back.
Here is the snip...
open(current_device, "error.log");
my $telnet = new Net::Telnet ( Timeout => 10,
# prompt => '/[\w().-]*[\$#>]\s?
Errmode => "return"
);
snip..lots of logic for getting into the things...
$ok = $telnet->cmd("set len 0");
@shconf = $telnet->cmd(String => "show conf",Timeout => 300);
@shver = $telnet->cmd(String => "show ver",Timeout => 300);
@shvlan = $telnet->cmd(String => "show vlan",Timeout => 300);
print current_device @shconf;
print current_device @shver;
print current_device @shvlan;
close it all up and clean up.
My problem is, no matter what I seem to do, all of the data never
makes it into the file.
------------------------------
Date: Thu, 13 Mar 2003 03:59:31 +0800
From: <?!!@aol.com>
Subject: test posting
Message-Id: <4N$vZGN6CHA.276@newsgroup.korea.com>
?!!
------------------------------
Date: 12 Mar 2003 20:29:05 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: test posting
Message-Id: <slrnb6v64g.1ud.abigail@alexandra.abigail.nl>
<?!!@aol.com> (?!!@aol.com) wrote on MMMCDLXXX September MCMXCIII in
<URL:news:4N$vZGN6CHA.276@newsgroup.korea.com>:
-- ?!!
*PLOINK*
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
------------------------------
Date: 12 Mar 2003 21:49:55 GMT
From: Stephen Patterson <s.patterson@freeuk.com>
Subject: Uninitialised variable - no it isn't!
Message-Id: <slrnb6vas3.vb.s.patterson@bloodnok.localdomain>
I'm nitpicking a script to get it to run fine with `perl -w' (it
already runs with strict) and am stuck with the final line of this
block which perl claims to be using an uninitialised value in string eq.
Consider the following code fragment
use URI;
my $uri = $params{uri};
print "about to index $uri\n";
my $url = URI->new($uri) or say "couldn't create URI object to
# check url options\n";
print "url is $uri\n";
print "URI object is $url\n";
if ($url->scheme() eq 'ftp') {
This gives me Use of uninitialized value in string eq at
lib/DBIx/TextSearch.pm line 314. (the line with the if statement), but
all the print statements above display the correct (defined) values of
$url and $uri.
Any help would be appreciated.
--
Stephen Patterson http://www.lexx.uklinux.net http://patter.mine.nu
steve@SPAM.lexx.uklinux.net remove SPAM to reply
Linux Counter No: 142831 GPG Public key: 252B8B37
Last one down the pub's an MCSE
------------------------------
Date: Wed, 12 Mar 2003 16:17:55 -0500
From: Ben <ben_altman@deadspam.com>
Subject: what does this "$exitStatus>>8;" do
Message-Id: <b4o864$21i9v9$1@ID-121117.news.dfncis.de>
I have a perl script with the following line:
$exitStat>>8;
Would someone tell me or point me to where I find out what it does?
Thanks,
Ben
------------------------------
Date: Wed, 12 Mar 2003 15:18:48 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: what does this "$exitStatus>>8;" do
Message-Id: <87adg0uvuv.fsf@limey.hpcc.uh.edu>
>> On Wed, 12 Mar 2003 16:17:55 -0500,
>> Ben <ben_altman@deadspam.com> said:
> I have a perl script with the following line:
> $exitStat>>8;
> Would someone tell me or point me to where I find out
> what it does?
perldoc -f system
------------------------------
Date: Wed, 12 Mar 2003 17:02:58 -0500
From: Ben <ben_altman@deadspam.com>
Subject: Re: what does this "$exitStatus>>8;" do
Message-Id: <b4oaqj$20ab02$1@ID-121117.news.dfncis.de>
Tony Curtis wrote:
>>I have a perl script with the following line:
>>$exitStat>>8;
>>Would someone tell me or point me to where I find out
>>what it does?
>
>
> perldoc -f system
Does that mean that system() returns the exit status in the upper and
lower 8 bits and overwrites the upper if a signal is sent to the process
being run?
When I did this:
perl -e '$e = system("echo $$; sleep 20; exit 1");
$o = $e >> 8; print "$o\n";'
and sent a sigint to the sleep it output 130 and otherwise output 1.
Thanks,
Ben
------------------------------
Date: Wed, 12 Mar 2003 12:58:58 -0500
From: L D Jones <45673&5@yahoo.co.uk>
Subject: Re: WWW::Mechanize - Can't add via PPM3 in ActiverPerl 5.8
Message-Id: <3E6F7562.FDC3BFA8@yahoo.co.uk>
Fred Finisterre wrote:
>
> Anyone know why? Why would it not be in the ActiveState Perl repositories?
>
> "search mechanize" doesn't list it.
I don't know why but I found the same thing and then simply downloaded
it and installed it manually. The latest version (0.37) does not contain
any dependence on the Clone module so no compiler is required. Even an
install with the required compile at version 0.36 took less than 5
minutes
Maybe ActiveState can just add it on request.
------------------------------
Date: Wed, 12 Mar 2003 22:49:39 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: XS, SWIG? Accessing C API easily
Message-Id: <slrnb6vec4.79p.mgjv@verbruggen.comdyn.com.au>
On 12 Mar 2003 06:23:41 GMT,
Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
> Also sprach Martien Verbruggen:
>
>>> () I'd hate to have to learn to write 40 separate interface declarations
>>> () for 40 C functions that I need, only to find that I can't call most
>>> () of these functions from Perl.
>>
>> If there's only 40, I'd probably just let h2xs or swig do its job, and
>> write a pure Perl wrapper to translate the C API calling conventions
>> into something more palatable to the Perl programmer. This avoids you
>> having to know much about the guts of perl (perlguts) or its C API
>> (perlapi), although that never can hurt.
>
> With "h2xs ... do its job" you are probably referring to its -x switch
> that should in theory be able to generate the XSUBS for you based on a C
> interface.
Yep.
> I tried it once with a not so complex C header and C::Scan
> (which is used for parsing the C code) bailed out quite horribly. Ever
> since that I refrained from any attempts to have it done for me
> automatically and instead wrote my own proper XSUBS which is guaranteed
> to always work.
You might want to give the latest versions of this stuff a try. Quite
some work has gone into improving them between 5.6 and 5.8.
However, you are right, there will be instances where problems occur.
> I heard that SWIG can do it and perhaps it even works. But I still think
> that wrapping up a C library for Perl without knowing the innards of XS
> is an illusion and will end in frustration and a butt-ugly interface
> (as you already mentioned).
Yep :)
Which is why my suggestion is to allow the butt-ugly interface
internally, and write a pure-perl wrapper module that does the
necessary translations. You'd still need some knowledge of XS and
internals, but not nearly as much as when implementing it all in XS.
There are many more ways for making mistakes in XS than there are in
Perl, and the errors can result in much, much uglier bugs.
>>> You might want to consider Inline::C.
>>
>> That's another possibility.
>
> Oh, I think I have to study Inline::C once more or otherwise I'll never
> understand why people think it's superiour and easier than XS.
My main use for Inline::C has been to create some higher-performance
inline code for programs. I haven't actually used it to write a
full-fledged module, interfacing it to a C library. I know it is
possible, but I can't comment on whether it would be easier or harder,
more or less convenient, or more or less portable.
Martien
--
|
Martien Verbruggen | If at first you don't succeed, try again.
Trading Post Australia | Then quit; there's no use being a damn fool
| about it.
------------------------------
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.
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 4701
***************************************