[20008] in Perl-Users-Digest
Perl-Users Digest, Issue: 2203 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 26 00:05:33 2001
Date: Sun, 25 Nov 2001 21:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006751106-v10-i2203@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 25 Nov 2001 Volume: 10 Number: 2203
Today's topics:
Re: A Perl Bug? <jake@chaogic.com>
Re: A Perl Bug? <mgjv@tradingpost.com.au>
Re: Creating a Perl app. Help with installation? <mcnuttj@dnps-linux1.telecom.missouri.edu>
Re: Declaring a filehandle <godzilla@stomp.stomp.tokyo>
Re: Declaring a filehandle <godzilla@stomp.stomp.tokyo>
Re: Declaring a filehandle <dan@tuatha.sidhe.org>
Re: Declaring a filehandle <mgjv@tradingpost.com.au>
Re: modify arguments in a sub / function... <ahamm@programmer.net>
Re: pack (venus)
Re: pack <wuerz@yahoo.com>
Re: pack <ahamm@programmer.net>
Re: question for array operation <mgjv@tradingpost.com.au>
Re: replacing certain 'bad' words globally <mgjv@tradingpost.com.au>
Serious Regexp help... <ashley@pcraft.com>
Re: spurious warning with special var LOG in 5.6.1 <jeffp@crusoe.net>
Re: spurious warning with special var LOG in 5.6.1 <mgjv@tradingpost.com.au>
String matching... irc hostmasks <mercutio@digitalrice.com>
Re: TESTING CGI SCRIPTS WITH ACTIVE PERL <michealo@ozemail.com.au>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 25 Nov 2001 17:52:47 -0600
From: "Jake Fan" <jake@chaogic.com>
Subject: Re: A Perl Bug?
Message-Id: <9ts097$9bi$1@Masala.CC.UH.EDU>
E.Chang <echang@netstorm.net> wrote in message
news:Xns916491A462EBAechangnetstormnet@207.106.93.86...
> "Jake Fan" <jake@chaogic.com> wrote in
> news:9trc3k$8gv$1@Masala.CC.UH.EDU:
>
> > sense, but in this assignment case, it'd be more consistent and
> > intuitive not to autovivify LHS. Your code example could be
> > re-written so that it's a bit more illustrative:
>
> Whose code example? Uri's? Mine? (Of course not mine; I didn't post
> one - but it sounds that way since I'm the one reading this article.)
> It is impossible to tell who/what you are referring to.
>
> [rest of confusingly top-posted srticle snipped.]
>
How about Bart's [code example], whom I directly replied to? Does it even
matter? I'd imagine "your" life could be quite confusing indeed, since
whenever "you" hear or see the word "your" or "you", "you" would start
wondering if people are talking about "you". Oh, do "you" need me to
further clarify whom/what all those your's and you's refer to?
The parent post is a textbook example of flamebait, which I bit nonetheless,
just for the fun of it. Call it lazy-Sunday-afternoon entertainment if you
will.
As an attempt not to degenerate this thread further into another flame war,
check out this link for more reply, a.k.a. yet another opinion on the Usenet
posting style. Please ignore this link if you are looking for Perl related
stuff.
http://paradise.svec.uh.edu/Usenet_Posting_Style.html
------------------------------
Date: Mon, 26 Nov 2001 03:40:01 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: A Perl Bug?
Message-Id: <slrna03ecq.enm.mgjv@verbruggen.comdyn.com.au>
On Sun, 25 Nov 2001 11:57:39 GMT,
Bart Lateur <bart.lateur@pandora.be> wrote:
> Mark wrote:
>
>>> $x[0] ||= undef;
>
>>Or would this still autovivify a "defined" for $x[0], but just undef its
>>content?
>
> undef() is not defined. There's no way your program is supposed to know
> the difference between an autovivifies element, or one which got
> undeffed.
> But somehow, Data::Dumper knows, and reports it. See:
From Perl, you can't tell the difference. If you do things at the XS
level, (where for example DumpXS does its work) there is a slight
difference between unitialised autovivified elements, and once that
have been initialised to undef specifically. Whether Data::Dumper's
exposure of this difference is a bug is debatable, I guess.
There was a smallish thread not that long ago about this. One of the
messages in this thread is
Message-ID: <slrn9uua05.2q5.mgjv@verbruggen.comdyn.com.au>
Martien
--
|
Martien Verbruggen | In a world without fences, who needs
Trading Post Australia Pty Ltd | Gates?
|
------------------------------
Date: 26 Nov 2001 02:07:37 GMT
From: <mcnuttj@dnps-linux1.telecom.missouri.edu>
Subject: Re: Creating a Perl app. Help with installation?
Message-Id: <9ts859$g35$1@dipsy.missouri.edu>
mcnuttj@dnps-linux1.telecom.missouri.edu wrote:
> 3) MIBs. This is the hard one. Right not I include a *bunch* of MIB
> files and store them in /usr/local/lib/jscan/mibs (with a bunch of
> subdirs). Again, right now this is hard-coded in there, but I'd like to
> somehow make this relative to PREFIX from the Makefile (perhaps
> $(PREFIX)/JScan/mibs). What's the best way to accomplish this?
Okay, I've taken everybody's advice and set up MakeMaker (mostly). I
still have a few problems to solve, though, the most important being this
one. What do I do with the MIB files?
My first thought is that the modules are installed in $(PREFIX)/perl5/
site_perl/JScan (thus, 'use JScan::JVars;' works). The easiest thing to
do seemed to be to add a subdirectory under JScan named 'mibs' to hold
them all. Since I was using /usr/local/lib/jscan/mibs before, this
isn't much of a stretch. I just moved the source 'mibs' dir to lib/JScan
in the source tree and added the files to the MANIFEST. No problem,
right?
Well, sort of. Now I have to teach the application where to find the
files. I have two thoughts on the matter, and they aren't mutually
exclusive.
1) Determine at runtime where the modules are like this:
MIBPATH: foreach $path ( @INC ) {
# Stat a module that we've already "use"d.
stat "$path/JScan/JVars.pm";
if ( -e _ ) {
# This is where the modules are.
$mibpath = $path . "/JScan/mibs";
# Stat this dir to make sure it's really there.
last MIBPATH;
}
}
if ( not $mibpath ) {
print "Couldn't find the MIBs. Help!\n";
# I have a custom 'exit' routine.
}
Then later, when I go to load a MIB, I can do:
&SNMP::addMibDirs("$mibpath/APC");
&SNMP::addMibFiles("$mibpath/APC/powernet.mib");
As you can see, I need the path to the MIBs for this to be successful.
2) Okay, the second idea is to have a config file option, environment
variable, and/or a command-line option that points at the mibdir's
location. An offshoot of this would be that the config file could be
written or at *least* a blurb could be printed to the screen at
install-time to help the user set this variable.
Yet another option would be to combine the two approaches, when the
script looks in the 'default' location (with the modules) only if
none of the the other methods are specified. I.e. "in the same place
as the other JScan modules" is the default, which is overridden by
the config file/variable/cmdline option.
Thoughts? Suggestions? I'm pretty sure I could make one of these
approaches work, but I'm wondering if there isn't a more elegant way
to do this.
--J
Coming Up: How do I *optionally* install 'xjscan' when 'make install'
is invoked, but only if the Tk.pm module is detected, and print a
warning message if it is not?
------------------------------
Date: Sun, 25 Nov 2001 15:24:42 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Declaring a filehandle
Message-Id: <3C017DBA.37E72AAD@stomp.stomp.tokyo>
Steffen Müller wrote:
> p.tomkins wrote:
> | I know that we can declare a scoped scalar, array or hash as
> | my ($scalar, @array, %hash)
> | but how do we declare a filehandle?
> {
> open( my $fh, "my_pants") or die "Could not open my pants! $!";
> my $var = <$fh>; # reads the next line. (je nach $/)
> }
> my $var = <$fh>; # error, out of scope!
This is a poor programming practice and
provides no benefit.
My suggestion is you unzip your pants
and take a look at what you are doing.
Godzilla!
--
CONTENTS OF TEST.TXT:
_____________________
one
two
three
four
TEST SCRIPT:
____________
#!perl
open( my $fh, "test.txt") or die "Could not open my pants! $!";
while (<$fh>)
{
my $var = <$fh>;
print "1: $var";
&Be_Forgetful_Of_Variable_Name;
print "2: $_";
$var = <$fh>;
print "3: $var";
}
close ($fh);
sub Be_Forgetful_Of_Variable_Name
{ $fh++; }
exit;
PRINTED RESULTS:
________________
1: two
2: one
3:
------------------------------
Date: Sun, 25 Nov 2001 15:56:34 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Declaring a filehandle
Message-Id: <3C018532.1377B05B@stomp.stomp.tokyo>
Godzilla! wrote:
> Steffen Müller wrote:
> > p.tomkins wrote:
> > | I know that we can declare a scoped scalar, array or hash as
> > | my ($scalar, @array, %hash)
> > | but how do we declare a filehandle?
> > {
> > open( my $fh, "my_pants") or die "Could not open my pants! $!";
> > my $var = <$fh>; # reads the next line. (je nach $/)
> > }
> > my $var = <$fh>; # error, out of scope!
> This is a poor programming practice and
> provides no benefit.
> My suggestion is you unzip your pants
> and take a look at what you are doing.
(snipped first code example exemplifying his lack of Perl skills)
Just when you think it is safe to come crawling out of
your Taliban Cleric Code Cop cave chanting twisted Koran
inspired lame excuses for your last blunder...
Godzilla!
--
TEST SCRIPT:
____________
#!perl
open( my $fh, "test.txt") or die "Could not open my pants! $!";
while (<$fh>)
{ &Be_Forgetful_Of_Variable_Name; }
if (!(close ($fh)))
{ print "You Are A Blithering Idiot."; }
sub Be_Forgetful_Of_Variable_Name
{ $fh++; }
exit;
PRINTED RESULTS:
________________
You Are A Blithering Idiot.
------------------------------
Date: Mon, 26 Nov 2001 00:37:56 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Declaring a filehandle
Message-Id: <E9gM7.68013$Y6.7436645@news1.rdc1.ct.home.com>
"Steffen M=FCller" <5l259r001@sneakemail.com> wrote:
> "news.bmthonline.net" <p.tomkins@virgin.net> schrieb im Newsbeitrag
> news:3c016b77$1_1@news2.vip.uk.com...
> | Hi,
> |
> | I know that we can declare a scoped scalar, array or hash as
> | my ($scalar, @array, %hash)
> |
> | but how do we declare a filehandle?
> {
> open( my $fh, "my_pants") or die "Could not open my pants! $!";
> my $var =3D <$fh>; # reads the next line. (je nach $/)
> }
This trick only works with recent versions of perl. 5.6.1 certainly, and I
think 5.6.0, but I'd check perldelta before counting on it. Certainly
doesn't work well with 5.004_0x or 5.005_0x.
Dan
------------------------------
Date: Mon, 26 Nov 2001 02:19:37 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Declaring a filehandle
Message-Id: <slrna039m1.enm.mgjv@verbruggen.comdyn.com.au>
On Sun, 25 Nov 2001 15:24:42 -0800,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Steffen Müller wrote:
>
>> p.tomkins wrote:
>
>> | I know that we can declare a scoped scalar, array or hash as
>> | my ($scalar, @array, %hash)
>
>> | but how do we declare a filehandle?
>
>> {
>> open( my $fh, "my_pants") or die "Could not open my pants! $!";
>> my $var = <$fh>; # reads the next line. (je nach $/)
>> }
>
>> my $var = <$fh>; # error, out of scope!
>
>
> This is a poor programming practice and
> provides no benefit.
Nonsense.
Martien
--
Do not pay any attention to what Godzilla says. It is a troll, and
has no decent working knowledge of Perl or programming in general.
Search groups.google.com to see a history of its posts and replies
to these posts.
------------------------------
Date: Mon, 26 Nov 2001 12:13:03 +1100
From: "Andrew Hamm" <ahamm@programmer.net>
Subject: Re: modify arguments in a sub / function...
Message-Id: <3c019719$1_1@news.iprimus.com.au>
Martien Verbruggen wrote in message ...
>
>Do not pay any attention to what Godzilla says. It is a troll, and has
>no decent working knowledge of Perl or programming in general. Search
>groups.google.com to see a history of its posts and replies to these posts.
>
It certainly is entertaining. Haven't had such consistent laughs from an ng
for quite a while
package Godzilla;
use Alcohol qw(copiously delerium-tremens pink-elephants);
use Drugs qw(copiously hallucinogens amphetamines);
use Psychosis qw(paranoia megalomania schizophrenia bipolar-disorder);
use Coding::Quality qw(schoolboy nonportable obscure untested
plain-old-bizarre);
use Lingua::EN::WordMeanings qw(random redefining idiolect);
no Manpages;
use Bot::Eliza;
What's really freaky is, there's some good ideas in about 5% of the
postings but then there's all the madness thrown in for laughs. Perhaps
(s)he's practicing for the Edinburgh Comedy Festival?
I say bring it on. It's certainly entertaining.
--
Space Corps Directive #723
Terraformers are expressly forbidden from recreating Swindon.
-- Red Dwarf
------------------------------
Date: 25 Nov 2001 17:56:20 -0800
From: train2venus@hotmail.com (venus)
Subject: Re: pack
Message-Id: <bce84cea.0111251756.32d261ef@posting.google.com>
If you answered me just to ask me to refer to perldoc..I did that
before I posted the question. And after reading it and being a newbie
in programming,
I still dont seem to understand the concept quite well...
Anyway, Mona thanks a lot for being helpful
Mona Wuerz <wuerz@yahoo.com> wrote in message news:<m3vgfz9ikj.fsf@DCCMBX01.njitdm.campus.njit.edu>...
> train2venus@hotmail.com (venus) writes:
>
> > 1) How do I pack a number that consists of three digits? e.g. 843
> > Is this command able to do it? --> $buffer = pack('S',$VALUE);
> > where $VALUE is equal to 843...
>
> How about trying it out?
>
> > 2) Can I pack numbers which contain floating points...e.g. 34.5 or 23.5
> > If yes, which template should I use in place of 'S'?
>
> How about reading the documentation for pack? (A good habit to develop
> if you're into that instant response kind of thing, btw.)
>
> perldoc -f pack
> ...
> f A single-precision float in the native format.
> ...
------------------------------
Date: 25 Nov 2001 21:51:11 -0500
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: pack
Message-Id: <m31yims0rk.fsf@DCCMBX01.njitdm.campus.njit.edu>
[ please don't top-post if you want to be taken seriously.
reply rearranged. ]
train2venus@hotmail.com (venus) writes:
> Mona Wuerz <wuerz@yahoo.com> wrote in message news:<m3vgfz9ikj.fsf@DCCMBX01.njitdm.campus.njit.edu>...
> > train2venus@hotmail.com (venus) writes:
> >
> > > 1) How do I pack a number that consists of three digits? e.g. 843
> > > Is this command able to do it? --> $buffer = pack('S',$VALUE);
> > > where $VALUE is equal to 843...
> >
> > How about trying it out?
> >
> > > 2) Can I pack numbers which contain floating points...e.g. 34.5 or 23.5
> > > If yes, which template should I use in place of 'S'?
> >
> > How about reading the documentation for pack? (A good habit to develop
> > if you're into that instant response kind of thing, btw.)
> >
> > perldoc -f pack
> > ...
> > f A single-precision float in the native format.
> > ...
> If you answered me just to ask me to refer to perldoc..I did that
> before I posted the question. And after reading it and being a newbie
> in programming,
> I still dont seem to understand the concept quite well...
You gave no indication that you actually had checked the
documentation. You should have said as much -- since both your
questions are actually answered in the doc; and you could have said
why (or how) doing so didn't help you.
Re your first question -- the best way of answering (quickly) it *is*
trying it out. Maybe you did (again, you didn't say so), and didn't
understand the result. Fair enough, but if you leave people guessing,
don't expect answers that are to the point.
Maybe checking the result of the pack function call by reversing it
with unpack would shed light on the issue. Maybe not, you didn't say
what exactly you're unclear about.
> Anyway, Mona thanks a lot for being helpful
Always glad to help.
--
$_="\n,rekcah egnufeB rehtona tsuJ";#v1<?>g\:pv-<5<
s s\S+(?:B)sunpack'u',q q$;')E4qsee;#>60#^<(v!<)g6<
print scalar reverse,$@ unless m,[+;#]55,;m:_,:#^1<
------------------------------
Date: Mon, 26 Nov 2001 14:26:59 +1100
From: "Andrew Hamm" <ahamm@programmer.net>
Subject: Re: pack
Message-Id: <3c01b67f$1_1@news.iprimus.com.au>
venus wrote in message ...
>If you answered me just to ask me to refer to perldoc..I did that
>before I posted the question. And after reading it and being a newbie
>in programming,
>I still dont seem to understand the concept quite well...
>
>Anyway, Mona thanks a lot for being helpful
>
I try to ward off such replies by slipping in "I've read blah blah blah but
....." Shame on me 'cos occasionally it's not 100% truthful...
But since you did read pack but didn't quite get it, here's the drill.
Pack basically takes a string representation of data and converts it to raw
bits 'n' bytes. And nibbles, and words, and half-words, and floating point
and .....
The first parameter to pack is a string instructing it how to "read" the
remaining arguments.
going back to your questions:
>1) How do I pack a number that consists of three digits? e.g. 843
>Is this command able to do it? --> $buffer = pack('S',$VALUE);
>where $VALUE is equal to 843...
the number of digits really isn't important, but 3 decimal digits requires
at least 9 bits. Since that's a "non-standard" bit width (R.I.P PL/1) you
need to pack into a 16 bit integer which is also a pair of bytes. Therefore
S is the beast and you'll end up with $buffer being a 2 byte string ie
length($buffer) == 2
>2) Can I pack numbers which contain floating points...e.g. 34.5 or 23.5
>If yes, which template should I use in place of 'S'?
>
'd' or 'f' are the formats for numbers.
Note that the S conversion is machine dependent. If you attempt to send
binary data (ie in a binary file or down a network socket) to another type
of machine, then it's quite likely that the bytes might be "in the wrong
order" for the target machine. Pentium and HP-UX can't directly interchange
for example, and Sun boxes can't interchange with Pentium either.
Hence the existence of the 'n' and 'N' formats. The "network" order means an
agreed standard for transmitting multi-byte numbers across the network.
Pack does not support a "network format" for floating point numbers, so that
can get uglier if you want to transfer between different types of machines.
--
Space Corps Directive #723
Terraformers are expressly forbidden from recreating Swindon.
-- Red Dwarf
------------------------------
Date: Mon, 26 Nov 2001 04:00:50 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: question for array operation
Message-Id: <slrna03fjq.enm.mgjv@verbruggen.comdyn.com.au>
On Sat, 24 Nov 2001 15:39:43 GMT,
Mark Jason Dominus <mjd@plover.com> wrote:
> In article <9to18j$k9a$1@eng-ser1.erg.cuhk.edu.hk>,
> Kit <hkyeung9@ie.cuhk.edu.hk> wrote:
>>Dears,
>> I want to ask if i can delete a element in a array?
>>eg.@abc=(cat,dog,chicken). Can i use any function to delete "dog" so that
>>@abc=(cat,chicken)?
>>Thanks.
>
> You want to use 'splice'.
>
> As you pointed out, 'delete' is only for hashes.
Not entirely. delete() can be used for arrays, but it won't do what
the OP wanted.
Now, if you had said "delete should only be used for hashes", I would
have agreed without comment.
Martien
--
|
Martien Verbruggen | 42.6% of statistics is made up on the
Trading Post Australia Pty Ltd | spot.
|
------------------------------
Date: Mon, 26 Nov 2001 02:17:46 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: replacing certain 'bad' words globally
Message-Id: <slrna039ih.enm.mgjv@verbruggen.comdyn.com.au>
On Sat, 24 Nov 2001 19:38:50 -0800,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Godzilla! wrote:
[snip of usual Godzilla drivel]
> #!perl
no -w. no strict. Very bad example code indeed.
> $display_file = "your/path/to/html/file";
>
> undef ($/);
>
> open (HTML, $display_file);
No check for success. bad.
> $html = <HTML>;
> close (HTML);
>
> $/ = "\n";
Have you ever heard of local()? And why do you even bother setting $/
to "\n"? You're not using it anywhere after this line, implicitly or
explicitly.
> for (@Array)
> {
> ($key, $value) = split (/:/, $_);
> if ($html =~ /$key/)
> { $html =~ s/$key/$value/gi; }
> }
>
> print $html;
>
>
> @Array = ("but : butt ",
@Array is initialised after it is used. This won't work. The code in
the loop will never be executed.
You're using an array where you should be using a hash.
You're using two regular expression matches where one would suffice.
For one you require the case to match, and for the other you allow it
to match case insensitively. Inconsistent.
You don't check for word boundaries, which may make the match succeed
in places where it is definitely not wanted.
You, once more, succeeded in producing a most inefficient piece of
manure. That is, it would be inefficient if it even attempted to work.
Oh, and your code indentation sucks too.
Martien
--
Do not pay any attention to what Godzilla says. It is a troll, and
has no decent working knowledge of Perl or programming in general.
Search groups.google.com to see a history of its posts and replies
to these posts.
------------------------------
Date: Sun, 25 Nov 2001 21:50:07 -0700
From: "Ashley M. Kirchner" <ashley@pcraft.com>
Subject: Serious Regexp help...
Message-Id: <3C01C9FF.7152F9E2@pcraft.com>
I need to break each line in this text (wrapping alert):
4x6 1 4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 1 .75 $0.75
4x6 1 4"x6" Standard Print (full-frame from 35mm) Image:Uploaded Image 2 .75 $0.75
5x7.5 1 5x7.5 Image:Uploaded Image 3 4.25 $4.25
8x12 1 8x12 Classic Full Frame Image:Uploaded Image 4 10.25 $10.25
...into 6 pieces. Based on the first line, I need:
1. 4x6
2. 1
3. 4"x6"
4. Standard Print (full-frame from 35mm) Image:Uploaded Image 1
5. .75
6. $0.75
And as you can see, the 3rd item is written differently on two of those lines - I need to account for that. Also, the first item could also be simple text (letters) instead of just numbers (and an 'x').
Anyone?
--
H | "Life is the art of drawing without an eraser." - John Gardner
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:ashley@pcraft.com> . 303.442.6410 x130
Director of Internet Operations / SysAdmin . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave, #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
------------------------------
Date: Sun, 25 Nov 2001 20:06:14 -0500
From: Jeff 'japhy' Pinyan <jeffp@crusoe.net>
Subject: Re: spurious warning with special var LOG in 5.6.1
Message-Id: <Pine.GSO.4.21.0111252004580.23999-100000@crusoe.crusoe.net>
On Nov 25, John said:
>BEGIN {
> use CGI::Carp qw(carp carpout fatalsToBrowser confess cluck);
> open(LOG, ">>./error_log") or die("Unable to open error_log: $!\n");
> carpout(LOG);
>}
You should use \*LOG instead of LOG when you call carpout(). This is in
the documentation for CGI::Carp. Perl can't tell you mean the filehandle
"LOG", so it sees a bareword, LOG, and ends up fudging it as a filehandle.
And Godzilla is not to be trusted.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
------------------------------
Date: Mon, 26 Nov 2001 02:23:28 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: spurious warning with special var LOG in 5.6.1
Message-Id: <slrna039t8.enm.mgjv@verbruggen.comdyn.com.au>
On Sun, 25 Nov 2001 11:23:15 -0800,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> John wrote:
>
>
>> Just installed 5.6.1 on linux 2.4.2 (RH7.1), and now
>
>> open(LOG,...) produces a "main::LOG used only once" warning
>> that 5.0005_3 (and, I think, 5.6.0) never did.
>> 'man perldelta' indicates that this is a bug that has been fixed... ?
>
>
> This is untrue. Perl 5.6.0 and some older versions will
> generate this warning as well, using your example code.
Indeed.
> This is not a bug. It is an error in your code.
Maybe.
>> The code that produces the warning is as follows:
>
>> BEGIN {
>> use CGI::Carp qw(carp carpout fatalsToBrowser confess cluck);
>> open(LOG, ">>./error_log") or die("Unable to open error_log: $!\n");
>> carpout(LOG);
>> }
>
>> The error message is:
>> [Sun Nov 25 10:34:48 2001] ascript.cgi:
>> Name "main::LOG" used only once: possible typo at
>> [..]myscript.cgi line 3.
>
>
> You have neglected to close your filehandle.
Nonsense.
>> The fix/workaround appears to be to add this:
>> our $LOG;
The variable $LOG and the file handle LOG are unrelated. I suspect
that the problem is that you think they are the same thing.
>> before the open() -- note: 'my' still produces the warning.
>
>
> Your fix is to close your filehandle as it should be.
Nonsense.
>> Am I missing something?
>
> Yes. You are missing a close (FILEHANDLE); in your code.
Nonsense.
Martien
--
|
Martien Verbruggen | True seekers can always find
Trading Post Australia Pty Ltd | something to believe in.
|
------------------------------
Date: Mon, 26 Nov 2001 00:01:09 -0000
From: "Mercutio" <mercutio@digitalrice.com>
Subject: String matching... irc hostmasks
Message-Id: <9ts137$3tn$1@newsg2.svr.pol.co.uk>
Hi there,
I'm writing a bot for IRC in perl, and having a good time at the moment,
everything seems to be working ok, but there are a couple of things I'm not
sure how to do, and this problem has me almost completely stumped....
I'm looking for a snippet of code that will match a host address to a host
mask.
For example...
$address = "Nickname!~name@nice.address.org";
$hostmask = "*!*name*@*.address.org";
I have written a basic routine to seperate the sections, and look at them
one at time, but I wonder if anyone knows of a way to turn the hostmask
into some kind of regex ?
Cheers,
Tony
------------------------------
Date: Mon, 26 Nov 2001 15:46:34 +1100
From: "nathan" <michealo@ozemail.com.au>
Subject: Re: TESTING CGI SCRIPTS WITH ACTIVE PERL
Message-Id: <XJjM7.35175$li3.236163@ozemail.com.au>
which server are you testing it with. most have there own cgi-bin but you
have to enable it.
if you are just testing a basic script you dont need a server just open up
dos prompt then ponit it to where perl.exe folowed by the location of your
script.
cb <spamcop@spamcop.net> wrote in message
news:nI0M7.1$407.174@typhoon.nyu.edu...
> I haven't used Active Perl in a while and completely forgot on how to use
> it. If I want to write CGI script and test it with a server in what
> directory do I put my html and pl files and what else do I have to do to
> test it?
> thanx guys
> --
> tosspam@aol.com abuse@aol.com abuse@yahoo.com abuse@hotmail.com
> abuse@msn.com abuse@sprint.com abuse@earthlink.com uce@ftc.gov
> spamcop@spamcop.net
>
>
------------------------------
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 2203
***************************************