[12219] in Perl-Users-Digest
Perl-Users Digest, Issue: 5818 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 28 15:07:19 1999
Date: Fri, 28 May 99 12:00:28 -0700
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, 28 May 1999 Volume: 8 Number: 5818
Today's topics:
#!usr/local/bin/perl line in IIS for a script example <squeot@bigfoot.com>
Re: #!usr/local/bin/perl line in IIS for a script examp <t-armbruster@ti.com>
Re: Alternative to deprecated scalar split <jdporter@min.net>
Re: Alternative to deprecated scalar split <macintsh@cs.bu.edu>
Re: Alternative to deprecated scalar split <Allan@due.net>
Re: Alternative to deprecated scalar split (Larry Rosler)
Re: Alternative to deprecated scalar split <macintsh@cs.bu.edu>
Re: byteperl binary <cassell@mail.cor.epa.gov>
Re: byteperl binary <alvar@agi.de>
Can Perl call C functions? sbeaulieu@my-deja.com
Re: Can someone help me on this challenging problem? <uyv_IGNORE_r@hotmail.com>
Re: CGI.pm or CGI-LIB.pl <jdporter@min.net>
Re: CGI.pm or CGI-LIB.pl <cassell@mail.cor.epa.gov>
Re: cont'd <uri@sysarch.com>
Re: conver TO url encoded (Randal L. Schwartz)
Re: Converting a string to URL Encoding <jdporter@min.net>
Re: Converting a string to URL Encoding <cassell@mail.cor.epa.gov>
Decrypting Passwords (Dennis Mercer)
Re: Decrypting Passwords (Sam Holden)
Re: Decrypting Passwords <jeromeo@atrieva.com>
Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe <uri@sysarch.com>
Fcntl locking and NFS. (Justin Hahn)
Hash References <jdixon@mitre.org>
Re: Help on Regular Xpression (Andrew Johnson)
Re: Help on Regular Xpression <ludlow@us.ibm.com>
Help! need fraction of a second time function <greg.fields@infoadvan.com>
Re: How do I prevent a CGI timeout? (Larry Rosler)
Re: How to exec a program( system() ) in a limited time <aqumsieh@matrox.com>
how to give parameters ? <mac_@friko2.onet.pl>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 28 May 1999 16:58:02 GMT
From: squeot <squeot@bigfoot.com>
Subject: #!usr/local/bin/perl line in IIS for a script example
Message-Id: <7imhuo$r07$1@nnrp1.deja.com>
Can someone show me an example of how the #!usr/local/bin/perl line
looks on an IIS server? I need both ISAPI and the standard activeperl,
thanks to any that can help.
squeot@bigfoot.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 28 May 1999 13:04:18 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: #!usr/local/bin/perl line in IIS for a script example
Message-Id: <%YA33.6$qD2.968@dfw-service1.ext.raytheon.com>
squeot wrote in message <7imhuo$r07$1@nnrp1.deja.com>...
>Can someone show me an example of how the #!usr/local/bin/perl line
>looks on an IIS server? I need both ISAPI and the standard activeperl,
On my machine (IIS and ActivePerl) if I have a ".pl" extension, I don't even
need the #! line.
------------------------------
Date: Fri, 28 May 1999 17:17:31 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Alternative to deprecated scalar split
Message-Id: <7imj39$rsp$1@nnrp1.deja.com>
In article <7im8jr$m4a$1@news1.bu.edu>,
John Siracusa <macintsh@cs.bu.edu> wrote:
> "implicit split to @_ is deprecated" according to the docs.
> Fine, but what do I do when I *want* to use split in a scalar
> context? It's a shame that grabbing just the
> number of fields ends up squashing @_. What are my options
> here? Is there a better way to do this? Example:
>
> $num_fields = split(' ', $foo); # Bzzzt! Deprecated!
>
> but the real goal here is just to get a scalar value, without
> saving the fields in any array: @_, temporary, or whatever.
$num_fields = () = split .....
--
John Porter
Put it on a plate, son. You'll enjoy it more.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 28 May 1999 17:48:07 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: Alternative to deprecated scalar split
Message-Id: <7imksn$abs$1@news1.bu.edu>
John Porter <jdporter@min.net> wrote:
> $num_fields = () = split .....
That's nearly as bad as @{[...]}. Bleh.
IMO, forcing context via an explicit:
scalar(split(...));
shouldn't squash @_. How many people actually use
that side effect these days anyway?
-----------------+----------------------------------------
John Siracusa | If you only have a hammer, you tend to
macintsh@bu.edu | see every problem as a nail. -- Maslow
------------------------------
Date: Fri, 28 May 1999 14:13:54 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Alternative to deprecated scalar split
Message-Id: <7immd6$m10$1@nntp4.atl.mindspring.net>
John Porter wrote in message <7imj39$rsp$1@nnrp1.deja.com>...
:In article <7im8jr$m4a$1@news1.bu.edu>,
: John Siracusa <macintsh@cs.bu.edu> wrote:
:> "implicit split to @_ is deprecated" according to the docs.
:> Fine, but what do I do when I *want* to use split in a scalar
:> context? It's a shame that grabbing just the
:> number of fields ends up squashing @_. What are my options
:> here? Is there a better way to do this? Example:
:>
:> $num_fields = split(' ', $foo); # Bzzzt! Deprecated!
:>
:> but the real goal here is just to get a scalar value, without
:> saving the fields in any array: @_, temporary, or whatever.
:
:$num_fields = () = split .....
Hmm, for me:
#!/usr/local/bin/perl -w
use strict;
my $foo = " one two three";
my $num_fields = () = split(' ', $foo);
print $num_fields,"\n";
prints 1 when I believe 3 is desired.
Maybe I am missing something. Happens often.
tested under:
5.004_04 built for i386-freebsd and 5.005_02 built for MSWin32-x86-object
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Wisdom begins in wonder.
- Socrates
------------------------------
Date: Fri, 28 May 1999 11:21:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Alternative to deprecated scalar split
Message-Id: <MPG.11b87e649d7f08b0989b1d@nntp.hpl.hp.com>
In article <7imj39$rsp$1@nnrp1.deja.com> on Fri, 28 May 1999 17:17:31
GMT, John Porter <jdporter@min.net> says...
> In article <7im8jr$m4a$1@news1.bu.edu>,
> John Siracusa <macintsh@cs.bu.edu> wrote:
> > "implicit split to @_ is deprecated" according to the docs.
> > Fine, but what do I do when I *want* to use split in a scalar
> > context? It's a shame that grabbing just the
> > number of fields ends up squashing @_. What are my options
> > here? Is there a better way to do this? Example:
> >
> > $num_fields = split(' ', $foo); # Bzzzt! Deprecated!
> >
> > but the real goal here is just to get a scalar value, without
> > saving the fields in any array: @_, temporary, or whatever.
>
> $num_fields = () = split .....
That is the way I thought it worked also, but I was surprised when I
tried it. Did it work when you tried it?
#!usr/local/bin/perl -w
use strict;
$_ = ' one two three ';
my $numfields;
$num_fields = () = split;
print $num_fields; # Prints "1"
$num_fields = (my @a) = split;
print $num_fields; # Prints "3"
$num_fields = 0;
++$num_fields while /\S+/g;
print $num_fields; # Prints "3"
__END__
The first way doesn't compile until 5.004, and it gives 1 in 5.004_03
and 5.005_03. Why did I (and you too, John Porter) think otherwise???
The second way uses the temporary array that John Siracusa wants to
avoid.
The last way gives the exact same behavior as default 'split', without
saving anything in throw-away arrays.
> > Doing it "by hand" with regexes, substitutions, etc. also seems
> > like a waste, since split is so close to doing what I want in
> > one simple step.
Two simple lines of code doesn't seem like such a big deal to me.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 28 May 1999 18:57:22 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: Alternative to deprecated scalar split
Message-Id: <7imoui$fds$1@news1.bu.edu>
Larry Rosler <lr@hpl.hp.com> wrote:
> $num_fields = 0;
> ++$num_fields while /\S+/g;
>
> Two simple lines of code doesn't seem like such a big deal to me.
Well, the whole issue isn't really a "big deal," but every
little bit counts :) Besides, just look at some of the
benchmarking and charting that's gone on in The Perl
Journal over equally trivial matters. Someone's got to
worry about this stuff, dammit! :)
-----------------+----------------------------------------
John Siracusa | If you only have a hammer, you tend to
macintsh@bu.edu | see every problem as a nail. -- Maslow
------------------------------
Date: Fri, 28 May 1999 10:33:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: byteperl binary
Message-Id: <374ED383.9FCEAABF@mail.cor.epa.gov>
Alvar Freude wrote:
>
> Hi!
>
> does anybody know about a downloadable byteperl executable for win32?
If I understand what you're asking, you can get one at
www.activestate.com . You just run it and let it install
itself.
> Or how i can compile it by myself with Cygwin?
Same way you do it on a unix box, pretty much. For complete
details, see The Perl Journal #13 (spring 1999) for an
article on doing this.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 28 May 1999 20:22:20 +0200
From: "Alvar Freude" <alvar@agi.de>
Subject: Re: byteperl binary
Message-Id: <7immkp$gf4$1@newsreader.ipf.de>
>> does anybody know about a downloadable byteperl executable for win32?
>
>If I understand what you're asking, you can get one at
>www.activestate.com . You just run it and let it install
>itself.
oh, no, in the ActiveState's Perl byteperl.exe is'nt included! :-(
>> Or how i can compile it by myself with Cygwin?
>
>Same way you do it on a unix box, pretty much.
hmmm, I was trying to compile it without and with patches etc -- a can't
compile Perl with cygwin. It seems that there are still some bugs in the
release(s).
> For complete
>details, see The Perl Journal #13 (spring 1999) for an
>article on doing this.
I don't have an account for tpj ;(
bye
Alvar
------------------------------
Date: Fri, 28 May 1999 16:51:15 GMT
From: sbeaulieu@my-deja.com
Subject: Can Perl call C functions?
Message-Id: <7imhi3$qkh$1@nnrp1.deja.com>
Like the subject says, can perl call C funtions? If so, how can that
be done?
Stephen
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 28 May 1999 13:44:07 -0500
From: "Ralph Emerson" <uyv_IGNORE_r@hotmail.com>
Subject: Re: Can someone help me on this challenging problem?
Message-Id: <7imo8c$bu8@dfw-ixnews11.ix.netcom.com>
I don't know about wasting. Yea, I know I need these concepts, but now I
can network 2-3 diffrent OS's, program 4 diffrent languages, pass the MCSE
test, and know about things like firewalls and winsock. 3 years ago I first
touched a computer and 2 years ago I first really started to program
(BASIC). I've learned a lot about many aspects of computers from these
thrift store/2nd hand books and best of all I learned it all myself. Now, I
just ask for some help on this. If it was in my power to read and learn it
myself, then I would and save your fingers the back breaking pain of typing.
I know it's in my power to discover on my own, but I'm such an idiot that I
can't so I've turned to USENET. I read somewhere that this was it's
purpose.
>sounds like you wasted a lot of money on bad books. (etc etc etc...)
>--
>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
------------------------------
Date: Fri, 28 May 1999 17:12:47 GMT
From: John Porter <jdporter@min.net>
Subject: Re: CGI.pm or CGI-LIB.pl
Message-Id: <7imiqd$ri5$1@nnrp1.deja.com>
In article <374EB3F4.43A504CD@pyramid.de>,
Dominik Leinfelder <dominikl@pyramid.de> wrote:
>
> I have to create some webbased aplications with perl and want to know,
> which of the both
> ways are more preferable considering security and performance...
I'm glad you asked, because this is a question which does not come
up very often on this newsgroup, so the likelihood of you finding
any discussion of it on dejanews is pretty slim. ;-)
perlfaq9, section "How do I decode a CGI form?" says, among other
things:
use the CGI.pm or CGI_Lite.pm (available from CPAN), or if
you're trapped in the module-free land of perl1 .. perl4,
you might look into cgi-lib.pl (available from...
In short, CGI.pm is the standard for almost all applications. It
is extremely robust, powerful, and well-supported. It even has
a cgi-lib.pl compatibility feature, so there's really no reason
to use cgi-lib.pl. The other nice thing about CGI.pm is that it
comes standard in recent versions of the Perl distribution.
--
John Porter
Put it on a plate, son. You'll enjoy it more.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 28 May 1999 10:23:34 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: CGI.pm or CGI-LIB.pl
Message-Id: <374ED116.C1006F4E@mail.cor.epa.gov>
Dominik Leinfelder wrote:
>
> Hello,
>
> I have to create some webbased aplications with perl and want to know,
> which of the both
> ways are more preferable considering security and performance...
use CGI; # CGI.pm, that is!
It's much better, and the modern Perl modules that do other
web-work will want it anyway instead of cgi-lib.pl (lower
case).
If performance is really an issue, you'll want to look into
eliminating the *real* bottlenecks instead. Check out the
FAQ entitled:
"How can I make my CGI script more efficient?"
Note: your copy is unlikely to mention PerlEx by ActiveState,
which is yet one more alternative.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 28 May 1999 14:48:31 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: cont'd
Message-Id: <x790a9hvy8.fsf@home.sysarch.com>
>>>>> "j" == jknoll <jknoll@my-deja.com> writes:
>> i think we should add the deja.com domain to the list of, if you post
>> from there, you don't know perl.
j> You know what, you are right. I don't know perl. THAT IS WHY IM ASKING
j> YOU!!! I didnt understand it on my own, so I thought I would ask
j> someone that did. But I cant even get an answer or any kind of help
j> from this guy. Believe me, if I didnt exhaust my options I wouldnt have
j> posted here.
look, several people have responded to you and we still don't understand
your problem. you can embed newlines directly in single quoted
strings. you can't interpolate \n into a single quoted string. so what
are you actually trying to do? you show output you want but no data so
how could we divine what you have?
you said this:
WORDSWORDS
WORDSWORDS
Instead of this:
WORDSWORDSWORDSWORDS
which makes little sense unless you know where the data is (in what perl
variables). i can print either one with either quote style just fine.
but i need to knw what the data is first and where it is.
and finally, your attitude could use a little mellowing. you posted an
unclear request and still haven't clarified it much. you haven't shown
any actual code that you tried first. this newsgroup is not a help desk
but a community of perl hackers. we get so many requests for help that
referring people to the docs and faq is a full time job. so EXCUSE us if
we don't figure out what is going on in your mind. PSI::MissingCode has
not been released to CPAN (yet).
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
------------------------------
Date: 28 May 1999 11:55:37 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: conver TO url encoded
Message-Id: <m1btf5f2hi.fsf@halfdome.holdit.com>
>>>>> "Dave" == Dave Evans <devans@radius-retail.kom> writes:
Dave> [mailed+posted]
Dave> There's a couple of subs in CGI that do that, e.g.
Dave> use CGI;
Dave> $urlpart = CGI::escape($normalstring);
Dave> and
Dave> $normalstring = CGI::unescape($urlpart);
These are not documented, and therefore subject to change. Please
don't use internal routines without checking first.
Dave> Or more preferably (especially if you're not using CGI anyway) how about:
Dave> use URI::Escape;
Dave> $escaped = uri_escape($unescaped);
Dave> $unescaped = uri_unescape($escaped);
Yes. These *are* documented. OK to use.
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Fri, 28 May 1999 16:58:48 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Converting a string to URL Encoding
Message-Id: <7imi07$r0i$1@nnrp1.deja.com>
In article <7imbvo$i$1@nntpd.lkg.dec.com>,
daniel.mendyke@digital.com (Daniel) wrote:
>
> I must have found dozens of scripts that convert from url encoding
> to text but I have not found one that converts text to url encoding.
Ordinarily, CGI.pm handles all these nasty details, if you're doing
cgi programming. But if it happens that you need to do these kinds
of transformations "off-line", the URI::Escape module is there.
--
John Porter
Put it on a plate, son. You'll enjoy it more.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 28 May 1999 10:40:16 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Daniel <daniel.mendyke@digital.com>
Subject: Re: Converting a string to URL Encoding
Message-Id: <374ED500.1C65026A@mail.cor.epa.gov>
Daniel wrote:
>
> I must have found dozens of scripts that convert from url encoding
> to text but I have not found one that converts text to url encoding.
>
> Can anyone point me to some code that converts plain text
> into a url encoded string?
Excuse me, but didn't you notice that this exact same question
was asked here only a couple hours ago? I bring this up,
because missing something like that doesn't make you look good
to people who don't know what a conscientious person you are.
Now then, surely you checked CPAN for modules that might
help you, rather than first wandering around the Weird Wide
Web for badly-written kludges. So you must have just overlooked
items like CGI.pm [which is probably a little heavy if this is
all you want to do] and URI::Escape [which does exactly what
you asked, as well as the reverse].
In future, you'll no doubt want to clarify that you did do
your homework first, but somehow you just overlooked the
things you really wanted to find.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 28 May 1999 17:39:49 GMT
From: dmercer@Glue.umd.edu (Dennis Mercer)
Subject: Decrypting Passwords
Message-Id: <7imkd5$qlj$1@hecate.umd.edu>
I'm working on a system for changing the password of a user on a site, and
I need a way to decrypt the password that is in the htpasswd file. Any
thoughts on how to go about decrypting this? I just want to verify that
the user knows his password and then ask for a new password, all on one
page. Thanks.
Dennis
------------------------------
Date: 28 May 1999 17:57:00 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Decrypting Passwords
Message-Id: <slrn7ktm7c.m1g.sholden@pgrad.cs.usyd.edu.au>
On 28 May 1999 17:39:49 GMT, Dennis Mercer <dmercer@Glue.umd.edu> wrote:
>I'm working on a system for changing the password of a user on a site, and
>I need a way to decrypt the password that is in the htpasswd file. Any
>thoughts on how to go about decrypting this? I just want to verify that
>the user knows his password and then ask for a new password, all on one
>page. Thanks.
Which part of the FAQs :
How do I decode encrypted password files?
and
How do I put a password on my web pages?
do you not understand?
The answer is you spend lots of time or lots of money or both. Of course
you don't need to decrypt the password in fact, but the documentation will
explain that.
The crypt function may prove useful.
--
Sam
In case you hadn't noticed, Perl is not big on originality.
--Larry Wall
------------------------------
Date: Fri, 28 May 1999 11:17:29 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Dennis Mercer <dmercer@Glue.umd.edu>
Subject: Re: Decrypting Passwords
Message-Id: <374EDDB9.C034FE7@atrieva.com>
Dennis Mercer wrote:
>
> I'm working on a system for changing the password of a user on a site, and
> I need a way to decrypt the password that is in the htpasswd file. Any
> thoughts on how to go about decrypting this? I just want to verify that
> the user knows his password and then ask for a new password, all on one
> page. Thanks.
You can't decrypt crypted passwords. You can, however, ask them what
their old password is, crypt() it, and see if the cyphertexts match.
For all the exciting detail on crypt(), see the perlfunc document that
came with your perl distribution. I also highly recommend "Applied
Cryptography" for the down and dirty detail of all things enciphered.
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: 28 May 1999 14:40:51 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <x7btf5hwb0.fsf@home.sysarch.com>
>>>>> "IRAA" == I R A Aggie <fl_aggie@thepentagon.com> writes:
IRAA> *shrug* Another design desicision -- emulate libc calls, a good call
IRAA> IMHO. "Fix" the underlying libc and you've "fixed" perl, too. Have you
IRAA> submitted a patch to GNU libc?
that ain't gonna happen!
IRAA> Whoa. Brain{storm|fart}. Anyone up for localtime2[*]? Then the
IRAA> documentation can say "Use localtime2(), do not use localtime(), as it
IRAA> is a dead, camel-bitten flea carcass".
write a module and use it. even overload localtime if you wish (i
wouldn't). localtime is well defined and y2k compliant. its users may
not be either one.
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
------------------------------
Date: 28 May 1999 18:19:20 GMT
From: jehahn@bu.edu (Justin Hahn)
Subject: Fcntl locking and NFS.
Message-Id: <7immn8$bpa$1@news1.bu.edu>
Hello,
I'm writing a script to handle some systems and need to do file
locking on a file which needs to be NFS shared. Thus I can't use
flock. Further, fcntl seems to be a waste of time as I can't find any
good documentation on using it, and I need a method of locking which
is portable (to at least solaris, linux and HP-UX). I'm considering
dot locking, or some such, but not sure how to implement that in
perl. Any suggestions? (if anyone has fcntl working nicely I'll use
that too.)
-----------------------------------------------
Justin Hahn <jehahn@raven.bu.edu>
Systems Administrator Boston University SPI Lab
-----------------------------------------------
------------------------------
Date: Fri, 28 May 1999 13:35:52 -0400
From: John Dixon <jdixon@mitre.org>
Subject: Hash References
Message-Id: <374ED3F8.5FE0FED8@mitre.org>
Perl Gods,
I am having trouble trying to dereference an array of hashes that
references arrays. I access each hash list as follows:
@{$Records[$i]{$Key}}[$j]
where "i" iterates through each hash list and "j" iterates through each
array element referenced by the key in the hash list.
I am having trouble storing specific hash arrays in another array. This
is what I am currently doing:
push (@new_hash_list, %{$Records[$i]})
When I try to print the new list like this:
print @{$new_hash_list[$i]{$Key}}[$j]
Nothing prints. Can anyone help me?
Thanks in advance,
--john
------------------------------
Date: Fri, 28 May 1999 17:06:31 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Help on Regular Xpression
Message-Id: <r2A33.41$ob.8043@news2.rdc1.on.home.com>
In article <7ilj5n$533$1@nnrp1.deja.com>,
tvn007@my-deja.com <tvn007@my-deja.com> wrote:
! Hi,
!
! Would someone please help me to reduce the code below ?
! (There must be a better solution !)
[snip long set of s/// ops]
I'll assume you just want to change 0 to L and 1 to H (and
vica-versa) and you are only using lowercase letters as an
intermediary step (they won't really occur in the infile)...
so use the tr/// op ('man perlop' or 'perldoc perlop'):
# open files, check returns ...
while(<INFILE>){
chomp;
tr/'_//d;
tr/01LHZYM/LH01X/;
s/SETR/R1 ddc1/g;
s/P:=T//g;
print OUTFILE "$_ ;\n";
}
# close files, check return on OUTFILE
regards
andrew
------------------------------
Date: Fri, 28 May 1999 12:10:29 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Help on Regular Xpression
Message-Id: <374ECE05.BC03DFD2@us.ibm.com>
tvn007@my-deja.com wrote:
> Would someone please help me to reduce the code below ?
> (There must be a better solution !)
You might want to read about the translation operator, tr/// (aka y///).
It is described in:
perldoc perlop
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: Fri, 28 May 1999 17:35:27 GMT
From: Greg Fields <greg.fields@infoadvan.com>
Subject: Help! need fraction of a second time function
Message-Id: <7imk4v$sp1$1@nnrp1.deja.com>
Is there any such thing?
I'm trying to find inefficiencies in some often called routines of mine
so I want to track elapsed time. However, most times they execute in
fractions of a second so using the 'time' function for boundaries will
always be '0'.
Is there anything out there that would allow me to track hundredths or
thousandths of a second?
Thanks,
Greg Fields
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 28 May 1999 11:37:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I prevent a CGI timeout?
Message-Id: <MPG.11b882286062c78d989b1e@nntp.hpl.hp.com>
[Posted, but courtesy copy not sent because of munged address.
Rearranged from Jeopardy style, and irrelevant stuff eliminated. Next
time you post, do it properly.]
In article <374EB9CC.459A1632@lucent.com> on Fri, 28 May 1999 10:44:12 -
0500, Burton Kent <burton.not.spam@lucent.com> says...
> Dr Marcus Phillips wrote:
> > How do I prevent a perl CGI from timing out and the browser saying "Document
> > contains no data"? I have a data analysis program which on some of the more
> > complicated analysis slows down sufficiently to give this problem. I try to
> > output data regularly via "print" but this does not seem to work. The
> > process itself continues even after the browser gives up!
>
> If you haven't unbuffered stdout, then the perl
> program will hold onto the output. I think
> the command is $/ = '' or $\=''
I can't be polite about this. It is stupid and rude to post conjectures
in this newsgroup, even if you label them that way.
perlfaq5: "How do I flush/unbuffer an output filehandle? Why must I do
this?" might have helped in this case. (The command *IS* '$| = 1;' --
that is not a conjecture.)
But even this might not help, because some webservers hoard their output
even if the CGI program unbuffers its STDOUT. Marcus Phillips might ask
in one of the CGI newsgroups about 'nph-' (non-parsed header) files,
which push output to the browser immediately.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 28 May 1999 11:00:47 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to exec a program( system() ) in a limited time?
Message-Id: <x3yr9o1xmqo.fsf@tigre.matrox.com>
Otis Gospodnetic <otis@my-deja.com> writes:
> Here is a simple test:
>
> #!/usr/bin/perl
> unless ($childPID = fork) { exec ("sleep 30"); }
> wait;
> print "$childPID\n";
>
> if I run this little script and then try to kill it (not the sleep
> directly, but rather this script), the sleep process doesn't die.
>
> How can one make sure that whatever was started by exec() or system()
> dies when you kill its parent?
>
> I checked perlipc and perdoc -f system and perldoc -f exec
There is a relevant piece of advice in perlipc:
Signal handling is also used for timeouts in Unix, While
safely protected within an eval{} block, you set a signal
handler to trap alarm signals and then schedule to have one
delivered to you in some number of seconds. Then try your
blocking operation, clearing the alarm when it's done but
not before you've exited your eval{} block. If it goes off,
you'll use die() to jump out of the block, much as you might
using longjmp() or throw() in other languages.
Here's an example:
eval {
local $SIG{ALRM} = sub { die "alarm clock restart" };
alarm 10;
flock(FH, 2); # blocking write lock
alarm 0;
};
if ($@ and $@ !~ /alarm clock restart/) { die }
For more complex signal handling, you might see the standard
POSIX module.
You should also checkout the alarm() function as it advises you in
perlfaq8:
How do I timeout a slow event?
HTH,
Ala
------------------------------
Date: Fri, 28 May 1999 20:29:23 +0200
From: "Man from Earth" <mac_@friko2.onet.pl>
Subject: how to give parameters ?
Message-Id: <7imnib$1hl$1@newsfeed.onet.pl>
Hi !
How can i give the parameters from some script on my server to other script
on the other server, which ( script ) can get it only in POST method. And
how to get an answer from that.
Pozdrawienia
Maciek
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 V8 Issue 5818
**************************************