[13496] in Perl-Users-Digest
Perl-Users Digest, Issue: 906 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 25 12:13:03 1999
Date: Sat, 25 Sep 1999 09:05:12 -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: <938275511-v9-i906@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 25 Sep 1999 Volume: 9 Number: 906
Today's topics:
Re: ./ -- why? <gellyfish@gellyfish.com>
Re: 100 levels deep - in debugger (M.J.T. Guy)
Are you sure!? Positive? mrbog@my-deja.com
Re: Arrays?!? <poohba@io.com>
Re: beauty of a Y2K bug (Bbirthisel)
Re: beauty of a Y2K bug <gellyfish@gellyfish.com>
Re: beauty of a Y2K bug (Benjamin Franz)
Re: can I do this easier? (Larry Rosler)
Re: can I do this easier? <gellyfish@gellyfish.com>
Re: can I do this easier? (Philip 'Yes, that's my address' Newton)
Re: content needed for oklinux.yi.org <gellyfish@gellyfish.com>
Re: cookbook: nonforker (M.J.T. Guy)
Need a unique "ID" string <smiths@erols.com>
Re: Need a unique "ID" string <rra@stanford.edu>
Re: Need a unique "ID" string <rasmusr@online.no>
Re: Need a unique "ID" string <mike@crusaders.no>
Re: Need a unique "ID" string <meowing@banet.net>
Re: Need a unique "ID" string <tchrist@mox.perl.com>
Re: Perl and Ms Personnal Web server <tom.kralidis@ccrs.nrcanDOTgc.ca>
Re: Perl error message <gellyfish@gellyfish.com>
Re: perl program terminates unexpectedly (Larry Rosler)
regex problem (r j huntington)
Re: regex problem <rowntrob@mindspring.com>
Re: regex problem (r j huntington)
Re: regex problem (Larry Rosler)
Re: regex problem <rick.delaney@home.com>
Re: Replacement "CD" for win32 systems <gellyfish@gellyfish.com>
Re: Replacement "CD" for win32 systems <isaac.hepworth@dresdner-bank.com>
Re: Still RPC/Taint problems <rockie@apk.net>
Re: WEB server in Pearl <gellyfish@gellyfish.com>
Re: WEB server in Pearl (Steve Linberg)
Re: Who is Matt Wright and Why is He Dangerous? <gellyfish@gellyfish.com>
Re: why "system" can not be used in the CGI/Perl? <gellyfish@gellyfish.com>
Re: why "system" can not be used in the CGI/Perl? (Steve Linberg)
why does strict not warn about shaddowing declarations <syeates@manuka.cs.waikato.ac.nz>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 25 Sep 1999 15:06:56 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: ./ -- why?
Message-Id: <7sioeg$bi1$1@gellyfish.btinternet.com>
On Thu, 23 Sep 1999 00:18:30 -0400 Jeff wrote:
> Hello,
> I am wondering why would I need to precede my Perl script with a " ./ " to
> get it to execute? I am using a Red Hat server. When I run this script on
> a Slackware server it doesn't need the ./ in front of the file name.
>
You should ask in a linux newsgroup that would be prepared to discuss
the way in which the different distributions configure the default
PATH given to users.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 25 Sep 1999 14:17:39 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: 100 levels deep - in debugger
Message-Id: <7sili3$2ut$1@pegasus.csx.cam.ac.uk>
In article <7sdgtg$146$1@cascade.cs.utexas.edu>,
David R. Throop <throop@cs.utexas.edu> wrote:
>I'm trying to debug a large Perl program. The debugger version is:
> Loading DB routines from perl5db.pl version 1.01
>
>The program is breaking on my 'clist' function with the message
>
> 100 levels deep in subroutine calls!
I've also encountered this effect on occasion. The message is
definitely spurious. It does seem some internal count in the
debugger is slipping. I've never had the spare tuits to track down
what in detail is happening.
>Thing is, 'T' shows me only to be 10 levels deep, and clist is not a
>recursive function. (Levels 4 thru 6 of those 10 levels are from a
>function calling itself recursively, though, if it matters.)
The answer from 'T' is the correct value.
>The expression that calls clist is of the form
> if(&clist($arg1) and &clist($arg2) and ... and &clist($arg12)){...}
>
>Is the debugger adding some overhead with all these and'ed function
>calls? Any ideas about the right way to tackle this?
No - there shouldn't be any extra debugger overhead.
Well, the 'right way' to tackle it would be to mend the bug ...
But meanwhile, either
a) Just ignore the message and continue. It's harmless.
b) Set the variable $DB::deep = 0 at the start of your debugging
session.
Mike Guy
------------------------------
Date: Sat, 25 Sep 1999 15:27:51 GMT
From: mrbog@my-deja.com
Subject: Are you sure!? Positive?
Message-Id: <7siple$14u$1@nnrp1.deja.com>
Are you sure I am plonked?! Really? Because I could swear I heard
someone with your name say that before.
Your post, once again, is full of generic personal attacks and grade-
school quality name calling.
At least I actually argued about the subject at hand and not about
"what a supid head" my opponent is.
In article <x7g1033nge.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
> >>>>> "m" == mrbog <mrbog@my-deja.com> writes:
>
> >> you are tangentially related to pond scum. and to elephant shit.
and
> m> to
> >> mars rocks. and to pustules. should we keep talking about you and
> m> those
> >> topics too? why not, there are no rules here, it is the internet.
> >>
> >> mrbog is full of elephant shit and has a large pustule full of
pond
> m> scum
> >> and has mars rocks in his head.
>
> m> Well, it's good to see you're acting mature when people disagree
with
> m> you.
>
> hey shit for brains, i act mature when it is warranted. you didn't
post
> properly here after many attempts to educate you. i waited patiently
> until you might see the light. that never happened. the only light is
> going from one of your ears to the other. so i had to get your
attention
> which seemed to work.
>
> and my post was also full of sarcasm as it demonstrate how off topic
> posts are not welcome. but you are too dense to get that either and
you
> responded which wasn't even asked for or necessary. so here i am
trying
> to educate you again. i might as well send stuff about business ethics
> to bill gates as to try to educate you about usenet netiquette.
>
> don't reply. i have no need to read your blather.
>
> *Plonk*
>
> my true first actual plonk of an asshole. i never did this to reese,
the
> dummy from nz or bottommind. this shows how low you have crawled in my
> book.
>
> uri
>
> --
> Uri Guttman ----------------- SYStems ARCHitecture and Software
Engineering
> uri@sysarch.com --------------------------- Perl, Internet, UNIX
Consulting
> Have Perl, Will Travel -----------------------------
http://www.sysarch.com
> The Best Search Engine on the Net -------------
http://www.northernlight.com
> "F**king Windows 98", said the general in South Park before shooting
Bill.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 25 Sep 1999 09:38:28 -0500
From: Poohba <poohba@io.com>
To: Robert Campbell <choco@duke.edu>
Subject: Re: Arrays?!?
Message-Id: <Pine.LNX.4.10.9909250833230.5379-100000@eris.io.com>
This is how the program looks. A lil sloppy but it kinda does the trick.
What i want it to do is to subtract the first field in the last record
from the first field in the new record. This is the code
users.cgi:
#!/usr/local/bin/perl -w
# Set Variables
$file="findu.dat";
$duke="duke.dat";
$date_command = "/usr/bin/date";
$| = 1;
# Get the Date for Entry
$date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date);
# Set Alarm
$SIG{ALRM} = sub { alarm(1);
print ".";
};
alarm(1); # initialize the alarm
# Check to see if file exists
if(-e $file) {
print "File is here already!\n";
}
else {
system "findu > $file";
sleep(10);
print "File Created!\n";
}
# chmod(777,$file);
# Open files
open (DUKE, ">>$duke") || die "Can't open $duke: $!\n";
print "Opened $duke!\n";
open (FILE, $file) || die "Can't open $file: $!\n";
print "Opened $file\n";
@users=<FILE>;
# $SIZE=@users;
close(FILE);
# @LINES=<DUKE>;
@whos=<DUKE>;
$people = 0;
foreach $user (@users) {
($login) = split(/\n/, $user);
$people = $people + 1;
}
foreach $who (@whos) {
($numofpeep,$thedate) = split(/\t/, $who);
last;
$numofpeep = $old;
}
print "Completed counting $people people!\n";
print DUKE "<!--begin-->\n";
print DUKE "$people\t$date\n";
close(DUKE);
print "Finished printing to $duke.\n";
open (DUKE, $duke) || die "Can't open $duke: $!\n";
@peeps=<DUKE>;
close(DUKE);
foreach $peep (@peeps) {
($peop, $dat) = split(/\t/, $peep);
if ($dat ne /$date/i) {
next;
}
else {
$difference = $people - $old;
}
$dat = $dat;
$difference = $people - $old;
}
print "There are $people with acpub accounts!\n";
print "$date\nWho: $old\nDifference: $difference\n";
system "rm -f $file";
if(-e $file) {
print "File was not erased!\n";
system "rm $file";
}
else {
print "File erased!\n";
system "rm $file";
}
alarm(0);
duke.dat:
<!--begin-->
33398 Tuesday, May 25, 1999 at 01:37:59 (EDT)
37755 Friday, August 20, 1999 at 15:27:42 (EDT)
37874 Monday, August 30, 1999 at 08:53:56 (EDT)
38050 Saturday, September 11, 1999 at 12:35:58 (EDT)
38050 Saturday, September 11, 1999 at 13:26:16 (EDT)
38050 Saturday, September 11, 1999 at 14:32:29 (EDT)
38073 Thursday, September 16, 1999 at 15:04:45 (EDT)
38127 Friday, September 24, 1999 at 11:18:59 (EDT)
38127 Friday, September 24, 1999 at 12:16:23 (EDT)
38127 Friday, September 24, 1999 at 12:44:43 (EDT)
38127 Friday, September 24, 1999 at 12:45:49 (EDT)
* Web Page Designs *
/ poohba@io.com | www.io.com/~poohba\
---------------------------------------
\ For info about me send message with /
* subject "send file help" *
------------------------------
Date: 25 Sep 1999 13:45:00 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: beauty of a Y2K bug
Message-Id: <19990925094500.18984.00002283@ng-fe1.aol.com>
Hi Kragen and Jack:
>> Someone claimed that Larry had a "19$year" bug in an earlier edition of
>> the Camel. (Can anyone confirm or deny?)
>
>"Programming perl", 1st edition, copyright 1990,
>by Larry Wall and Randal L. Schwartz, p. 317:
P. 321 in my printing - the "wrapman" example.
>
> .TH $PROG 1 "$month $mday, 19$year"
>
>Larry & Randal are clever people.
VERY clever. The ".TH" should have looked suspicious.
The example is part of a Perl script that generates nroff
code for creating manpages. Since it is preceeded by a
disclaimer that "The next few lines are legal in both Perl
and nroff.", the normal definitions of "bug" don't apply.
Especially since the line given is preceeded by __END__.
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: 25 Sep 1999 15:10:30 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: beauty of a Y2K bug
Message-Id: <7siol6$bi4$1@gellyfish.btinternet.com>
On 25 Sep 1999 01:16:39 -0500 Abigail wrote:
> Sam Holden (sholden@pgrad.cs.usyd.edu.au) wrote on MMCCXV September
> MCMXCIII in <URL:news:slrn7umb1t.nou.sholden@pgrad.cs.usyd.edu.au>:
> __ On Fri, 24 Sep 1999 05:53:07 GMT, Kragen Sitaker <kragen@dnaco.net> wrote:
> __ >
> __ >Missing handrails like no type safety and no bounds-checking and no
> __ >garbage collection I can understand. It makes your program faster and
> __ >compilers simpler, and sometimes makes your program simpler, too.
> __ >
> __ >But what does tm_year being (year -1900) buy you? You can fit it into
> __ >a byte instead of two bytes? It certainly doesn't make your program
> __ >any faster or simpler, and it doesn't make the library any faster or
> __ >simpler either. All it does is cause bugs.
> __
> __ It shows you who are the idiots that don't read the specs and thus
> __ should not be employed.
>
>
> Nice try, but that didn't really work, did it?
>
Not only is this the longest september ever its also looking to be the longest
97 days we will have ever seen ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 25 Sep 1999 15:48:01 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: beauty of a Y2K bug
Message-Id: <R86H3.5$dV4.2260@typhoon01.swbell.net>
In article <19990925094500.18984.00002283@ng-fe1.aol.com>,
Bbirthisel <bbirthisel@aol.com> wrote:
>Hi Kragen and Jack:
>
>>> Someone claimed that Larry had a "19$year" bug in an earlier edition of
>>> the Camel. (Can anyone confirm or deny?)
>>
>>"Programming perl", 1st edition, copyright 1990,
>>by Larry Wall and Randal L. Schwartz, p. 317:
>
>P. 321 in my printing - the "wrapman" example.
>
>>
>> .TH $PROG 1 "$month $mday, 19$year"
>>
>>Larry & Randal are clever people.
>
>VERY clever. The ".TH" should have looked suspicious.
>The example is part of a Perl script that generates nroff
>code for creating manpages. Since it is preceeded by a
>disclaimer that "The next few lines are legal in both Perl
>and nroff.", the normal definitions of "bug" don't apply.
>
>Especially since the line given is preceeded by __END__.
Not _that_ clever. Re-read the code. It's a bug and the nroff/perl
cross-legality has nothing to do with it. nroff _never sees_ the
variables because they are pre-processed out. By the time nroff
gets a hold of it, it reads '19100' _not_ '19$year'. There is NO
reason the bug needed to be there. Putting $year += 1900;
in the code and using '$year' instead of '19$year' would fix
it 100% with no side effects what-so-ever.
It is pure and simple a Y2K _error_. And wiggling around with
'but it cleverly manages to be both Perl and nroff' has nothing
to do with it any more than
my ($year) = (localtime time)[5];
print <<"HTMLSTUFF";
<html>
<head>
<title>19$year</title>
</head>
<body><p>A Y2K Bug!</p></body>
</html>
HTMLSTUFF
'cleverly' being both HTML and Perl does. In neither case
was the presence of the Y2K bug _necessary_.
--
Benjamin Franz
------------------------------
Date: Sat, 25 Sep 1999 05:23:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: can I do this easier?
Message-Id: <MPG.12565e80130cb13989fdb@nntp.hpl.hp.com>
In article <7shm37$aog$1@nnrp1.deja.com> on Sat, 25 Sep 1999 05:20:48
GMT, nileshnimkar@my-deja.com <nileshnimkar@my-deja.com> says...
> In article <7sh2ju$bo1$1@paxfeed.eni.net>,
> "Cipo Fuzo" <cipofuzo@hotmail.com> wrote:
> > I would like to load in 8 line cunks from a text file. Is there an
> > easier/nicer way, than this:
...
> Of course you can !!. Instead of loading each line seperately, load the
> whole file at once in an array.
>
> @chunk = <INPUT> ; # loads whole file. Each line a element.
He forgot to tell you that the file which he wanted to examine in chunks
of eight lines contained 10 million lines in all. Oops!
> $#chunk = 8 ; # trunkates your array to only 8 elements. Now you
> have # your firsr 8 lines !!
No, you have nine elements. Oops!
And what happened to the rest of them? Oops!
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 25 Sep 1999 15:02:12 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: can I do this easier?
Message-Id: <7sio5k$bhu$1@gellyfish.btinternet.com>
On Fri, 24 Sep 1999 16:47:57 -0700 Cipo Fuzo wrote:
> hello,
>
> I would like to load in 8 line cunks from a text file. Is there an
> easier/nicer way, than this:
>
> while (($chunk[0]=<INPUT>) && ($chunk[1]=<INPUT>) && ($chunk[2]=<INPUT>) &&
> ($chunk[3]=<INPUT>) && ($chunk[4]=<INPUT>) && ($chunk[5]=<INPUT>) &&
> ($chunk[6]=<INPUT>) && ($chunk[7]=<INPUT>))
> {
> ...
> }
>
Err ...
This will read the first eight lines :
while(<STDIN>)
{
push @chunk,$_;
last if ($. == 8 )
}
Or:
@chunk[0 .. 7] = <STDIN>;
(with varying degrees of efficiency :)
But what I think that you want is something like:
while (<STDIN>)
{
push @chunk,$_;
unless ( $. % 8 )
{
#
# do something with @chunk;
#
@chunk = ();
}
}
If you want to process @chunk eight line at a time.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 25 Sep 1999 15:38:17 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: can I do this easier?
Message-Id: <37ec73c5.481512979@news.nikoma.de>
On Sat, 25 Sep 1999 05:20:48 GMT, nileshnimkar@my-deja.com wrote:
>In article <7sh2ju$bo1$1@paxfeed.eni.net>,
> "Cipo Fuzo" <cipofuzo@hotmail.com> wrote:
>> I would like to load in 8 line cunks from a text file. Is there an
>> easier/nicer way, than this:
>> [snip]
>
>Of course you can !!. Instead of loading each line seperately, load the
>whole file at once in an array.
>
>@chunk = <INPUT> ; # loads whole file. Each line a element.
>$#chunk = 8 ; # trunkates your array to only 8 elements. Now you
>have # your firsr 8 lines !!
1) Your newsreader puts in newlines in inopportune places
2) The code is wrong. The assignment truncates your array to 9
elements, not eight (for default values of $[).
3) Please explain how your code would enable Cipo Fuzo to read in the
second 8-line chunk from the file
4) I sincerely hope you were joking when you posted that code.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.net>
------------------------------
Date: 25 Sep 1999 14:23:04 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: content needed for oklinux.yi.org
Message-Id: <7sils8$bc7$1@gellyfish.btinternet.com>
In comp.lang.perl.misc blkstar <blkstar@mail.com> wrote:
> Hello,
> I am creating a site (oklinux.yi.org) that will focus a great deal on
<snip>
Posting to a non-existent group would tend to lower the credibility of this
somewhat IMO.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 25 Sep 1999 14:41:46 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: cookbook: nonforker
Message-Id: <7simva$426$1@pegasus.csx.cam.ac.uk>
In article <m3zoyd6117.fsf@anthrax.local.net>,
Benjamin Schweizer <SternSZ@gmx.de> wrote:
>+-->Rick Delaney <rick.delaney@home.com>:
>| > I´ve got a non forking daemon which is pretty nice. If I mark the
>| > following code as a comment it runs pretty nice, else Perl reports
>| > that IO::Select has no method has_exception.
>|
>| If you want that method then you should upgrade your version of
>| IO::Select to the one that has that method. Better yet, upgrade your
>| perl since this is a standard module.
>
>I´ve upgraded my version from 5.005_2 to 5.005_3, but IO::Select
>doesn´t include "has_exception". What´s going wrong; is IO::Select not
>in the perl.rpm file?
It's certainly in my copy of perl5.005_03. So either you've got
a misinstalled Perl, or you have multiple Perls around and are getting
confused about which one you're using. Try "perl -V" to make sure
you're getting what you expect.
Mike Guy
------------------------------
Date: Sat, 25 Sep 1999 09:55:15 -0400
From: "The Smiths" <smiths@erols.com>
Subject: Need a unique "ID" string
Message-Id: <7sik0c$9ou$1@winter.news.rcn.net>
I need to generate a unique numeric string that gets recorded each time my
PERL cgi is invoked.
I am currently using time() to do this, but in a high volume situation, I
could easily wind up with duplicate ID numbers.
Is there a better or even standard way to generate guaranteed unique IDs for
each invocation of the CGI without using a counter file?
How do "session" oriented web sites generate the session IDs found in
cookies and query_strings?
Thanks,
Tim.
------------------------------
Date: 25 Sep 1999 07:29:35 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Need a unique "ID" string
Message-Id: <yl905vgj3k.fsf@windlord.stanford.edu>
The Smiths <smiths@erols.com> writes:
> I need to generate a unique numeric string that gets recorded each time
> my PERL cgi is invoked.
> I am currently using time() to do this, but in a high volume situation,
> I could easily wind up with duplicate ID numbers.
> Is there a better or even standard way to generate guaranteed unique IDs
> for each invocation of the CGI without using a counter file?
Guaranteed-unique is somewhat hard, but if you use something like:
time() . "-$$"
you'll get a unique ID unless the process exits before a second has passed
*and* process numbers on your system manage to repeat within the space of
a second. A lot of Unix software that generates message IDs assumes it's
a fairly safe bet this won't happen.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sat, 25 Sep 1999 16:52:17 +0100
From: "Rasmus Rimestad" <rasmusr@online.no>
Subject: Re: Need a unique "ID" string
Message-Id: <Kn5H3.519$s82.2789@news1.online.no>
I think the time and the IP ($ENV{'REMOTE_ADDR'}) of the user who is
invoking the script will be 99,99999% unique. But I'm not sure.
------------------------------
Date: Sat, 25 Sep 1999 17:24:00 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Need a unique "ID" string
Message-Id: <VK5H3.534$s82.2836@news1.online.no>
The Smiths <smiths@erols.com> wrote in message
news:7sik0c$9ou$1@winter.news.rcn.net...
> How do "session" oriented web sites generate the session IDs found in
> cookies and query_strings?
If you use Apache, you can enable the mod_unique module and simply get the
variable $ENV{UNIQUE_ID}
--
Trond Michelsen
------------------------------
Date: 25 Sep 1999 11:22:41 -0400
From: greg andruk <meowing@banet.net>
Subject: Re: Need a unique "ID" string
Message-Id: <87ln9vhv7i.fsf@slip-32-101-160-194.ma.us.ibm.net>
Russ Allbery <rra@stanford.edu> wrote:
> Guaranteed-unique is somewhat hard, but if you use something like:
> time() . "-$$"
> you'll get a unique ID unless the process exits before a second has passed
> *and* process numbers on your system manage to repeat within the space of
> a second. A lot of Unix software that generates message IDs assumes it's
> a fairly safe bet this won't happen.
Some programs insert a one-second sleep to avoid conflicts, but this
sort of approach is more common:
my $id_last = 0;
my $id_serial = 0;
sub makeid {
my ($id_new, $formatted_id);
my $id_new = time();
if ($id_new == $id_last) {
$id_serial++;
} else {
$id_last = $id_new;
$id_serial = 0;
}
$formatted_id = "$id_new.$$";
$formatted_id .= ".$id_serial" if $id_serial;
return $formatted_id;
}
------------------------------
Date: 25 Sep 1999 09:31:11 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Need a unique "ID" string
Message-Id: <37eceabf@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"The Smiths" <smiths@erols.com> writes:
:I am currently using time() to do this, but in a high volume situation, I
:could easily wind up with duplicate ID numbers.
This would appear to be unlikely to collide:
$id = join("." => (
$0,
$$,
time(),
unpack("%32L*", `ps axlww`),
unpack("%32L*", `netstat -in`)
)
);
--tom
--
"The purpose of most computer languages is to lengthen your resume by
a word and a comma." --Larry Wall
------------------------------
Date: Sat, 25 Sep 1999 10:19:38 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: Re: Perl and Ms Personnal Web server
Message-Id: <37ECD9FA.6AC5AE75@ccrs.nrcanDOTgc.ca>
Try IIS, it works great with Perl.
Configuration help: go to:
http://www.activestate.com/support/faqs/win32/perlwin32faq6.html
..Tom
-----------------------------------------------------------------------------------------
Tom Kralidis Geo-Spatial Technologist
Canada Centre for Remote Sensing Tel: (613) 947-1828
588 Booth Street , Room 241 Fax: (613) 947-1408
Ottawa , Ontario K1A 0Y7 http://www.ccrs.nrcan.gc.ca
-----------------------------------------------------------------------------------------
Larry Kasoff wrote:
>
> Do yourself a favor. Give up on Personal Web Server. I have yet to meet a
> person that doesn't have problems running CGI apps with it. Instead get Apache
> (http://www.apache.org/httpd.html) or Sambar Server (http://www.sambar.com) .
> Both are free and can run CGI programs written in Perl and other languages
> without a problem once installed.
>
> Karim wrote:
>
> > Hi,
> > I am new to Perl. I have recently downloaded Perl for windows and installed
> > Microsoft Web Server. I just don't know how to configure Ms Personnal Web
> > server to jump into Perl programming. Anybody who knows how to do it or has
> > a detailed documentation I need help.
--
------------------------------
Date: 25 Sep 1999 14:14:19 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl error message
Message-Id: <7silbr$bc1$1@gellyfish.btinternet.com>
On Fri, 24 Sep 1999 22:20:03 -0700 Webmaster wrote:
> HI all;
>
> I am having a problem with the error message below that perl gives me
> everytime I use it.
>
> For exmaple, If I type perl -v, the following output is given before the
> response:
>
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
> LC_ALL = (unset),
> LANG = "us"
> are supported and installed on your system.
> perl: warning: Falling back to the standard locale ("C").
>
> Once I get this output it goes back to normal.
>
> This is quite extrange since I have the date and time setup right in the
> computer. I am using FreeBSD 3.2-RELEASE and perl 5.005_03.
>
This is an OS specific question really and not particularly related to
Perl (although Perl is sensitive to it). You need to set the locale
settings appropriately - on my system I have only:
LC_CTYPE=en_GB
However this might differ on yours. You should read the locale manpage
for system specific information. The perllocale manpage describes Perl's
locale support in non system specific terms.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 25 Sep 1999 05:34:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: perl program terminates unexpectedly
Message-Id: <MPG.12566117327089b9989fdc@nntp.hpl.hp.com>
In article <4o7sN9jkbQvk8Kff8aDfB6fp+3R=@4ax.com> on Sat, 25 Sep 1999
19:51:07 +1000, Owen Cook <rcook@pcug.org.au> says...
> Windows DUN produces a modem log and I used a perl program to give a
> summary of connection times, as well as up and down bytes.
>
> With a change to V90 on the ISP side, I am now getting occassional
> renegotiations (I presume) during the logon phase which generates high
> ascii into the log. See below.
ASCII is a seven-bit code. 'High ASCII' (apparently you mean characters
with the high-order bit set) is an oxymoron.
> The perl program terminates somewhere in these points.
...
> It seems to me that there is a high ascii character sequence which zaps
> the perl I have on Windows. I can manually edit out all the high ascii
> stuff, and the program works as normal.
Extremely unlikely, aka I don't believe you.
> Two questions.
>
> Is it possible for a high ascii character sequence to kill of a perl
> program?
No.
> If not, what other reasons could cause the program to terminate?
Undoubtedly the character that is causing the input to stop is "\cZ",
which is being interpreted by the Windows I/O system as end-of-file.
perldoc -f binmode
Sigh...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 25 Sep 1999 13:30:38 GMT
From: wolph@merlin.albany.net (r j huntington)
Subject: regex problem
Message-Id: <7siipu$ldu$1@news.monmouth.com>
Hi, I'm doing a little perl scripting, trying to learn how to use regexps.
It's going well, if slowly, but I've run into a situation where I'm
stumped and the docs and faqs have only partially helped me.
I'm testing the validity of a domain name entered in a form to see that it
contains only valid characters. Actually pretty straightforward, except
for one little snag.
my $domain;
# first split domain name on dot, assuming only one dot
(my $dom, my $tld) = split(/\./, $domain);
# then test second-level domain name
if ($dom =~ /\W|_/ ) { reject($domain); } # non-word char or underscore
Except that the non-word character '-' (hyphen) is a valid domain name
character. How can I match: any non-word char except '-'?
Thanks in advance, - Ralph
------------------------------
Date: Sat, 25 Sep 1999 07:03:37 -0700
From: robert rowntree <rowntrob@mindspring.com>
To: r j huntington <wolph@merlin.albany.net>
Subject: Re: regex problem
Message-Id: <37ECD639.C82A6976@mindspring.com>
try the anything but char inside braces...
like [^-]
r j huntington wrote:
> Hi, I'm doing a little perl scripting, trying to learn how to use regexps.
> It's going well, if slowly, but I've run into a situation where I'm
> stumped and the docs and faqs have only partially helped me.
>
> I'm testing the validity of a domain name entered in a form to see that it
> contains only valid characters. Actually pretty straightforward, except
> for one little snag.
>
> my $domain;
>
> # first split domain name on dot, assuming only one dot
> (my $dom, my $tld) = split(/\./, $domain);
>
> # then test second-level domain name
> if ($dom =~ /\W|_/ ) { reject($domain); } # non-word char or underscore
>
> Except that the non-word character '-' (hyphen) is a valid domain name
> character. How can I match: any non-word char except '-'?
>
> Thanks in advance, - Ralph
------------------------------
Date: 25 Sep 1999 14:39:06 GMT
From: wolph@merlin.albany.net (r j huntington)
Subject: Re: regex problem
Message-Id: <7simqa$oki$1@news.monmouth.com>
robert rowntree (rowntrob@mindspring.com) wrote:
: try the anything but char inside braces...
:
: like [^-]
This seems to work:
/\W[!-]/
seems to match any non-word char except '-'.
Maybe I'm getting it after all.
Thanks for the lead, Robert. - Ralph
------------------------------
Date: Sat, 25 Sep 1999 08:44:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: regex problem
Message-Id: <MPG.12568dac583121bc989fdf@nntp.hpl.hp.com>
In article <7simqa$oki$1@news.monmouth.com> on 25 Sep 1999 14:39:06 GMT,
r j huntington <wolph@merlin.albany.net> says...
> robert rowntree (rowntrob@mindspring.com) wrote:
> : try the anything but char inside braces...
> :
> : like [^-]
>
> This seems to work:
>
> /\W[!-]/
>
> seems to match any non-word char except '-'.
That matches two characters, the first of which is a non-word character,
and the second of which is either '!' or '-'.
> Maybe I'm getting it after all.
Not quite yet.
> Thanks for the lead, Robert. - Ralph
Maybe not so useful after all.
To go back to your original post:
> if ($dom =~ /\W|_/ ) { reject($domain); } # non-word char or underscore
It seems much easier to reverse the logic, and make sure that only
allowed characters are there:
unless ($dom =~ /^[A-Za-z\d.-]+\z/ ) { reject($domain); }
Season the set of allowed characters to taste. Keep in mind that unless
escaped, the '-' must be first or last in the character class.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 25 Sep 1999 15:54:16 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: regex problem
Message-Id: <37ECF025.C3863BBE@home.com>
[posted & mailed]
r j huntington wrote:
>
> robert rowntree (rowntrob@mindspring.com) wrote:
> : try the anything but char inside braces...
> :
> : like [^-]
This will match anything but '-', including all \w characters. Not
really very helpful.
> This seems to work:
>
> /\W[!-]/
>
> seems to match any non-word char except '-'.
No, it matches any non-word char followed by a '!' or '-'. The \W will
always match exactly one character. The character class, [], will also
always match exactly one character. So this will match two, which is
not what you want.
Since \W is the same as [^\w], you could do
reject() if $dom =~ /[^\w-]/
but then domains with underscores won't be rejected.
You could break the \w down and leave out '_':
reject() if $dom =~ /[^A-Za-z0-9-]/
which should be ok as long as you don't need to include non-ascii
letters.
You can be inclusive instead of exclusive:
reject() unless $dom =~ /^[\w-]+\z/ && $domain !~ /_/;
One other way would be to take what you had,
if ($dom =~ /\W|_/ ) { reject($domain); }
and use negative look-ahead to reject the '-' that \W might match.
if ($dom =~ /(?!-)[\W_]/ ) { reject($domain); }
perldoc perlre
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: 25 Sep 1999 14:24:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Replacement "CD" for win32 systems
Message-Id: <7silu0$bca$1@gellyfish.btinternet.com>
On Sat, 25 Sep 1999 01:08:55 +0100 Simon Plant wrote:
> All,
> I need a replacement "CD" command for windows nt
> which will accept the directory to change to with
> forward slashes in...
>
etc ....
perldoc -f chdir
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 25 Sep 1999 16:33:52 +0100
From: "Isaac Hepworth" <isaac.hepworth@dresdner-bank.com>
Subject: Re: Replacement "CD" for win32 systems
Message-Id: <7siprv$lgp6@ln1p0207inf.dresdnerkb.com>
Jeff Zucker <jeff@vpservices.com> wrote in message
news:37EC2034.27F26EA1@vpservices.com...
> Simon Plant wrote:
> >
> > I need a replacement "CD" command for windows nt
> > which will accept the directory to change to with
> > forward slashes in...
> >
> > IE "cd c:/winnt/system
> >
>
> There is nothing wrong with that. It works fine.
Really? Did you test this?
C:\>cd c:/winnt/system32
C:\
C:\>
It treats the "/winnt" and "/system32" as command-line options, leaving you
with "cd c:". Perhaps you meant that it works if you put the argument in
quotes:
C:\>cd "c:/winnt/system32"
C:\WINNT\system32>
Cheers,
Isaac
------------------------------
Date: Sat, 25 Sep 1999 09:45:14 -0300
From: "R. Brockway" <rockie@apk.net>
Subject: Re: Still RPC/Taint problems
Message-Id: <37ECC3D9.9D4958E4@apk.net>
David Cassell wrote:
> R. Brockway wrote:
>
>
> > #!/usr/bin/perl -wT
> > use 5.005;
> > use strict;
>
> Good! BTW, do you really need to restrict the version to 5.005?
>
> > $ENV{PATH} = "/bin:/usr/bin";
> > delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
>
> And more good -T stuff. Glad to see you've read the docs.
>
> > my $MY_APPLICATION = "User_Mod";
> > my $MY_VERSION = 1.0;
> >
> > # Function get_user
> > sub get_user ($$@) {
> > # take $username and grep from /etc/passwd
> > my ($con, $ref, @args) = @_;
> > my $username = shift @args;
>
> Okay, right here. You need to untaint $username as recommended
> in the perlsec pages under "Laundering and Detecting Tainted
> Data". $username goes into $cmd , so $cmd will be tainted until
> $username is cleaned up. Thus the line with system "$cmd" goes
> boing under -T.
>
You know what I did? I had used :
if ($data =~ /^([-\@\w.]+)$/) {
$data = $1; # $data now untainted
} else {
die "Bad data in $data"; # log this somewhere
}
to clean up $cmd and $get_user in an effort to untaint the data, but didn't
try it on $username (duh, its coming from another program, of course its
tainted). I applied the above to $username, and WHAM it works. Thanks to all
who helped. now off to making it complicated.
-rockie
------------------------------
Date: 25 Sep 1999 14:20:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: WEB server in Pearl
Message-Id: <7silmo$bc4$1@gellyfish.btinternet.com>
On Sat, 25 Sep 1999 01:13:08 -0700 rommelhere wrote:
> Hello All,
> I'm a perl newbie. i have to write a Webserver in perl.
>
Why ?
> Please suggest resources\modules and possible approach i
> should take.
>
There are examples of HTTP servers written in Perl available via:
<http://www.perl.com/reference>
You will almost certainly also want to read the perlipc manpage which
has a discussion of these matters.
If you search Deja.com you will find a number of examples of simple
HTTP servers posted here by various people (including myself).
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 25 Sep 1999 11:06:58 -0400
From: slinberg@crocker.com (Steve Linberg)
Subject: Re: WEB server in Pearl
Message-Id: <slinberg-2509991106590001@bsg-ma1c-66.ix.netcom.com>
In article <164c000c.f00d98d1@usw-ex0108-059.remarq.com>, rommelhere
<rommelhereNOroSPAM@YAHOO.COM.invalid> wrote:
> Hello All,
> I'm a perl newbie. i have to write a Webserver in perl.
>
> Please suggest resources\modules and possible approach i
> should take.
I'd start by reading and studying all of the relevant RFCs. The Apache
source code would be a great place to go to see how a fully-functional web
server works, too.
Of course, I'd also set aside a few years for a quality, single-handed
implementation of the task, especially if you're a "perl newbie."
Or, you could look for Randall's tiny webserver script using dejanews, or
maybe someone will be kind enough dig it up and post it. That means, of
course, that you aren't really writing the server code yourself. Maybe
that's what you want, or maybe it isn't.
------------------------------
Date: 25 Sep 1999 13:54:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Who is Matt Wright and Why is He Dangerous?
Message-Id: <7sik74$bai$1@gellyfish.btinternet.com>
On Fri, 24 Sep 1999 16:13:47 GMT Jeff S. wrote:
> Lotsa stuff about bad scripting, y2k bugs, general scripting errors, and
> dangerous "script kiddies" appear all the time in this (and other
> similar) newsgroup. "Matt Wright" appears invariably in one of those
> type of threads.
Others seem to have addressed most of what is necessary here, however
I might point you to some of the detailed critiques that I and others
have posted to this group of some of Mr Wrights extant code - you post
from Deja,com so you should be familiar with the way in which you can
find these things.
Bear in mind however that whilst Matt Wright may be the most exalted
in the Script Kiddie pantheon he _is_not_the_only_one_ - *any* program
found on the web must be treated with suspicion - particularly in the
realm of CGI. Of course there are certain unreproachable sources
which should be obvious.
I would suggest that if you are really uncertain of the provenance of some
piece of 'scripting' that you found on the net and are unable to determine
its suitability for its intended purpose then you should post the URL - the
URL mind not the whole code - to the most appropriate newsgroup for the
program in question. I should be borne in mind however that - certainly
here - people won't be keen on offering support or debugging for these
programs but will we be very keen to point out the shortcomings in this
code - occasionaly some bored, hyperactive or just plain kind soul might
rewrite the thing so it will work properly ( an hey I have a disk full
of crap Perl programs awaiting a rewrite ... ).
Just tell 'em I sent you ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 25 Sep 1999 14:06:32 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: why "system" can not be used in the CGI/Perl?
Message-Id: <7sikt8$bas$1@gellyfish.btinternet.com>
On Sat, 25 Sep 1999 12:50:20 +0800 byuan wrote:
> Hi all:
>
> I try to use following script, "a" is a C program which has been
> compiled using CC, but it seems that
> the "system" here can not be actived, anyone can help me?
>
<snip>
>
> #!/usr/bin/perl
>
> print "Content-type: text/html", "\n\n";
> system("./a test.dat result.dat");
> print "<HTML>", "\n";
> print "<HEAD><TITLE>About this Server</TITLE></HEAD>", "\n";
> print "<BODY><H1>About this Server</H1>", "\n";
> print "<HR><PRE>";
<snip>
Does your program 'a' produce any output to STDOUT ? If so it probably
wants to be within your HTML tags.
You really should also check the $? variable after the system() to
determine its success (or not) - read the perlfunc entry for system for
more on this.
Also are you sure that the program *is* in the CGI program's current working
directory ? Have you tried supplying the full path to the program ? Of
course this might be blown up if your program is running in a chroot
environment - you will need to talk to the administrator of the system
about that.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 25 Sep 1999 11:10:36 -0400
From: slinberg@crocker.com (Steve Linberg)
Subject: Re: why "system" can not be used in the CGI/Perl?
Message-Id: <slinberg-2509991110360001@bsg-ma1c-66.ix.netcom.com>
In article <37EC548C.CBBDB72A@eee.hku.hk>, byuan <byuan@eee.hku.hk> wrote:
> I try to use following script, "a" is a C program which has been
> compiled using CC, but it seems that
> the "system" here can not be actived, anyone can help me?
<snip>
> system("./a test.dat result.dat");
I'd suggest:
- use "system" correctly by passing it a list, not a scalar, and
- check the return value, which will give you lots of useful information.
All explained in the documentation:
perldoc -f system
------------------------------
Date: 25 Sep 1999 11:50:51 GMT
From: Stuart Yeates <syeates@manuka.cs.waikato.ac.nz>
Subject: why does strict not warn about shaddowing declarations ?
Message-Id: <938260249.889037@clint.waikato.ac.nz>
i've just spent several hours hunting a bug caused by a case
which i thought was handled when i did a 'use strict':
sub X {
my $Y = 3;
while (...){
my $Y = $Y + 1;
}
}
of course what happens is that one declaration shaddows the other,
so the $Y that gets written to is the inner one not the outer one.
is there a good reason why strict doesn't scream about this ?
stuart
-- stuart yeates <s.yeates@cs.waikato.ac.nz> aka `loam'
words are, of course, the most powerful drug used by mankind - rudyard kipling
X-no-archive:yes
------------------------------
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 906
*************************************