[12903] in Perl-Users-Digest
Perl-Users Digest, Issue: 313 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 30 14:07:22 1999
Date: Fri, 30 Jul 1999 11:05:17 -0700 (PDT)
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, 30 Jul 1999 Volume: 9 Number: 313
Today's topics:
<<END_OF_TEXT function <paulreid@cableinet.co.uk>
Re: a regular expression to match both upper and lower (Larry Rosler)
communicating with my POP3 mailer on an Apache system <Warren@home.com>
displaying results a screen at a time. sharda@hotmail.com
Re: Easy way to emulate Unix's "sort" command? <d-edwards@uchicago.edu>
Re: Help pls..<how to use perl to get a file from the i <cassell@mail.cor.epa.gov>
Hey, that's pretty neat! (Sean McAfee)
Re: Hey, that's pretty neat! <tchrist@mox.perl.com>
Re: Hey, that's pretty neat! (Jack Applin)
Re: How do I access the array stored in a given memory <aqumsieh@matrox.com>
Re: How to determine a date in the past <emschwar@rmi.net>
How to stop a CGI execution ? <sapujo@dcc.ufmg.br>
Re: How to stop a CGI execution ? (Roger Espel Llima)
Re: Newbie alert !! <emschwar@rmi.net>
Re: NEWSFLASH: Supremes rule anti-advert-ware illegal <mikecard@my-deja.com>
Re: NEWSFLASH: Supremes rule anti-advert-ware illegal (Larry Rosler)
Obscure warnings behavior <jbc@shell2.la.best.com>
Re: parameter doesn't show up (Tad McClellan)
passing a list of hashes to a subroutine? (Weston Cann)
Re: passing a list of hashes to a subroutine? <tchrist@mox.perl.com>
Re: perl IP to OS mapping help (Malcolm Ray)
Perl Mongers presents: Travel to TPC (David H. Adler)
Re: Perl Mongers (Rich Morin)
Re: Perlshop Question acisconsulting@my-deja.com
single threaded server (Roger Espel Llima)
Re: Use of uninitialized value at ...... warning with h <aqumsieh@matrox.com>
Re: variation on /^=/ .. /^=cut/ (Jack Applin)
Re: Warrning with Variable <aqumsieh@matrox.com>
Re: Why is this regexp not working ? aschmied@earthlink.net
Re: Why is this regexp not working ? (Larry Rosler)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 30 Jul 1999 18:57:31 +0100
From: Paul Christopher Reid <paulreid@cableinet.co.uk>
Subject: <<END_OF_TEXT function
Message-Id: <37A1E78B.AA4F8BDA@cableinet.co.uk>
Howdy groupies,
I am teaching myself the principles of cgi/perl from books and
tutorials and I am working through a book by M&T books called
"Introduction to CGI/PERL".
I have tried to execute a script with the <<END_OF_TEXT function for the
first time without results. I keep getting internal server error and i
have checked and rechecked for typos. Is this special funtion called
from the cgi-lib.pl file ????
Help appreciated!
------------------------------
Date: Fri, 30 Jul 1999 10:42:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: a regular expression to match both upper and lower case
Message-Id: <MPG.120b83d91b8daaf3989d78@nntp.hpl.hp.com>
In article <37A1B6AD.8B80E158@mitre.org> on Fri, 30 Jul 1999 10:29:01 -
0400, Jason D. Rennie <jrennie@mitre.org> says...
> Keith Salomon wrote:
> >
> > $teststring =~ /^computer administration$/;
> >
> > I know this matches the case-sensitive exact match.
> >
> > I'd like a "regular expression" that matches either upper or
> > lower case letter.
>
> Try
>
> $teststring =~ m/computer administration/i;
>
> (note the 'i' at the end of the regex)
> Are you sure that you want the '^' and '$' at either end of the regex?
> These will cause your regex to match lines that contain ONLY "comPuTer
> AdmInIstraTion". Extra characters before or after computer
> administration will cause your regex to not match.
Except that a string with a trailing newline character *will* match!
From perlre:
$ Match the end of the line (or before newline at the end)
\z Match only at end of string
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 30 Jul 1999 16:34:31 GMT
From: "Alyne & Warren" <Warren@home.com>
Subject: communicating with my POP3 mailer on an Apache system
Message-Id: <ruko3.185$y94.501@news1.gvcl1.bc.home.com>
Hi! My ISP is using Apache and I want to make a really SIMPLE pop3 mail
filter to get rid of some of the spam before it hits my mailbox. I came
up with this much so far:
#!/usr/bin/perl
$|=1;
print "Content-type: text/html", "\n\n";
print "<HTML>\n";
$pop = new POP3Client("myactualID","MyPassword","MyDomainName");
for ($i = 1; $i <= $pop->Count; $i++) {
foreach ($pop->Head($i)) {
/^(From|Subject): / and print $_, "\n";
}
print "\n";
}
#===============================================#
print "<br><br><br>";
print " =========== DONE =========";
print "</body>";
print "</html>";
quit;
NOTES: I do have POP3Client in the same directory on this Apache system as
my mail filter program. Of course, I substitute my actual pop3 ID,
password, and domain name for the dummies inserted for public viewing. I
actually collect this by means of a form so that it doesn't sit in a file
for all to see. . .
Can anyone spot the errors I'm making? I hope so...
Thanks heaps!
--Warren
------------------------------
Date: Fri, 30 Jul 1999 16:04:56 GMT
From: sharda@hotmail.com
Subject: displaying results a screen at a time.
Message-Id: <7nsiev$kc6$1@nnrp1.deja.com>
Hi,
I have backend as Sybase. I am using sybperl(DBlib) to connect to
sybase from perl.
Whenever user executes a query(from the browser), the query is sent to
the sybase by perl and the results generated by sybase are sent back to
the browser.
Is there a way to display the result as x number of rows (for example
50 rows) at a time, so that when the user reads it all, he can get the
next 50 rows (by clicking "more" button, for example) and so on.
One way of doing this would be to keep track of the rowcount of the
last row of the result set and then next time display the result from
that row onwards. But is there any better way to solve this?
Thanx.
Raj
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 30 Jul 1999 16:46:29 GMT
From: Darrin Edwards <d-edwards@uchicago.edu>
Subject: Re: Easy way to emulate Unix's "sort" command?
Message-Id: <tgemhquluh.fsf@noise.bsd.uchicago.edu>
lr@hpl.hp.com (Larry Rosler) writes:
> In article <lfdqn7.eoq.ln@magna.metronet.com> on Thu, 29 Jul 1999
> 16:27:33 -0400, Tad McClellan <tadmc@metronet.com> says...
> > map { [ $_, uc((/\d+\s*(\S+)/ )[0] ] } @data;
> > ^^^^^^^^^^^^^^^^^^^^^^
>
> The first time I saw this buggy code today (in the response in this
> thread by Darrin Edwards), I chose to ignore it. But now you have
> rubbed our noses in it again, Tad, so I thought it was worth an
> observation here.
>
> Some of us sometimes boast to newcomers about the thousands of eye-hours
> that the solutions in the FAQ have received. Obviously this one hasn't.
I _thought_ there was a paren missing in there, but then I decided
not to mention it because I cut&pasted from:
PERLFAQ4(1) 28/May/98 (perl 5.004, patch 04) PERLFAQ4(1)
and I didn't want it to sound like a complaint about something that
had conceivably been fixed already (it's my fault for having such
old docs & bins after all).
If the paren is still missing in current versions then I do apologize
for not mentioning it; thanks in any case for pointing it out. ("But
you mean cut&paste isn't a universal rule either? Wah!!" "Shut up, brain,
or I'll poke you with a Q-tip.")
Darrin
------------------------------
Date: Fri, 30 Jul 1999 11:03:28 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Help pls..<how to use perl to get a file from the internet??>
Message-Id: <37A1E8F0.25A4A1F6@mail.cor.epa.gov>
HING wrote:
>
> HI HI.
> can i open a page from the internet??
> say open(FH,"http://XXX");
> if not what can i do to get file from XXX by using perl??
The internet is *not* a local filesystem. open() works on
files on your hard drive [or maybe over your network too].
URLs only look like ordinary files.
You might want to look into the LWP::Simple module, which
can do this for you in two lines.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 30 Jul 1999 16:19:32 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Hey, that's pretty neat!
Message-Id: <ogko3.3268$nB.483175@news.itd.umich.edu>
If you've been programming in Perl for a while, you've probably needed to
use a construction like this:
@translated = map { (my $tmp = $_) =~ tr/A-Z/a-z/; $tmp } @original;
I just stumbled across a much shorter way to express this kind of
operation, and I don't recall ever seeing it in any code I've read or
anywhere on clpm:
tr/A-Z/a-z/ foreach @translated = @original;
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: 30 Jul 1999 10:36:21 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Hey, that's pretty neat!
Message-Id: <37a1d485@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
mcafee@waits.facilities.med.umich.edu (Sean McAfee) writes:
:If you've been programming in Perl for a while, you've probably needed to
:use a construction like this:
:
:@translated = map { (my $tmp = $_) =~ tr/A-Z/a-z/; $tmp } @original;
God's teeth, man, no!
for (@translated = @original) { y/A-Z/a-z/ }
But that's "wrong" you know.
for (@translated = @original) { $_ = lc }
is better.
You could also simple use
@translated = map { lc } @original;
--tom
--
agoraphobia (n) - fear of implementing or of being trapped in open systems
------------------------------
Date: 30 Jul 1999 17:03:42 GMT
From: neutron@fc.hp.com (Jack Applin)
Subject: Re: Hey, that's pretty neat!
Message-Id: <7nslte$daf$2@fcnews.fc.hp.com>
Sean McAfee (mcafee@waits.facilities.med.umich.edu) wrote:
> If you've been programming in Perl for a while, you've probably needed to
> use a construction like this:
>
> @translated = map { (my $tmp = $_) =~ tr/A-Z/a-z/; $tmp } @original;
>
> I just stumbled across a much shorter way to express this kind of
> operation, and I don't recall ever seeing it in any code I've read or
> anywhere on clpm:
>
> tr/A-Z/a-z/ foreach @translated = @original;
Postfix for is indeed way cool. You can also do this case functionally:
@translated = map lc, @original;
This may be slightly different, if "use locale" is in force, but that may
be what you want.
-Jack Applin
neutron@fc.hp.com
Univ of Mich Engin class of '78
------------------------------
Date: Fri, 30 Jul 1999 12:04:30 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
To: Mac Xie <yxie@po-box.mcgill.ca>
Subject: Re: How do I access the array stored in a given memory location?
Message-Id: <x3yzp0ei0oj.fsf@tigre.matrox.com>
[posted and CCed]
Mac Xie <yxie@po-box.mcgill.ca> writes:
> Here is the code:
> ------------------------
>
> foreach $i (@temp)
> {
> undef @array;
> ....
> $hash{$i} = \@array;
> }
>
>
> I am using the same @array for different $i. However, information in
> @array is not appended.
>
> when I did "print %hash;" here is an example of what I get.
>
> 304-200-1ARRAY(0x2aaa08)304-487-1ARRAY(0x2aaa08)304-487-2ARRAY(0x2aaa08)304-211-1ARRAY(0x2aaa08)304-211-2ARRAY(0x2aaa08)
>
> I noticed that the memory addresses for each key are the same!
Yes. In my opinion, this is a very common and a very dangerous mistake
that is not properly addressed in the docs. I was bitten by this very
severely, and spent hours trying to figure it out. Let's examine it.
The last line inside the body of your foreach() loop is:
$hash{$i} = \@array;
which simply assigns a reference (think 'memory address') of @array to
$hash{$i}. If you modify @array, @{$hash{$i}} will change too since it
is a reference to the actual location of @array in memory.
Now, in each loop, you simply wipe out @array (and possibly repopulate
it later on), and then assign it's reference to a hash value. But the
memory location of @array is still the same, so all of your hash
values will be actually pointing to the same location in memory, and
thus will access the exact same data.
There are two solutions to your problem. The first one is to declare
your @array with my() inside the loop:
foreach $i (@temp) {
my @array;
....
$hash{$i} = \@array;
}
This will create a new @array in each iteration of the loop, with a
new memory location.
The other solution would be to change the following line:
$hash{$i} = \@array;
to
$hash{$i} = [@array];
which means "Assign to the value of $hash{$i} an anonymous copy of
@array". This is almost equivalent to:
my @temp_array = @array;
$hash{$i} = \@temp_array;
> And then I tried to obtain the contents in the hash by doing the
> following in another procedure:
> ---------------------
> foreach $j (keys %hash)
> {
> print "$j ";
> foreach $k(@ {$hash{$j}})
> {
> print "$k ";
> }
> print "\n";
> }
>
>
> I was able to obtain the values inside the array only if the hash
> contains one key and one scalar. However, if there are more than one set
> of values, then nothing will be displayed.
I can't really find what the problem is there because you don't tell
us what @array contains.
Try the fix I gave above, and let us know how it goes.
HTH,
Ala
------------------------------
Date: 30 Jul 1999 10:13:53 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: How to determine a date in the past
Message-Id: <xkfg126i08u.fsf@valdemar.col.hp.com>
e-lephant@b-igpond.com (elephant) writes:
> guaranteed that the author of Date::Manip would disagree .. as would most
> people .. you should read the Date::Manip documentation - particularly
> the section entitled "SHOULD I USE DATE::MANIP" .. because subtracting a
> known number of seconds from the current day falls well and truly in the
> 90% of the time when Date::Manip should be avoided
Um... where did I say *anything* about subtracting a known number of
seconds? The poster wanted to subtract a number of *days* (not seconds)
from a given date, which is exactly the sort of thing described in the
readme for Date::Manip.
I quote:
Among other things, Date::Manip allow you to:
...
5. Add a time offset to a date to get a second date (i.e. determine
the date 132 days ago or 2 years and 3 months after Jan 2, 1992)
Please try and pay more attention next time, eh.
-=Eric
------------------------------
Date: Fri, 30 Jul 1999 14:18:46 -0300
From: "Hilton Bruno de Almeida Sousa" <sapujo@dcc.ufmg.br>
Subject: How to stop a CGI execution ?
Message-Id: <7nsmeq$dpa$1@usenet.pop-mg.rnp.br>
Does the browser send any signal to a CGI when the user hits "stop" ?
How
can I capture it ? I have a CGI (written in ActivePerl for Win32) that
executes
a "while" loop. But even when the user hits "stop" (or kills the browser
window),
the scripts go on running (I can see the "perl.exe" process in the task
manager).
Any ideas ?
Thanks in advance.
____________________________________________________________________________
__
Hilton Bruno de Almeida Sousa - El Sapujo
[sapujo@dcc.ufmg.br] [http://www.dcc.ufmg.br/~sapujo]
------------------------------
Date: Fri, 30 Jul 1999 19:52:22 +0200
From: espel@iagora.com (Roger Espel Llima)
Subject: Re: How to stop a CGI execution ?
Message-Id: <moosn7.tu1.ln@rajpur.iagora.es>
In article <7nsmeq$dpa$1@usenet.pop-mg.rnp.br>,
Hilton Bruno de Almeida Sousa <sapujo@dcc.ufmg.br> wrote:
> Does the browser send any signal to a CGI when the user hits "stop" ?
>How
>can I capture it ? I have a CGI (written in ActivePerl for Win32) that
>executes
>a "while" loop. But even when the user hits "stop" (or kills the browser
>window),
>the scripts go on running (I can see the "perl.exe" process in the task
>manager).
> Any ideas ?
try checking the return values from your print's. if it returns undef,
just exit the script.
(disclaimer, I don't know the ActivePerl CGI model so exit'ing might be
inappropriate... anyway, when that happens, stop printing or processing
and return in whichever way is appropriate)
--
Roger Espel Llima, espel@iagora.com
http://www.eleves.ens.fr:8080/home/espel/index.html
------------------------------
Date: 30 Jul 1999 10:36:13 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Newbie alert !!
Message-Id: <xkfd7xahz7m.fsf@valdemar.col.hp.com>
"Faisal Nasim" <swiftkid@bigfoot.com> writes:
> : somebody else, whose attribution Faisal snipped, wrote:
BTW, don't do that. If you quote somebody attribute that quote, so the
rest of us can see who it is you're replying to, and so that quotes can
be properly attributed after several replies.
> : |Mary|601 Elm Street|Nowhere, CA|99999|555-111-2222|
> : [wants to change it to:]
> : |Mary|601 Elm Street|Nowhere, CA|99999|555-111-2222||||||
> :
> : It would seem that this would be a trivial matter for a perl script.
> : I'm pretty sure this will involve the "." operator, but I'm not sure how
> : to go about it.
>
> perldoc -f split
*piku*
split? In the name of all that is good and right in the world, why? He
wants to add characters to each line, not parse them out into fields.
I'd say something like:
perl -lni.bak -e "print $_,"|||||\n"' old_data_file
The only difference between my version and Sam Holden's is that I save
the output in old_data_file.bak, so you can verify that the script did
what you wanted. This isn't necessary, but I've just got in the habit of
using ".bak" whenever I specify -i.
-=Eric
------------------------------
Date: Fri, 30 Jul 1999 16:47:41 GMT
From: mike cardeiro <mikecard@my-deja.com>
Subject: Re: NEWSFLASH: Supremes rule anti-advert-ware illegal
Message-Id: <7nskva$mfs$1@nnrp1.deja.com>
arent you all the same people who are always whining about the signal to
noise ratio whenever a newbie asks a question
just some food for thought. flame me if you must
mike cardeiro
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 30 Jul 1999 10:26:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: NEWSFLASH: Supremes rule anti-advert-ware illegal
Message-Id: <MPG.120b803422f746b989d76@nntp.hpl.hp.com>
In article <7nskva$mfs$1@nnrp1.deja.com> on Fri, 30 Jul 1999 16:47:41
GMT, mike cardeiro <mikecard@my-deja.com> says...
> arent you all the same people who are always whining about the signal to
> noise ratio whenever a newbie asks a question
>
> just some food for thought. flame me if you must
For most of those who have partaken in this thread, and particularly for
the original poster, the *individual* signal-to-noise ratio is very
large indeed.
In other words, they're entitled to be cut some slack on this occasional
diversion. They have earned it.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 30 Jul 1999 16:19:01 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Obscure warnings behavior
Message-Id: <37a1d075$0$220@nntp1.ba.best.com>
I apologize for going on about this, but so far I've been unable to
find anything in the man pages or the Camel or at deja.com or the FAQs
explaining why an uninitialized value warning emitted under -w inside
an if block reports the problem as occurring at the point where the
block begins, rather than the actual line number where the variable is
used, while the same thing inside a naked block or a while loop reports
it as being at the line number of the variable.
A pointer to relevant documentation (if any) would be appreciated.
Thanks.
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: Fri, 30 Jul 1999 08:41:42 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: parameter doesn't show up
Message-Id: <6i6sn7.98t.ln@magna.metronet.com>
Maria Zevenhoven (maria.zevenhoven@kolumbus.fi) wrote:
: I made this thing to test, but it doesn't work:
: #!/usr/bin/perl
You should enable warnings and use strict.
#!/usr/bin/perl -w
use strict;
: read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
: with perl -w I get the following:
: <html><br><h1>Kalenteri 0.01b</h1>
: Use of uninitialized value at kalenteri.cgi line 8.
: <br>Parameter:
: so what went wrong?
There is no CONTENT_LENGTH env var defined.
You should be using the CGI.pm module that comes with perl too.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 30 Jul 1999 10:14:40 -0600
From: iowa_song8@hot8mail.com (Weston Cann)
Subject: passing a list of hashes to a subroutine?
Message-Id: <iowa_song8-3007991014410001@ip39.salt-lake-city12.ut.pub-ip.psi.net>
I have a list of hashes, passed back from a routine that does
a database query, that I'd like to be able to pass to other
routines.
The problem is, I have no idea how to pass a list of hashes
INTO a subroutine. I poked around Tom Christiansen's Perl Data
Structures Cookbook, a reference book or two, and these
newsgroups, but the closest things I've seen are instructions
on how to pass a list or a hash into a subroutine - no lists of
hashes.
Any ideas?
Weston
iow8a_song@hot8mail.com
Email address is munged to repel spam. Remove 8's to reply by email.
------------------------------
Date: 30 Jul 1999 10:31:14 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: passing a list of hashes to a subroutine?
Message-Id: <37a1d352@cs.colorado.edu>
In comp.lang.perl.misc, iowa_song8@hotmail.com (Weston Cann) writes:
:I have a list of hashes, passed back from a routine that does
:a database query, that I'd like to be able to pass to other
:routines.
:
:The problem is, I have no idea how to pass a list of hashes
:INTO a subroutine. I poked around Tom Christiansen's Perl Data
:Structures Cookbook
Try the Perl Cookbook, a published tome.
:a reference book or two, and these
:newsgroups, but the closest things I've seen are instructions
:on how to pass a list or a hash into a subroutine - no lists of
:hashes.
Use
func( \( %hash1, %hash2, %hash3 ) )
etc.
But I don't know how you got back a list of hashes. I bet
you have a reference to an array of references to hashes, or,
if you would, some $AoH thingamawhatsits.
Did you read Pass by Reference in perlsub?
--tom
--
Doing linear scans over an associative array is like trying to club someone
to death with a loaded Uzi. --Larry Wall
------------------------------
Date: 30 Jul 1999 16:31:02 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: perl IP to OS mapping help
Message-Id: <slrn7q3kq6.gcp.M.Ray@carlova.ulcc.ac.uk>
On Fri, 30 Jul 1999 15:19:36 GMT, ffr200 <ffr200@my-deja.com> wrote:
>hello,
> I need to write a perl program that receives an IP address and a
>hostname, and is able to return an operating system and OS
>information. Does anyone know how to get an OS from a given IP? Help
>is greatly appreciated.
If the IP address is within your own organisation, then just ask the
person responsible for that host (you do keep track of ownership of
IP addresses, right?). If the IP address is outside your organisation,
then it's none of your business what OS is running on that host.
There's a tool called 'nmap' which will can take a stab at identifying
the target host's OS by looking at various IP stack idiosyncracies. Get
it at:
http://www.insecure.org/nmap/
But make sure you have a legitimate reason for using it.
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: 30 Jul 1999 12:54:59 -0400
From: dha@panix.com (David H. Adler)
Subject: Perl Mongers presents: Travel to TPC
Message-Id: <slrn7q3m72.ch7.dha@panix.com>
The Perl Conference (version 3) is coming up. Few of those going
actually live in Monterey. Travel costs money. Fortunately, we're here
to help.
Equitable Travel, the official travel agency of Perl Mongers, is
developing special pricing structures for travel to TPC 3.0.
See <http://www.pm.org/travel.shtml> for details...
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"Hey you! Don't watch dat! Watch thees! This is the heavy, heavy
monster sound!" - Madness
------------------------------
Date: 30 Jul 1999 09:42:41 PDT
From: rdm@cfcl.com (Rich Morin)
Subject: Re: Perl Mongers
Message-Id: <rdm-3007990943100001@205.158.144.205>
In article <7ns4gh$i8m$1@nntp0.reith.bbc.co.uk>, "James Williamson"
<james.williamson@bbc.co.uk> wrote:
> I was reading the other day about PerlMongers and was pretty intrigued to
> know if there was a group in London (UK).
Yes, according to http://www.pm.org/groups.shtml; there are also groups
in other parts of England and the UK.
> What sort of people participate in these get togethers?
It probably varies somewhat from group to group and from event to
event. At our upcoming Beer & Pizza SIG meeting, I expect to see
folks who enjoy informal food, drink, and conversation. The "real"
SFPUG (http://sf.pm.org) meetings, on the other hand, can get quite
technical at times. In short, Your Mileage May Vary...
-r
--
Canta Forda Computer Laboratory | Prime Time Freeware - quality
UNIX consulting, training, & writing | freeware at affordable prices
+1 650-873-7841 | +1 408-433-9662 -0727 (Fax)
Rich Morin, rdm@cfcl.com | www.ptf.com, info@ptf.com
------------------------------
Date: Fri, 30 Jul 1999 16:22:00 GMT
From: acisconsulting@my-deja.com
Subject: Re: Perlshop Question
Message-Id: <7nsjer$l7n$1@nnrp1.deja.com>
Check you ACTION value, this error occurs if ACTION is missing or
undefined.
Efrem H.
E-commerce Businesses Network (EBN)
Get a FREE banner designed ($49.99 value), Limited time offer!!
Advertise FREE on EBN Banner Exchange. No Obligation. No catch.
http://www.acisconsulting.com/freebanner.html
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 30 Jul 1999 18:09:32 +0200
From: espel@iagora.com (Roger Espel Llima)
Subject: single threaded server
Message-Id: <snisn7.8k1.ln@rajpur.iagora.es>
I'm writing a server in perl that needs to be able to handle a few
hundreds of long-standing http connections. This is an http front-end
to other services, not yet-another-webserver.
There is a lot of shared state, so all connections must be handled in a
single process. This means a select()-based networking model, and
non-blocking sockets everywhere, and sysread/syswrite to go with it.
In other words, reinventing a lot of wheels.
My questions are:
1) is there some module that can take care of the select() loop part?
I'm sure I'm not the first to need a generic select() inner loop with
callbacks for read and write availability, line buffering, and timers
with callbacks.
2) is there some module that can do HTTP under such a networking model?
my understanding is that modules like HTTP::* expect to be able to
read lines with <SOCKET>, and to be allowed to block.
3) I've always used plain old filehandles for sockets; any good reason to
switch to IO::Socket? for that matter, does IO::Socket support non-
blocking operations? (read, write, accept, connect)
Thanks for any hints!
Roger
--
Roger Espel Llima, espel@iagora.com
http://www.eleves.ens.fr:8080/home/espel/index.html
------------------------------
Date: Fri, 30 Jul 1999 12:21:27 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Use of uninitialized value at ...... warning with hash of hash
Message-Id: <x3ywvvihzw9.fsf@tigre.matrox.com>
"J.H.P" <jong@ebi.ac.uk> writes:
> my($each_sub, %out_subs, %left_out, $ver, $real_sub_entry_found,
> %final_out_subs, %out_subs, $separate_hash_entry_opt, $long_subname,
> @final_separate_entry_out);
In Perl (unlike C, and like C++), you can declare variables whenever
you need them. They don't have to be at the beginning of the
program. Personally, I find the above very ugly and would resort to
declaring my variables only when necessary.
> #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> # Parsing input files of perl programs
> #_____________________________________________
> my ($sub_name, $title_found);
>
> my @lib = @$lines;
>
> #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``
> # This for loop does not allow return until each sub is finished
> #_____________________________________________________________________
> for ($j=0; $j < @lib; $j++) {
In the body of your for() loop, you don't use $j except to index @lib,
which is the C-way of doing things. The Perl-way is more like:
for my $lib (@lib) {
which makes $lib iterate through all the elements in @lib. It's more
convenient and more efficient.
> #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
> # Reading the first delimiter line and 'Title' line altogether
> #_______________________________________________________________
> if ($lib[$j]=~/^\#[\-_]{50,}/ ) {
> next;
Again, the above looks more Perlish when written the following way:
next if $lib[$j]=~/^\#[\-_]{50,}/;
or even
$lib[$j]=~/^\#[\-_]{50,}/ and next;
> } elsif ( $lib[$j]=~/^(\#+ *title *: *([\w\-\.]+))/i ) {
> $long_subname=$1; $sub_name=$2; $title_found=1;
> if ($sub_name=~/\.pl$/) {
> next;
> } ## to avoid the very first headbox
> $out_subs{"$sub_name"}{'title'}="$sub_name";
The above line seems to be the culprit. $sub_name doesn't seem to be
defined in some cases. Show us a sample of your data, and someone will
be able to help you formulate a better regexp to fit your needs. Also,
your line:
$out_subs{"$sub_name"}{'title'}="$sub_name";
is not very well thought out because the value of your HoH is the same
as the key of your first hash. You are just wasting memory. Also, the
quotes around $sub_name (in both cases) are unnecessary and just add
noise to your code.
HTH,
Ala
------------------------------
Date: 30 Jul 1999 16:56:29 GMT
From: neutron@fc.hp.com (Jack Applin)
Subject: Re: variation on /^=/ .. /^=cut/
Message-Id: <7nslft$daf$1@fcnews.fc.hp.com>
Sean McAfee (mcafee@waits.facilities.med.umich.edu) wrote:
> The various other responses you've gotten can be condensed into:
>
> while (<>) { print if (/^=/ .. /^=cut/) =~ /^(?!1$)(?!.*E)./ }
>
> Admittedly, this looks slightly yucky, but at least it's concise.
This is a bit more concise:
while (<>) { print if (/^=/ .. /^=cut/) !~ /^1?$|E/ }
-Jack Applin
neutron@fc.hp.com
------------------------------
Date: Fri, 30 Jul 1999 11:53:32 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Warrning with Variable
Message-Id: <x3y1zdqjfr7.fsf@tigre.matrox.com>
Matt <mattk@cybersurf.net> writes:
> Samay wrote:
> >
> > Example:
> > Argument "Lee" isn't numeric in lt at subs line 127
> >
> > Now, I would like to know which file generated this warning
> > message, so I can check that file to see what's wrong.
> >
> > I want to see warning as
> >
> > Argument "Lee" isn't numeric in lt at subs line 127 while
> > processing "xyz.txt"
>
> Isn't $file passed to process()? Just include $file in print.
>
> Matt
No this won't work since the warning message is printed out by the
Perl interpreter and not by the program.
But, there is another solution. You have to trap the warning issued by
Perl, and modify the message to your liking. Example:
sub is_less_than {
$SIG{__WARN__} = sub {
my $msg = shift;
print "I got the following warning: $msg";
};
my ($x, $y) = @_;
return $x < $y;
}
my $var1 = 1;
my $var2 = 2;
my $var3 = 'a';
print "YES\n" if is_less_than($var1, $var2);
print "YES\n" if is_less_than($var2, $var3);
This outputs:
YES
I got the following warning: Argument "a" isn't numeric in lt at - line 8.
HTH,
Ala
------------------------------
Date: Fri, 30 Jul 1999 16:42:51 GMT
From: aschmied@earthlink.net
Subject: Re: Why is this regexp not working ?
Message-Id: <7nskma$m5j$1@nnrp1.deja.com>
In article <7nrv57$6m7$1@nnrp1.deja.com>,
marcza@my-deja.com wrote:
> Assume the following:
>
> $currline = "Date: 23.05.1999";
> if ($currline =~ /([ \w]{1,20})$/) {
> print "matched\n"; }
>
> Surprisingly currline IS MATCHED. Why ?
> I mentioned "$" at the end of the regexp. That means from my point
> of view that the last character of currline must be
> a word char (\w = [a-zA-Z_]) or a space.
> BUT: The last char is a digit. So the reg exp shouldn't match. But it
> does.
>
> Any help is appreciated.
\w matches numbers too. It is equivalent to [a-zA-Z0-9] (As stated by
the nutshell.)
Amy Schmieder
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 30 Jul 1999 10:37:42 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Why is this regexp not working ?
Message-Id: <MPG.120b82c2b76f541b989d77@nntp.hpl.hp.com>
In article <7nskma$m5j$1@nnrp1.deja.com> on Fri, 30 Jul 1999 16:42:51
GMT, aschmied@earthlink.net <aschmied@earthlink.net> says...
...
> \w matches numbers too. It is equivalent to [a-zA-Z0-9] (As stated by
> the nutshell.)
If that it so, the Nutshell needs a Nutcracker. In the absence of a
locale, it is equivalent to the characters you name above, and the
underscore character.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 313
*************************************