[15853] in Perl-Users-Digest
Perl-Users Digest, Issue: 3266 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 6 14:15:47 2000
Date: Tue, 6 Jun 2000 11:15:34 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960315334-v9-i3266@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 6 Jun 2000 Volume: 9 Number: 3266
Today's topics:
Re: problem with perl garbage collecting (Ilya Zakharevich)
Sending HTML-rich email greggulrich@yahoo.com
Re: Sending HTML-rich email <blah@nospam.com>
Re: Sending HTML-rich email <flavell@mail.cern.ch>
Re: Sockets -- Packet at a time? <dan@tuatha.sidhe.org>
Re: Sockets -- Packet at a time? nobull@mail.com
sort function problems <tempest@entropy.muc.muohio.edu>
Re: sort function problems <andersen+@rchland.ibm.com>
Re: Splitting But NOT Splitting (Bart Lateur)
Re: strict doesnt like array references (Ala Qumsieh)
Re: strict doesnt like array references <mc@backwoods.org>
Re: strict doesnt like array references <lr@hpl.hp.com>
Tar module <se97hs@dmu.ac.uk>
Re: Tar module <red_orc@my-deja.com>
Text file busy <ricklim@vcn.bc.ca>
Re: Text file busy <care227@attglobal.net>
Re: Text file busy <red_orc@my-deja.com>
Re: the end of perl? (Csaba Raduly)
Re: the end of perl? (Bart Lateur)
Re: the end of perl? <flavell@mail.cern.ch>
URI encoded parameter for CGI.pm problem. crrjohnson@my-deja.com
Re: using 'exists' in a program to test for keys in a h (Anno Siegel)
Re: using 'exists' in a program to test for keys in a h (Ala Qumsieh)
Value of <HANDLE> construct can be "0" ??? adrian2001@my-deja.com
Re: Value of <HANDLE> construct can be "0" ??? (Ala Qumsieh)
Re: Value of <HANDLE> construct can be "0" ??? <tina@streetmail.com>
Why won't this interpolate please? <webqueen@my-deja.com>
Re: Why won't this interpolate please? (Ala Qumsieh)
Re: Why won't this interpolate please? nobull@mail.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Jun 2000 17:05:33 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: problem with perl garbage collecting
Message-Id: <8hjb0t$bk1$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to
<poppln@my-deja.com>],
who wrote in article <8hir98$s7p$1@nnrp1.deja.com>:
> Well $^P didn't help. what ever I tried either caused a core dump or
> the script worked but with the garbage collecting problem.
>
> However, setting PERLDB_OPTS='N' before running the script with perl -
> wd DID solve the problem :)
Extremely strange. -d does very little in addition to setting $^P.
Well, it loads perl5db.pl, but I do not think that defining several
subroutines and variables would change anything...
Wait! $SIG{__DIE__} and __WARN__ are set. Maybe this?
Ilya
------------------------------
Date: Tue, 06 Jun 2000 15:50:24 GMT
From: greggulrich@yahoo.com
Subject: Sending HTML-rich email
Message-Id: <8hj6jo$596$1@nnrp1.deja.com>
I have a PERL script that I want to have send email that contains
HTML. How can I do this in PERL (I am already assuming that I can)? I
tried CPAN but really don't know what to look for.
Direct reply is better.
Thanks!
-g
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 06 Jun 2000 18:04:58 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Sending HTML-rich email
Message-Id: <393D212A.99F99482@nospam.com>
greggulrich,
greggulrich@yahoo.com wrote:
> I have a PERL script that I want to have send email that
> contains HTML. How can I do this in PERL (I am already assuming
> that I can)? I tried CPAN but really don't know what to look for.
You have to send a multipart message. The HTML part should referred
by a content-type declaration like
Content-Type: text/html; charset=iso-8859-1
Best regards,
Marco
------------------------------
Date: Tue, 6 Jun 2000 18:37:46 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Sending HTML-rich email
Message-Id: <Pine.GHP.4.21.0006061837350.21711-100000@hpplus03.cern.ch>
On Tue, 6 Jun 2000 greggulrich@yahoo.com wrote:
> Direct reply is better.
isn't
------------------------------
Date: Tue, 06 Jun 2000 15:36:21 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Sockets -- Packet at a time?
Message-Id: <VT8%4.103144$hT2.419299@news1.rdc1.ct.home.com>
Trevor Peirce <trev@hostyersite.com> wrote:
> Hello,
> Is there a way to have Perl receive a packet at a time?
With UDP? Sure. Just do a sysread and it won't cross packet boundaries.
You can't do a packet read with a TCP stream, as there aren't any packets,
so no packet boundaries. (If you're counting on packets from TCP then your
design's got a problem, since TCP streams can be broken up and reassembled
in any way the network hardware and software cares to do)
Dan
------------------------------
Date: 06 Jun 2000 17:49:48 +0100
From: nobull@mail.com
Subject: Re: Sockets -- Packet at a time?
Message-Id: <u9snuqpxeb.fsf@wcl-l.bham.ac.uk>
Trevor Peirce <trev@hostyersite.com> writes:
> Is there a way to have Perl receive a packet at a time?
Yes, recv() (or IO::Socket::recv). Of course this only applies if you
are using a socket protocol in which packets are something that exist
at the user level.
> The server I
> need to connect to interacts kinda as follows (>> is what server sends,
> each line is one packet, << is what I send to the server)
>
> <<l
> >>l
> >>contents
>
> I need to be prepared to handle data in sets of packets -- if I get an
> 'l' that means a channel list is comming, and the next packet will be
> just that.
BTW: what socket type is this using? Clearly it can't be TCP/IP or
UDP/IP. TCP is a byte-stream protocol does not have a packet concept.
UDP makes no promise about delivering datagrams in the order they were
sent.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 6 Jun 2000 16:21:12 GMT
From: compiler <tempest@entropy.muc.muohio.edu>
Subject: sort function problems
Message-Id: <8hj8do$icj$1@tribune.oar.net>
I am having a problem with the sort function. I am sorting
titles of books, and it works sort of - no pun intended.
I have 245 books, it sorts ~30-40 correctly then starts over
at the letter A and sorts the rest again!
Here is my sort function :
sub byTitle { # sort by title
$title{$a} cmp $title{$b};
}
the $a and $b are keys to the hash
I threw some prints in there to watch what it was sorting and when
but I just can't figure out why it's doing that.
Here is the line that calls it :
if ($sortby eq "title") { @final = sort byTitle @final; }
Is there something I am missing?
I am using 5.005_03 built for sun4-solaris.
------------------------------
Date: Tue, 06 Jun 2000 12:00:36 -0500
From: "Paul R. Andersen" <andersen+@rchland.ibm.com>
Subject: Re: sort function problems
Message-Id: <393D2E34.E518F3E6@rchland.ibm.com>
compiler wrote:
>
> I am having a problem with the sort function. I am sorting
> titles of books, and it works sort of - no pun intended.
> I have 245 books, it sorts ~30-40 correctly then starts over
> at the letter A and sorts the rest again!
> Here is my sort function :
> sub byTitle { # sort by title
> $title{$a} cmp $title{$b};
> }
> the $a and $b are keys to the hash
> I threw some prints in there to watch what it was sorting and when
> but I just can't figure out why it's doing that.
> Here is the line that calls it :
> if ($sortby eq "title") { @final = sort byTitle @final; }
> Is there something I am missing?
> I am using 5.005_03 built for sun4-solaris.
I trust that @final starts out as some randomly ordered list of book
numbers or something like that? When you get done, doing something
like: foreach (@final) {print "$title{$_}\n";} gives the result you
describe above? I would print @final and %title before the sort and
again after to see for sure what has happened. For more help, we need
to to know just a bit more about @final.
--
Paul Andersen
-- I can please only ONE person per day.
-- Today is NOT your day.
-- Tomorrow isn't looking good either.
------------------------------
Date: Tue, 06 Jun 2000 13:14:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Splitting But NOT Splitting
Message-Id: <393cf748.3503116@news.skynet.be>
Robert Young wrote:
>Can anyone give me a regular expression to perform a split where the
>expression is split on a character unless the character is preceded by a
>backslash (\) ?
My first thought of a solution was in the same realm as Abe Timmerman's
reply.
My second though was: Wait! What will happen if you have double
backslashes? Will the backslash be escaped? So a backslash followed by a
backslash will NOT escape a comma?
In that case, this reverse approach might appeal to you.
$_ = "This,is\\,not,is\\\\,too,separated,,!";
print "$_\n";
@fields = /(?:^|\G,)((?:[^\\,]|\\.)*)/g;
$" = '|';
print "@fields\n";
--
Bart.
------------------------------
Date: Tue, 06 Jun 2000 14:52:50 GMT
From: aqumsieh@hyperchip.com (Ala Qumsieh)
Subject: Re: strict doesnt like array references
Message-Id: <8F4B63004aqumsiehhyperchipcom@198.235.216.4>
mc@backwoods.org (MC) wrote in <393C4EA0.AA79656D@backwoods.org>:
>use strict;
>
>my @array = qw( this is a test );
>my $test = "array";
>
>print @array;
>print @{$test};
It seems that you want to access a data structure based on its name.
For this kind of operation, a hash is the most logical solution:
use strict;
my %hash;
$hash{array} = [qw/this is a test/];
my $test = 'array';
print "@{$hash{$test}}";
--Ala
------------------------------
Date: Tue, 06 Jun 2000 11:26:34 -0400
From: MC <mc@backwoods.org>
Subject: Re: strict doesnt like array references
Message-Id: <393D182A.4E87721@backwoods.org>
Hehehe, ahead of you. I have done just this since my last post. I have added the
data records to the main hash matrix along with the data structurs.
hence...
$dbs{ --database--}{file} is the filename (flatfile db)
$dbs{ --database--}{fields} is an array of the field names, in the order they
appear
$dbs{ --database--}{records} is an array of text records (NOT split into fields)
i considered splitting the records further into fields at this point, but
because of the needs of the program (sorting, etc) i decided this is more effort
than necessary, altho i may do this later. For now records are split into a
separate hash as needed as shown below...
$item is a text record grep'd from $dbs{ --database-- }{records}
%item will be a hash of the record
@item{@{$dbs{ --database-- }{fields}}} = split($x,$item);
MC
Ala Qumsieh wrote:
>
> mc@backwoods.org (MC) wrote in <393C4EA0.AA79656D@backwoods.org>:
>
> >use strict;
> >
> >my @array = qw( this is a test );
> >my $test = "array";
> >
> >print @array;
> >print @{$test};
>
> It seems that you want to access a data structure based on its name.
> For this kind of operation, a hash is the most logical solution:
>
> use strict;
>
> my %hash;
> $hash{array} = [qw/this is a test/];
> my $test = 'array';
>
> print "@{$hash{$test}}";
>
> --Ala
--
---------------------------------------------------------------------
My email address(s) are my private property. They are NOT to be used
or recorded for ANY reason without my explicit permission. Disregard
of this statement is in violation of federal privacy & copyright law.
---------------------------------------------------------------------
The new Decade/Century/Millennium doesnt start until the year 2001 !!
Lets make the year 2000, the last year of the Millennium, a good one!
--------------------------------------------+------------------------
|
<-- THIS SPACE FOR RENT --> | Question Reality
advertise~backwoods.org |
|
Time is nature's way of keeping | If at first you don't
everything from happening at once | succeed... REBOOT!
|
--------------------------------------------+------------------------
------------------------------
Date: Tue, 6 Jun 2000 10:40:15 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: strict doesnt like array references
Message-Id: <MPG.13a6d755b6877fa398ab27@nntp.hpl.hp.com>
In article <393cad61.4792371@news.skynet.be> on Tue, 06 Jun 2000
07:58:31 GMT, Bart Lateur <bart.lateur@skynet.be> says...
...
> Now, as you may recall, boolean tests return 0 for false and 1 for true.
In an arithmetic context.
> So it's safe to use
>
> print @{$ref[$myvar ne 'one']};
>
> which will use the first array (index 0) is $myvar is 'one', and the
> second array otherwise.
It's safe, but I wish it were documented!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 06 Jun 2000 14:44:19 +0100
From: Haris Siakalis <se97hs@dmu.ac.uk>
Subject: Tar module
Message-Id: <393D0033.BA0D2FCF@dmu.ac.uk>
Hello,
i have used with success the module Tar to create a tar archive. Is
there a way to untar the archive in perl? I have checked the docs but
couldn't
make out if i can.In my opinion I cannot.
Haris
------------------------------
Date: Tue, 06 Jun 2000 14:59:11 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Tar module
Message-Id: <8hj3jl$2qb$1@nnrp1.deja.com>
In article <393D0033.BA0D2FCF@dmu.ac.uk>,
Haris Siakalis <se97hs@dmu.ac.uk> wrote:
> Hello,
> i have used with success the module Tar to create a tar archive. Is
> there a way to untar the archive in perl? I have checked the docs but
> couldn't
> make out if i can.In my opinion I cannot.
>
> Haris
>
have you looked into backticks?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 6 Jun 2000 13:21:06 GMT
From: Rick Lim <ricklim@vcn.bc.ca>
Subject: Text file busy
Message-Id: <8hits2$s23$1@sylvester.vcn.bc.ca>
I'm using a RedHat 6.2 linux and version 5.005_03 built for i386-linux
I get the message 'Text file busy'
when I execute my perl script, rebooting seems to clear it up
anyone got any ideas on what to do about this?
--
The wealth of reality, cannot be seen from your locality.
------------------------------
Date: Tue, 06 Jun 2000 10:27:13 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Text file busy
Message-Id: <393D0A41.2EF5660A@attglobal.net>
Rick Lim wrote:
>
> I'm using a RedHat 6.2 linux and version 5.005_03 built for i386-linux
>
> I get the message 'Text file busy'
I saw this error as well once. I deleted the file and reloaded it,
which fixed the problem. Seems this is caused by a screwy inode
or some corruption thereof. Check the deja archives and do a search
on "text file busy", you'll see a discussion about this error some
many months ago.
HTH
------------------------------
Date: Tue, 06 Jun 2000 14:57:02 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Text file busy
Message-Id: <8hj3fl$2p1$1@nnrp1.deja.com>
In article <8hits2$s23$1@sylvester.vcn.bc.ca>,
Rick Lim <ricklim@vcn.bc.ca> wrote:
> I'm using a RedHat 6.2 linux and version 5.005_03 built for i386-linux
>
> I get the message 'Text file busy'
> when I execute my perl script, rebooting seems to clear it up
>
> anyone got any ideas on what to do about this?
>
from what you have shown of your script, I surmise the problem is in
line 17 ;^)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 6 Jun 2000 13:59:47 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: the end of perl?
Message-Id: <8F4B9071Dquuxi@193.82.145.131>
02 Jun 2000: A formal bug report was sent to Seti@Home, because the
following message originated from bill.kemp@wire2.com (W Kemp) was
reported as containing signs of intelligence:
>There was a nine minute delay between your two postings.
>
>Were you wondering whether there could be perl 5.7 with the use of
>$EURO_SIGN that now appears on some keyboards, which would be nice
>as its on the same key as $.
>
>by the way, what is the shift and backquote thingy (¬) supposed to
>be anyway. I have read that it is 'not' , something that I have
>never come across before.
>
I suspect you're using a british keyboard layout (I haven't seen that
character on any other keyboard I've seen [us, german, swiss])
As a matter of fact, the REXX language uses ¬ as a synonim for \
Both are the NOT operator.
There's also ¬= and \= as NOT EQUAL (-: .NE. in Fortran :-)
The british kb layout is a pain i.t.a. (especially under OS/2, which
can't make up its mind about the true '|' pipe/OR symbol: is it AltGr-
backquote or shift-backslash) But it has the advantage of not having to
press the shift key to get a # :-)
--
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
Life is complex, with real and imaginary parts.
------------------------------
Date: Tue, 06 Jun 2000 14:05:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: the end of perl?
Message-Id: <393f041b.6786258@news.skynet.be>
W Kemp wrote:
>Were you wondering whether there could be perl 5.7 with the use of
>$EURO_SIGN that now appears on some keyboards, which would be nice as its on
>the same key as $.
Nope. Perl special variable names are limited to ASCII (character code
under 128). The Euro symbol has a character code in the 128-255 range,
and so it isn't portable between platforms (eliminating EBCDIC from the
discussion). Therefore it is not acceptable.
A special case is the $^(letter) syntax, which isn't abslutely clear to
me, but I think it represents control characters. I think there are
still a few unused places left.
--
Bart.
------------------------------
Date: Tue, 6 Jun 2000 18:46:08 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: the end of perl?
Message-Id: <Pine.GHP.4.21.0006061840340.21711-100000@hpplus03.cern.ch>
On Tue, 6 Jun 2000, Bart Lateur wrote:
> The Euro symbol has a character code in the 128-255 range,
That's a very misleading claim, I'm afraid. It has no character code
at all in the iso-8859-1 code, whereas its character code in Unicode
is 0x20AC (decimal 8364). Etc.
> A special case is the $^(letter) syntax, which isn't abslutely clear to
> me, but I think it represents control characters. I think there are
> still a few unused places left.
Unicode still has room (more than "a few").
You weren't by some mischance referring to some non-portable
vendor-defined 8-bit coding, were you? ;-}
cheers
------------------------------
Date: Tue, 06 Jun 2000 17:34:59 GMT
From: crrjohnson@my-deja.com
Subject: URI encoded parameter for CGI.pm problem.
Message-Id: <8hjco2$ad3$1@nnrp1.deja.com>
Hi,
I am having a problem with CGI.pm not returning a parameter passed in
the URI.
I am using the following SSI directive to call the script to fill in
data from a DBM file:
<!--include virtual="../cgi/staffdb.cgi?stafftag=p%5C%26d" -->
\ &
The required record has an ampersand that needs to be found. The DBM
file is something that was originally generated using PHP2 and we are
moving the site to SSI and Perl CGIs to make the site maintainer's life
a little easier as she has little programming experience.
The backslash was an attempt to escape the following ampersand code to
see if that was the problem.
The problem, however, is that CGI.pm is not returning the stafftag
parameter in this situation, but every other call on the page (no
annoying characters) works beautifully and the script pulls the required
data.
I am tempted to just have them change the tag for that position and any
others with characters that pose a problem. This wouldn't abate my own
curiosity though :-)
As you can see, I have spent time searching Deja.com for info on this,
and I have done other searches to no avail.
Thanks in advance,
Colin Johnson
--
Remember, everything you see on screen is but ones and zeroes.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 6 Jun 2000 13:33:21 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: using 'exists' in a program to test for keys in a hash
Message-Id: <8hiuj1$r8s$1@lublin.zrz.tu-berlin.de>
Ala Qumsieh <aqumsieh@hyperchip.com> wrote in comp.lang.perl.misc:
[...]
>This effectively says that the way you access %hash is governed by
>functions defined in SDBM_File.pm. Specifically, in your case, if you
>try to use exists() on a hash entry, Perl will go and find the EXISTS
>method in SDBM_File and execute it, instead of executing the built-in
>exists() function. Apparently, this method is missing for some reason.
...the reason being that the underlying database mechanism doesn't
support entries of just a key with no value. This is true for all of
the databases supported by perl. The closest you get is a key with an
empty string for a value, so there is no difference between exists()
and defined(). Implementors have variously decided to provide exists()
as an alias for defined() or not.
Anno
------------------------------
Date: Tue, 06 Jun 2000 14:19:23 GMT
From: aqumsieh@hyperchip.com (Ala Qumsieh)
Subject: Re: using 'exists' in a program to test for keys in a hash
Message-Id: <8F4B66A9Daqumsiehhyperchipcom@198.235.216.4>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in
<8hiuj1$r8s$1@lublin.zrz.tu-berlin.de>:
>Ala Qumsieh <aqumsieh@hyperchip.com> wrote in comp.lang.perl.misc:
>
>[...]
>
>>This effectively says that the way you access %hash is governed by
>>functions defined in SDBM_File.pm. Specifically, in your case, if
>>you try to use exists() on a hash entry, Perl will go and find the
>>EXISTS method in SDBM_File and execute it, instead of executing the
>>built-in exists() function. Apparently, this method is missing for
>>some reason.
>
>...the reason being that the underlying database mechanism doesn't
>support entries of just a key with no value. This is true for all
>of the databases supported by perl. The closest you get is a key
>with an empty string for a value, so there is no difference between
>exists() and defined(). Implementors have variously decided to
>provide exists() as an alias for defined() or not.
Ok. Fair enough. But, IMHO, not supplying a definition for exists() is
wrong, and can easily cause confusion, as we witnessed here. Perhaps
the author of this module can add an EXISTS subroutine that will issue
a warning saying something like:
"exists() not supported. Using defined() instead .."
AND properly document that. Very little extra effort that goes a long
way.
--Ala
------------------------------
Date: Tue, 06 Jun 2000 15:06:07 GMT
From: adrian2001@my-deja.com
Subject: Value of <HANDLE> construct can be "0" ???
Message-Id: <8hj410$gj8$1@nnrp2.deja.com>
Perl gurus,
I wrote a script that, when run with the -w option, gives this warning:
Value of <HANDLE> construct can be "0"; test with defined() at myscript.pl
line 65535
Problem is, the script does NOT have 65535 lines. And there is nothing called
HANDLE (i.e., I think this is a "generic" warning.) What is going on? The
script works fine, but the warning upsets me. Platform is: Sun - Solaris -
perl 5
Thanks for your word of wisdom!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 06 Jun 2000 15:50:52 GMT
From: aqumsieh@hyperchip.com (Ala Qumsieh)
Subject: Re: Value of <HANDLE> construct can be "0" ???
Message-Id: <8F4B7F2BDaqumsiehhyperchipcom@198.235.216.4>
adrian2001@my-deja.com wrote in <8hj410$gj8$1@nnrp2.deja.com>:
>Perl gurus,
>I wrote a script that, when run with the -w option, gives this
>warning:
>
>Value of <HANDLE> construct can be "0"; test with defined() at
>myscript.pl line 65535
>
>Problem is, the script does NOT have 65535 lines. And there is
>nothing called HANDLE (i.e., I think this is a "generic" warning.)
>What is going on? The script works fine, but the warning upsets me.
>Platform is: Sun - Solaris - perl 5
Upgrade to the latest version of Perl and the warning should disappear.
The reason is that you are probably doing something like:
while ($line = <FH>) {
....
}
In the unlikely case that $line contains the number 0, the while loop
will terminate. This *might* actually happen if you set $/ to 0 and
your file contains consecutive 0's.
If you don't want to upgrade, then you have to change all above lines
to:
while (defined($line = <FH>)) {
...
}
--Ala
------------------------------
Date: 6 Jun 2000 16:37:49 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Value of <HANDLE> construct can be "0" ???
Message-Id: <8hj9cs$32k52$2@fu-berlin.de>
hi,
adrian2001@my-deja.com wrote:
> I wrote a script that, when run with the -w option, gives this warning:
> Value of <HANDLE> construct can be "0"; test with defined() at myscript.pl
> line 65535
> Problem is, the script does NOT have 65535 lines. And there is nothing called
> HANDLE (i.e., I think this is a "generic" warning.) What is going on? The
> script works fine, but the warning upsets me. Platform is: Sun - Solaris -
> perl 5
i've heard that the line number thing is a bug. but
the <HANDLE> means, that there is a line in your script
where you use a filehandle. could you
post that line?
if you are processing lines you should rather do
while (<FILE>) {}
than
while ($line = <FILE>) {}
because <FILE> can be undef. (that's what perl tried
you to say)
(or you can test if it is defined but that's not necessary
with the newer versions of perl)
tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Tue, 06 Jun 2000 15:16:35 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: Why won't this interpolate please?
Message-Id: <8hj4k3$3mc$1@nnrp1.deja.com>
My code:
print "client is $main::client\n\n";
use lib qq(../$main::client);
foreach (@INC) {print "$_ \n"}
produces:
client is fish
../
Where did the fish go?
I'm having to resort to
push @INC,"../$main::client";
which isn't as effective as a lib for checking presence.
Thanks in advance,
WQ
push @INC,"../$main::client";
--
Time is nature's way of preventing everything from happening at once.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 06 Jun 2000 15:58:56 GMT
From: aqumsieh@hyperchip.com (Ala Qumsieh)
Subject: Re: Why won't this interpolate please?
Message-Id: <8F4B7DB0Baqumsiehhyperchipcom@198.235.216.4>
webqueen@my-deja.com (webqueen, queen of the web) wrote in
<8hj4k3$3mc$1@nnrp1.deja.com>:
>My code:
>
> print "client is $main::client\n\n";
> use lib qq(../$main::client);
> foreach (@INC) {print "$_ \n"}
>
>produces:
>
> client is fish
>
>
> ../
>
>Where did the fish go?
The 'use lib ...' command is seen at compile-time, i.e before your
script starts to run. You seem to set $main::client at run-time, which
is too late. Try this:
BEGIN {
$main::client = 'fish';
use lib qq(../$main::client);
}
--Ala
------------------------------
Date: 06 Jun 2000 17:54:16 +0100
From: nobull@mail.com
Subject: Re: Why won't this interpolate please?
Message-Id: <u9pupupx6v.fsf@wcl-l.bham.ac.uk>
webqueen, queen of the web <webqueen@my-deja.com> writes:
> My code:
>
> print "client is $main::client\n\n";
> use lib qq(../$main::client);
> foreach (@INC) {print "$_ \n"}
>
> produces:
>
> client is fish
>
>
> ../
>
> Where did the fish go?
It did not travel backwards in time. use is a compiler directive.
Perl can sometimes be confusing to people comming from other languages
because you can use the same variables at compile time and at run-time.
> I'm having to resort to
>
> push @INC,"../$main::client";
>
>
> which isn't as effective as a lib for checking presence.
require lib;
import lib "../$main::client";
Of course there's limited utility in manipulating @INC after compliation.
> --
> Time is nature's way of preventing everything from happening at once.
This was really a clue to your problem.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3266
**************************************