[8818] in Perl-Users-Digest
Perl-Users Digest, Issue: 2435 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 27 22:04:02 1998
Date: Mon, 27 Apr 98 19:00:30 -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 Mon, 27 Apr 1998 Volume: 8 Number: 2435
Today's topics:
Re: "Slurp"? (Martien Verbruggen)
Re: 'each' and recursion, do they mix? (Tom Rokicki)
Re: 'each' and recursion, do they mix? (Tom Rokicki)
Re: Any sock (client/server) module ? (Martien Verbruggen)
Anyone know how to cancel a Perl program? <zisa@onramp.net>
Re: Anyone know how to cancel a Perl program? <sowmaster@juicepigs.com>
Re: Binary Copy under Perl32 (Jeffrey Drumm)
Re: books for learning perl <tchrist@mox.perl.com>
CGI script can't read from a disk file! <jgirard@starnetusa.com>
Re: CGI script can't read from a disk file! (Martien Verbruggen)
Re: cgi-lib.pl or CGI.pm? <dfetter@shell4.ba.best.com>
Re: cgi-lib.pl or CGI.pm? (Martien Verbruggen)
Re: cgi-lib.pl or CGI.pm? (Martien Verbruggen)
Re: convert an @array into a single $variable? <blan0416@uidaho.edu>
Re: Credit Card Verification scripts? (Greg Bacon)
Re: Credit Card Verification scripts? (Martien Verbruggen)
Re: Credit Card Verification scripts? (Abigail)
Re: Defending Perl <zenin@archive.rhps.org>
Re: Defending Perl (Ilya Zakharevich)
Re: Defending Perl (Abigail)
Re: Defending Perl (Jason Gloudon)
Re: Dummie question: EASY !! file copy wanted (Mark-Jason Dominus)
Re: Dummie question: EASY !! file copy wanted (Martien Verbruggen)
How do you make delay program? <seong@cse.bridgeport.edu>
Re: How do you make delay program? <c..bojswbo@12.usenet.us.com>
Re: http Reg Exp (Martien Verbruggen)
Re: http Reg Exp (Abigail)
Re: If you solve this your are FANTASTIC! and it's some (Martien Verbruggen)
Re: Implementing sh in perl <zenin@archive.rhps.org>
Need help with pattern matching... <bth@cs.buffalo.edu>
Re: o-modifier (Martien Verbruggen)
Re: Perl on AS/400 Performance <joat@series2000.com>
Re: PIDs Finding and Killing them from a perl script <vfilipch@cimdev.css.mot.com>
Re: PIDs Finding and Killing them from a perl script (Hemant Shah)
Re: WEIRD PROBLEM IE4 (Martien Verbruggen)
Re: where are the examples in the newer (blue) camel bo <tchrist@mox.perl.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Apr 1998 00:47:31 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: "Slurp"?
Message-Id: <6i38v3$emn$1@comdyn.comdyn.com.au>
In article <ogxnla05.fsf@jimmer.charm.net>,
root <jimmer@charm.net> writes:
root, hmm?
> I vaguely remember seeing a technique once where an entire input file
> is read in with a single command, carriage returns and all. My poor
> memory also seems to think it was called "slurping" the file, but I
> cannot find any reference to it in the camel book, the newsgroup, or
> the FAQ. Is there such a thing. If so, how is it done (and what is
> it really called)?
# perldoc perlop
/I\/O Operators
[snip]
If a <FILEHANDLE> is used in a context that is looking for a
list, a list consisting of all the input lines is returned,
[snip]
# E.G.
open(ZZZ, $file) || die "$!";
@lines = <ZZZ>;
close(ZZZ);
or
# perldoc perlvar
/\$\/
$/ The input record separator, newline by default.
[snip]
undef $/;
$_ = <FH>; # whole file now here
[snip]
# E.G.
open(ZZZ, $file) || die "$!";
local($/) = undef;
$file_contents = <ZZZ>;
close(ZZZ);
# cd /usr/local/lib/perl5/pod
# grep 'whole file' *faq*
perlfaq5.pod:whole file into memory:
perlfaq6.pod:(probably to '' for paragraphs or C<undef> for the whole file) to
perlfaq6.pod: undef $/; # read in whole file, not just one line or paragraph
perlfaq6.pod:Actually, you could do this if you don't mind reading the whole file
# perldoc perlfaq6
(mentions it several times)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 27 Apr 1998 18:12:33 -0700
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Re: 'each' and recursion, do they mix?
Message-Id: <6i3ae1$4kk@cello.hpl.hp.com>
> Did you see my proposal, to allow C<pos HASH>, which could also be an
> lvalue? Reading it returns the current position, which is the key which
> each would next return, but it doesn't advance the iterator. Setting it to
> a non-existant key would be the same as setting it to undef - which sets
> the iterator to end-of-hash. Of course, changing the hash means that all
> bets are off. More details upon request.
I like this. In addition, if we are careful about the hash functions we
use, and the way we grow the underlying vector, and if we keep the keys
in each bucket sorted, then we can even guarantee good behavior in the
presence of changing hashes. I don't believe any of these changes will
have a significant impact on performance.
We can even deal with the case of saving an iterator (by getting the key
through pos()), deleting *that* element, and then `restoring' the iterator,
either by having pos(%hash) = 'now-deleted-key' set the iterator to the
`next' element in the hash (if any), or by having an after(%hash,
'now-deleted-key') function.
Note that when I say `keep the keys in each bucket sorted' we can sort
them lexigraphically or according to a universal, never-shrinking
key hash of some sort or another, or by the `full' (unmasked) hash
value initially and something else secondarily. So the comparisons need
not be problematic.
-tom
------------------------------
Date: 27 Apr 1998 18:20:56 -0700
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Re: 'each' and recursion, do they mix?
Message-Id: <6i3ato$5c5@cello.hpl.hp.com>
> Note that when I say `keep the keys in each bucket sorted' we can sort
> them lexigraphically or according to a universal, never-shrinking
> key hash of some sort or another, or by the `full' (unmasked) hash
> value initially and something else secondarily. So the comparisons need
> not be problematic.
Actually, on thinking about it further, you'd *have* to sort them by the
unmasked hash value in order to deal with the splits and joins. But
I believe everything else I said holds.
The only issue I can think of that might hurt is if on some platform a
variable shift is significantly more expensive then a logical and.
But this is a real nit.
Oh, and the hash function would have to be careful to put the bits that
change for small strings up in the upper bits rather than the lower
bits in order to get a good distribution.
-tom
------------------------------
Date: 28 Apr 1998 00:34:23 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Any sock (client/server) module ?
Message-Id: <6i386f$eip$2@comdyn.comdyn.com.au>
In article <6i1b06$f2o$1@nnrp1.dejanews.com>,
andrewl@tnl.com.au writes:
> Hi,
> Is there a simple way to write simple client/server sock perl script ?
> Like tcp/dp.
Some pre-made modules:
Socket
or
Net::TCP
Net::TCP::Server
get them from CPAN, if they aren't installed already:
http://www.perl.com/CPAN/
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Mon, 27 Apr 1998 19:19:42 -0600
From: Zisa <zisa@onramp.net>
Subject: Anyone know how to cancel a Perl program?
Message-Id: <35452EA3.FD662BB0@onramp.net>
I am very new at Perl and when I make a program (like the password
program in the Llama book)
I have no way of stopping the program without finishing it.
Is there a command or escape code for interrupting a running script?
------------------------------
Date: Mon, 27 Apr 1998 21:51:55 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: zisa@ns.onramp.net
Subject: Re: Anyone know how to cancel a Perl program?
Message-Id: <3545363A.1E24@juicepigs.com>
Zisa wrote:
>
> I am very new at Perl and when I make a program (like the password
> program in the Llama book)
> I have no way of stopping the program without finishing it.
>
> Is there a command or escape code for interrupting a running script?
^C
or in windowspeak "Hold down the Ctrl key and press the letter c"
I don't know the MAC equivalent.
--
Bob Trieger | Titanic: big boat, bigger
sowmaster@juicepigs.com | iceberg, big deal
------------------------------
Date: Tue, 28 Apr 1998 01:02:09 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Binary Copy under Perl32
Message-Id: <35472a85.7151567@news.mmc.org>
[posted and mailed]
On Mon, 27 Apr 1998 17:43:31 GMT, Tom Phoenix <rootbeer@teleport.com>
wrote:
>On Mon, 27 Apr 1998, Steffen Geschke wrote:
>
>> Unfortuntely, perl converst LF and other control symbols like
>> 0A -> 0D 0A
>> 1A -> EOF
>
>Perl doesn't, your system does. Use a module to copy files, or check out
>binmode in perlfunc. Or both! :-)
Uh huh, so . . . in what way does binmode() change the way my _system_
functions?
I could've sworn it changed the way _Perl_ functions . . . on my (everybody
together now, with feeling . . . "sadly broken excuse for a") system. :-)
In my sometimes-not-humble-enough opinion, how Perl handles file output
seems the exception rather than the rule for the languages available on the
'doze platforms . . . i.e. if you write a line feed character to a file
from <insert language of choice here, with the unfortunate exception of
Perl> you get a line feed character, and only a line feed character, in the
resulting file. With Perl, you get a line feed and a carriage return . . .
unless, of course, you use binmode() to disable Perl's built-in EOL
translation.
Note, though, that my comments are based only on empirical evidence, and no
specific knowledge of what happens behind the curtain . . . it could very
well be Microsoft converting all those LFs to CRLFs (but I doubt it).
If I'm wrong, please show me where logic has failed me (besides the obvious
of appearing to "stick up" for Microsoft . . . <shudder>). :-)
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center Information Services
420 Cumberland Ave, Portland, ME 04101
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me
------------------------------
Date: 28 Apr 1998 01:00:08 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: books for learning perl
Message-Id: <6i39mo$3mr$1@csnews.cs.colorado.edu>
:Refer to your topic, my friend.... Learning Perl, from O'Reilly, by
:Randall Schwartz, is the book to get. You'll not find better.
Er, that's not his name -- it's Randal.
And I'm co-author, you know. :-)
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
/* Force them to make up their mind on "@foo". */
--Larry Wall, from toke.c in the v5.0 perl distribution
------------------------------
Date: Mon, 27 Apr 1998 20:10:27 -0500
From: Jason <jgirard@starnetusa.com>
Subject: CGI script can't read from a disk file!
Message-Id: <35452C83.4CB8DA3@starnetusa.com>
This is a problem I can't figure out for the life of me!
In a directory /www/files I have the file "count" with permissions 666.
In /www/cgi-bin is the script counter.cgi with permissions 755 which is
supposed to open the file "count" and grab its contents.
In Apache, I have directory access set to "allow from all" for both
directories. ExecCGI is set for /www/cgi-bin. Apache is running as
Nobody, -1
With Apache running, I call the script from Netscape and get the
following:
"can't open file for reading! You are person to visit this page."
However, when I run in off-line mode, I get the correct result:
<html><head><title>Counter test</title></head><body bgcolor="white">You
are person
<img src="http://me.this.domain/files/1.gif"><img
src="http://me.this.domain/files/5.gif">
<img src="http://me.this.domain/files/1.gif"> to visit this
page.</BODY></HTML>
The line of code in question is:
open(COUNT_FILE,"/www/files/count") || print " can't open file for
reading! ";
Other CGI scripts that don't open files seem to work just fine.
Did I configure something wrong with CGI or with Apache?
Thanks in advance,
Jason
------------------------------
Date: 28 Apr 1998 01:27:55 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: CGI script can't read from a disk file!
Message-Id: <6i3bar$et4$1@comdyn.comdyn.com.au>
In article <35452C83.4CB8DA3@starnetusa.com>,
Jason <jgirard@starnetusa.com> writes:
> This is a problem I can't figure out for the life of me!
>
> In a directory /www/files I have the file "count" with permissions 666.
> In /www/cgi-bin is the script counter.cgi with permissions 755 which is
> supposed to open the file "count" and grab its contents.
> In Apache, I have directory access set to "allow from all" for both
> directories. ExecCGI is set for /www/cgi-bin. Apache is running as
> Nobody, -1
Check
http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.com/CPAN/doc/FAQs/cgi/perl-cgi-faq.html
(what about the directory permissions?)
> The line of code in question is:
> open(COUNT_FILE,"/www/files/count") || print " can't open file for
> reading! ";
You should use the $! variable to get a bit more information.
> Other CGI scripts that don't open files seem to work just fine.
>
> Did I configure something wrong with CGI or with Apache?
Who knows? Apache might chroot(), so the files might not be where you
think they are. You might have permission problems. The abovementioned
documents might help you solve it.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 00:46:30 GMT
From: David Fetter <dfetter@shell4.ba.best.com>
Subject: Re: cgi-lib.pl or CGI.pm?
Message-Id: <6i38t7$a81$1@nntp1.ba.best.com>
Yong Huang <yong@shell.com> wrote:
> Is there any compelling reason to use CGI.pm instead of the "old" and
> "glorified" cgi-lib.pl? I'm used to and have become very familiar with
> cgi-lib.pl. Since I don't have too much experience in OO Perl, CGI.pm or
> even CGI_Lite.pm seems to be more difficult than cgi-lib.pl to use. But
> if somebody can tell me using CGI.pm has performance advantage, for
> example, I'll definitely switch. I also would like to know the advantage
> of using references (OO Perl sort of things) over traditional Perl.
> Thanks for any advice.
> Yong Huang
> Email:yong@shell.com
--
David Fetter 888 O'Farrell Street Apt E1205
shackle@ren.glaci.com San Francisco, CA 94109-7089 USA
http://www.best.com/~dfetter +1 415 567 2690 (voice)
print unpack ("u*",q+92G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R"@``+)
"What our children need more than to learn to read and write and add and
subtract is to know Jesus Christ."
Ralph Reed,
Executive Director, Christian Coalition
showing his true colors on May 11, 1997
------------------------------
Date: 28 Apr 1998 01:13:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: cgi-lib.pl or CGI.pm?
Message-Id: <6i3ag6$emn$5@comdyn.comdyn.com.au>
In article <6i38t7$a81$1@nntp1.ba.best.com>,
David Fetter <dfetter@shell4.ba.best.com> writes:
> Yong Huang <yong@shell.com> wrote:
[snip]
We knew that. What do you have to say, except a 10 line signature? :)
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 01:11:10 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: cgi-lib.pl or CGI.pm?
Message-Id: <6i3abe$emn$4@comdyn.comdyn.com.au>
In article <35450C16.77FDFAE5@shell.com>,
Yong Huang <yong@shell.com> writes:
> Is there any compelling reason to use CGI.pm instead of the "old" and
> "glorified" cgi-lib.pl? I'm used to and have become very familiar with
> cgi-lib.pl. Since I don't have too much experience in OO Perl, CGI.pm or
> even CGI_Lite.pm seems to be more difficult than cgi-lib.pl to use. But
> if somebody can tell me using CGI.pm has performance advantage, for
> example, I'll definitely switch. I also would like to know the advantage
> of using references (OO Perl sort of things) over traditional Perl.
> Thanks for any advice.
CGI.pm is much more reliable. CGI.pm is still supported. CGI.pm comes
with the standard distribution of perl. CGI.pm can do a lot more
things than cgi-lib.pl.
And... The documentation for CGI comes with a section called
'COMPATIBILITY WITH CGI-LIB.PL'. This makes it incredibly easy to port
your old cgi-lib.pl cra^H^H^Hscripts to CGI.pm.
There is simply no excuse to write anything new in cgi-lib.pl
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Mon, 27 Apr 1998 18:36:34 -0700
From: Derek Blandford <blan0416@uidaho.edu>
Subject: Re: convert an @array into a single $variable?
Message-Id: <354532A2.C39A5E7E@uidaho.edu>
> > Hi, does any one know how to take the seperate elements of an
> > array an pass them all as a string into a single variable?
> > Thanks in advance.
> > Bryan H
>
> Yes. ;-)
> --
> Brad Baxter, UGA
>
> ps: 'join' is one answer.
Is this really a question needed to be asked to a perl news group? How
many perl tutorials can be found at the www.perl.com site??? How many
other perl tutorials can be found elsewhere on the web? Hmmmff.
------------------------------
Date: 28 Apr 1998 00:34:51 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Credit Card Verification scripts?
Message-Id: <6i387b$e8a$2@info.uah.edu>
In article <35451584.3DB50@onramp.net>,
Zisa <zisa@onramp.net> writes:
: I am doing a webpage for a person down the street and she wants Credit
: card Verication Script that will process her orders. I unfortunately do
: not know how to do this.
Post the credit card numbers to comp.lang.perl.misc. This is an
acceptable thing to do if you munge your return address since ``the
bad guys'' will see your fake email address and think someone's just
making a joke. It's a little known fact that this newsgroup is a
free credit card number validation service! Why pay someone when you
can get it for free?
Hope this helps,
Greg
--
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF
------------------------------
Date: 28 Apr 1998 01:06:18 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Credit Card Verification scripts?
Message-Id: <6i3a2a$emn$3@comdyn.comdyn.com.au>
In article <35451584.3DB50@onramp.net>,
Zisa <zisa@onramp.net> writes:
> I'm new at all Perl and at disscussion groups.
>
> I am doing a webpage for a person down the street and she wants Credit
> card Verication Script that will process her orders. I unfortunately do
> not know how to do this.
>
> I am in the Llama book and am in chapter1. I would appreciate any tips,
> pointers, or scripts that do this stuff.
A very important pointer (write it down, and never forget it): If you
want to know if someone has written something you might be able to
use, you check CPAN.
http://www.perl.com/CPAN/
http://www.perl.com/CPAN/modules/00modlist.long.html
(Look for Business::CreditCard. I can't tell you how well this module
does it's work. It can only check the validity of the number, not
anything else. If you actually want to transfer money etc, I'd get in
touch with someone who already does that, and hire their services.)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 01:50:46 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Credit Card Verification scripts?
Message-Id: <6i3clm$jmp$3@client3.news.psi.net>
Zisa (zisa@onramp.net) wrote on MDCC September MCMXCIII in
<URL: news:35451584.3DB50@onramp.net>:
++ I'm new at all Perl and at disscussion groups.
++
++ I am doing a webpage for a person down the street and she wants Credit
++ card Verication Script that will process her orders. I unfortunately do
++ not know how to do this.
++
++ I am in the Llama book and am in chapter1. I would appreciate any tips,
++ pointers, or scripts that do this stuff.
Maybe the best advice is: if you're new, don't do things like
dealing with credit card numbers.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 28 Apr 1998 00:58:05 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Defending Perl
Message-Id: <893725518.611954@thrush.omix.com>
Abigail <abigail@fnx.com> wrote:
>snip<
: Uhm, uhm, I find perl one of the hardest things to install.
...Uhm, uhm, what's so hard about:
sh Configure
make
make install
??? On many systems it's even simpler.
FreeBSD:
cd /usr/ports/lang/perl5
make install
: I'd rather install gcc -- much simpler.
You can't have ever installed anything but a prebuilt binary package
of GCC and meen that.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: 28 Apr 1998 01:38:48 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Defending Perl
Message-Id: <6i3bv8$86g$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Abigail
<abigail@fnx.com>],
who wrote in article <6i3boi$jmp$2@client3.news.psi.net>:
> ++ > Uhm, uhm, I find perl one of the hardest things to install.
> ++ > I'd rather install gcc -- much simpler.
> ++
> ++ what's so hard about
> ++ ./configure
> ++ make
> ++ make install
> ++
> ++ ????
>
> Because the questions are quite confusing, and uhm, in an illogical
> order.
What questions? You get no stinking questions... Did you try it?
Ilya
------------------------------
Date: 28 Apr 1998 01:35:14 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Defending Perl
Message-Id: <6i3boi$jmp$2@client3.news.psi.net>
Jon Drukman (jsd@gamespot.com) wrote on MDCC September MCMXCIII in
<URL: news:3545056C.ACE44E9D@gamespot.com>:
++ Abigail wrote:
++ > Uhm, uhm, I find perl one of the hardest things to install.
++ > I'd rather install gcc -- much simpler.
++
++ what's so hard about
++ ./configure
++ make
++ make install
++
++ ????
Because the questions are quite confusing, and uhm, in an illogical
order.
++ that's all i've ever needed to do to install perl.
++ gcc on the other hand is pretty tough. particularly if you don't have
++ an older version of gcc handy already.
Installing gcc is easy. You just follow the manual. You don't get
questions which makes you wondering "what the f*ck is it asking me?"
Abigail
--
perl -pwle '$_ .= reverse'
------------------------------
Date: Tue, 28 Apr 1998 01:46:56 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Defending Perl
Message-Id: <slrn6kad77.jrt.jgloudon@hyssop.bbn.com>
Abigail <abigail@fnx.com> wrote:
.
>Installing gcc is easy. You just follow the manual. You don't get
>questions which makes you wondering "what the f*ck is it asking me?"
I think the real problem is that the instructions about 'Configure -des' occur
too far into the INSTALL file. This of course is only a problem if you don't
read all of INSTALL.
--
Jason Gloudon
------------------------------
Date: 27 Apr 1998 20:07:44 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Dummie question: EASY !! file copy wanted
Message-Id: <6i36kg$jlu$1@monet.op.net>
Keywords: comet emulate hansom solve
In article <6sgJ8gq-ZZB@wharp.rhein-main.de>,
Michael Haertfelder <haert@wharp.rhein-main.de> wrote:
>while(<OLD>) {
> print NEW $_; }
>
>
>but I feel that there is another easier (shorter) way to do that.
Shorter than two lines? You don't ask for much, do you?
All right.
print NEW while <OLD>;
Happy?
No?
print N <O>;
Happy now?
------------------------------
Date: 28 Apr 1998 01:02:25 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Dummie question: EASY !! file copy wanted
Message-Id: <6i39r1$emn$2@comdyn.comdyn.com.au>
In article <6sgJ8gq-ZZB@wharp.rhein-main.de>,
haert@wharp.rhein-main.de (Michael Haertfelder) writes:
> Well, I could copy a file in perl like this:
>
> while(<OLD>) {
> print NEW $_; }
>
>
> but I feel that there is another easier (shorter) way to do that.
> Any suggestions ?
This already is pretty short, but you left out the required opens,
closes, and tests to see if things succeeded.
Maybe what you really want is
use File::Copy;
copy("file1", "file2");
(Previous discussion on this list seemed to indicate a few problems
with this module. Check dejanews to see what they were, and for
possible solutions.)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Mon, 27 Apr 1998 21:39:59 -0400
From: "Seong Y. Kim" <seong@cse.bridgeport.edu>
Subject: How do you make delay program?
Message-Id: <3545336F.5A50@cse.bridgeport.edu>
This would delay my program for a while
for ($a=0; $a<100000;$a++){;}
Does anyone know how to make delay without running loops?
Is there any delay modules or subroutines like delay(10000) in C
language?
------------------------------
Date: 28 Apr 1998 01:54:10 GMT
From: Anirvan Chatterjee <c..bojswbo@12.usenet.us.com>
Subject: Re: How do you make delay program?
Message-Id: <6i3cs2$f24$1@samba.rahul.net>
In comp.lang.perl.misc Seong Y. Kim <seong@cse.bridgeport.edu> wrote:
> Does anyone know how to make delay without running loops?
> Is there any delay modules or subroutines like delay(10000) in C
> language?
sleep?
_____________________________________________________________________
Anirvan Chatterjee . anirvan @ chatterjee.net . PGP 2048/0xE2D13BA9
Fast & free new/used multi-bookstore searching @ http://www.mxbf.com/
------------------------------
Date: 27 Apr 1998 23:44:40 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: http Reg Exp
Message-Id: <6i3598$ec7$1@comdyn.comdyn.com.au>
In article <1d83bnv.l44l1a12bskbtN@slip-32-100-246-191.ny.us.ibm.net>,
kpreid@ibm.net (Kevin Reid) writes:
> Chris Lambrou <archive@cglis.com> wrote:
>
> $msg =~ s!(ftp|https?)://([^\s]*[^\s>,])!<a href="$1://$2">$1://$2<\/a>!gsi;
> ^^^^^^^^
> difference here
You;d also need to exclude characters like '.;:!?' And other
punctuation characters to satisfy the original problem.
> As someone else pointed out, commas and >s are legal in a URL, but they are
> not likely to occur at the end of the URL.
Maybe not, but what about this URL with a ',' and some '.'s in the middle
http://www.somewhere.com/cgi-bin/bla?important_valu=aa..bb,,cc
Your regexp would change the URL value to
http://www.somewhere.com/cgi-bin/bla?important_valu=aa..bb
discarding the ',,cc'
It's not a question of commas being likely to appear at the end of a
URL, but of them appearing in a URL at all. Now, I know that it's not
likely, but a lot of Altavista stuff and banner advertising stuff
works with very oddly shaped URLs, for example.
What about URLs that have usercode/password information in them? What
about port qualifiers, which are denoted by a ':', which also should
be excluded? What about URLs with a '.', of which there are many
(think of any file with an 'extension', which directories also can
have).
Really, you can't do it reliably. The problem will always be that you
cannot exclude certain characters, because they are part of a large
number of real URLs, and these same characters also will show up as
the punctuation characters the original poster wants to exclude. Most
notably the full stop (.) and the colon (:), even if the comma (,)
might be far fetched.
My site list, to be parsed:
http://www.perl.com/: Perl stuff
http://www.perlie.com:8080/: More perl stuff
http://www.perl.com/, http://www.perlie.com/cgi/aa?a=b,d,s
http://www.perl.com/.
How do you parse the above?
The best thing you can probably do is come up with some confirmation
system, once you encounter a URL that you cannot be certain of..
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 01:55:12 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: http Reg Exp
Message-Id: <6i3cu0$jmp$4@client3.news.psi.net>
Martien Verbruggen (mgjv@comdyn.com.au) wrote on MDCC September MCMXCIII
in <URL: news:6i3598$ec7$1@comdyn.comdyn.com.au>:
++ In article <1d83bnv.l44l1a12bskbtN@slip-32-100-246-191.ny.us.ibm.net>,
++ kpreid@ibm.net (Kevin Reid) writes:
++ > Chris Lambrou <archive@cglis.com> wrote:
++ >
++
++ > $msg =~ s!(ftp|https?)://([^\s]*[^\s>,])!<a href="$1://$2">$1://$2<\/a>!gsi;
++ > ^^^^^^^^
++ > difference here
++
++
++ Really, you can't do it reliably.
Bullshit.
RFC translates easily into a regex.
See <URL:http://cthulhu.mandrake.net/%7Eabigail/Perl/url2.pl>
Abigail
--
perl -wle '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_ ++'
------------------------------
Date: 28 Apr 1998 00:01:06 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: If you solve this your are FANTASTIC! and it's something real simple (I think)
Message-Id: <6i3682$ee7$1@comdyn.comdyn.com.au>
In article <6i1gmh$nlc$1@nnrp1.dejanews.com>,
stevenf@pcdynamics.nl writes:
> I everyone!
>
> Check out the HTML code.
Check out the following information on how to choose a good subject
line:
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
[Snip of unnecessary HTML stuff]
> What I want it to do is, that it has to pas on the variables to the perl/cgi
> program.
use CGI
> So that it will make a new HTML page with the picture and some text.
use CGI
> If you could give me a very small example of how the perl program should look
> like I will be very graitfull!
CGI.pm comes with the standard distribution of perl. You can get to
the documentation with:
# perldoc CGI
If you have an older version of perl, you should upgrade. If you
can't, you can download CGI from CPAN (http://www.perl.com/CPAN/)
> If you can help me could you please send it to my email address because I
> can't read the newsgroup from my PC at work!
That really is a very poor excuse. You can post to this group, so you
should be willing to read it. You can read it from anywhere with
Internet access on www.dejanews.com.
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/ Now offering spam-free web-based newsreading
Ah, so you knew? Are you saying that you can't access the Internet
from work? I wonder how you get perl there, and how up to date it is.
I guess you'll just have to read it at home.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 01:09:51 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Implementing sh in perl
Message-Id: <893726461.19823@thrush.omix.com>
Jonathan Stott <jstott+usenet@poly.phys.cwru.edu> wrote:
: In article <Pine.GSO.3.96.980425190915.18328A-100000@area51>, David Lee Lambert <lamber45@EGR.msu.edu> wrote:
>snip<
: > Is there some reason why this cannot be done in
: >perl?
: Quite possibly.
Sorry, you're wrong. It would be no harder then sh in C, if not
easier.
: Check perlfunc(1) a bit more closely. In particular,
: look at how Perl handles calls to exec() and open() with shell
: meta-characters in the argument.
Not a problem, just use sysopen() and multi-argument calls to
exec(). Do all the globing/redirection yourself (which is
basically the bulk of work that shells do anyway). An sh
style token parser shouldn't be too hard, and would be easier
in Perl then C.
Globing could be a problem. If there isn't already a module in
Perl available you can write your own in Perl or just wrap the
glob(3) C function (probably a better idea).
I'd recommend reading through the sh source and getting a copy
of the POSIX spec.
Since you're considering a Perl only system, you also have the
advantage of making programs like awk/sed/grep as builtins to
gain speed.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Mon, 27 Apr 1998 21:08:28 -0400
From: Bryan T Hoch <bth@cs.buffalo.edu>
Subject: Need help with pattern matching...
Message-Id: <Pine.GSO.3.96.980427205810.22093A-100000@gagarin.cs.Buffalo.EDU>
I need to manipulate an input string a little bit, but I am unsure how to
do so.
I have a variable $string which contains a series of inputs from a file
that was read in.
The $string contains a bunch of lines (each line is terminated by a ; and
a \n) and each line has its variables seperated by commas.
Here is a sample of what $string contains:
cs113,intro into comp,1,NSM225,(none),cs513;
cs114,oop,16,NSM225,(mac),cs514;
What I want to do is read each line seperately (one at a time) into a
subroutine that will check to see what the 4th value is (in the case of
the first line it would check to see if it matched "NSM225"). Then I want
to do the next line and keep going until the end of the $string is
reached.
Could anyone be of help?
Thank you in advance...
Bryan H
------------------------------
Date: 28 Apr 1998 00:30:47 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: o-modifier
Message-Id: <6i37vn$eip$1@comdyn.comdyn.com.au>
In article <01bd71b9$2578bcc0$c82da8c0@robban.ittek.org>,
"Robert Friberg" <robban@it-konsult.com> writes:
>
> Hi,
>
> The following piece of code is run at worst case 80000 times, therefore
> I'm interested in having the regexp compiled only once. The @words
> array is assigned only once but $#words varies.
>
> for $w (@words){
> $failed++ and last unless /$w/i;
I don't think I would write it like this :) Besides, this increments
$failed even on a match. Is that what you want?
> }
This check for the presence of the word $w in $_ and jumps out of the
loop when it finds it. It only finds the first matching word, which
leads me to think:
If this is really what you need to do, then I can't think of anything
more effective off-hand. If however, you don't need to check for the
presence of a word, but you really just need to check if they're
equal, the eq operator will be a lot faster. In that case, you can
even revert the problem, and look for $_ in @words, which will be a
lot faster (using grep, or a hash).
If this is really what you need, then forgive my rambling.
> I could put a limit to the number of words allowed and loop that
> many times with explicit adressing but it feels definitly wrong:
>
> for ($i=0; $i < 5 and $i < $#words; $i++) {
> if ($i==0) { /$words[0]/io }
> elsif ($i==1) { /$words[1]/io }
> elsif ($i==2) { /$words[2]/io }
> elsif ($i==3) { /$words[3]/io }
> elsif ($i==4) { /$words[4]/io }
> else { $failed++; last }
> }
It would be. You would only loop 5 times, and I thought you needed to
loop through all. If you don't then you might need to rethink your
design.
It doesn't only feel wrong, it is certainly not the same as above.
> Question #2
>
> Is there a more perlish equivalent of the following?
>
> $d{'max'} = $maxhits if $d{'max'} > $maxhits;
not really. There are other ways of doing it, but nothing much more
perlish.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Mon, 27 Apr 1998 21:29:43 -0400
From: Tim Kramer <joat@series2000.com>
To: Les Woolsey <lwoolsey@innovative.ca>
Subject: Re: Perl on AS/400 Performance
Message-Id: <35453106.10F02099@series2000.com>
The problem might not be with the Perl interpreter. You might be experiencing
a problem with insufficient resources being devoted to the environment. See
your SysAdmin.
Les Woolsey wrote:
> I have a working Perl script that runs nice and quickly on Windows NT but on
> an AS400 it crawls. The script puts out messages every so often and it runs
> for a while then stops for 20 or 30 seconds then starts on again.
>
> Anybody have any experience with Perl on an AS400 & any suggestions on
> what's happenning.
>
> Les
------------------------------
Date: Mon, 27 Apr 1998 19:13:45 -0500
From: Valeriy Filipchuk <vfilipch@cimdev.css.mot.com>
To: Michael Shavel <mshavel@erols.com>
Subject: Re: PIDs Finding and Killing them from a perl script
Message-Id: <35451F39.2781@cimdev.css.mot.com>
Michael Shavel wrote:
> 2. If the answer to #1 is no, is there a way for me to get the PID's of the
> children that are spawned? (I tried using ps -ef |grep and then parsed
> out the PID from the string returned but this seems error prone and not
> exact)
> I would very much appreciate any help and/or suggestions. I have tried
> every way I can think of, I'm just about out of ideas.
>
> Thanks
>
> Mike Shavel
> mshavel@erols.com
I am using the folowing orphan_killer script to kill any orphans in the system:
#!/usr/bin/ksh
orphans=`ps -ef | grep " 1 " | grep -v root | grep -v "no_need_2kill" | grep -v grep | cut -c10-15`
for orphan in $orphans
do
echo "Shooting at $orphan"
kill -9 $orphan
echo "Got 'em"
done
~
"no_need_2kill" - some processe(s) that should stay alive.
Of course, you should be a root to execute it.
--
Valeriy Filipchuk
* vfilipch@cimdev.css.mot.com *
* PHONE: (847)523-5743 *
* PAGER#: (800)759-8888 *
* PIN# 119-6233 *
------------------------------
Date: 28 Apr 1998 00:36:14 GMT
From: shah@typhoon.xnet.com (Hemant Shah)
Subject: Re: PIDs Finding and Killing them from a perl script
Message-Id: <6i389u$ghj$1@flood.xnet.com>
While stranded on information super highway Valeriy Filipchuk wrote:
:)Michael Shavel wrote:
:)
:)> 2. If the answer to #1 is no, is there a way for me to get the PID's of the
:)> children that are spawned? (I tried using ps -ef |grep and then parsed
:)> out the PID from the string returned but this seems error prone and not
:)> exact)
:)> I would very much appreciate any help and/or suggestions. I have tried
:)> every way I can think of, I'm just about out of ideas.
:)>
:)> Thanks
:)>
:)> Mike Shavel
:)> mshavel@erols.com
:)
:)I am using the folowing orphan_killer script to kill any orphans in the system:
You can serach ftp site and look for "pstree"
script deleted.
:)--
:)Valeriy Filipchuk
:)
:)* vfilipch@cimdev.css.mot.com *
:)* PHONE: (847)523-5743 *
:)* PAGER#: (800)759-8888 *
:)* PIN# 119-6233 *
--
Hemant Shah, LIDP Inc. /-------------------\ ^~~~~^
Voice: +1 630 960 0133 x 664 |TECHNOLOGY | | |
Fax: +1 630 960 0717 |No place for wimps | o|-OO-|o
E-mail: shah@xnet.com | -Dilbert |--- | () |
\-------------------/ | |
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
------------------------------
Date: 28 Apr 1998 00:02:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: WEIRD PROBLEM IE4
Message-Id: <6i36ao$ee7$2@comdyn.comdyn.com.au>
In article <01bd71bb$ed547480$a44a6dc2@earl.esense.nl>,
"Mathijs Oosterom" <thijs@esense.nl> writes:
> This is all working fine, in all Netscape-versions as well as in Explorer
> 3. But in Explorer 4 it just doesn't work!!! How is this possible. I know
> Bill doesn't like me, but this is going too far :)).
Then this is not a perl problem, but a problem with IE4 (what else is
new?). Go to one of the groups that talks about browsers, and ask
there.
Martien
PS. Why did you even THINK that it was a perl problem?
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Apr 1998 01:09:31 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: where are the examples in the newer (blue) camel book?
Message-Id: <6i3a8b$50u$1@csnews.cs.colorado.edu>
Randal pumps himself:
>As I was shepherding the new Camel through the final months of writing
>(as lead writer), I had to make some tradeoffs given the limited
>resources we had.
Funny, I would have bet money that Larry was lead writer on the
Camel. And you know something? I bet he would, too.
Larry's name isn't first on the author list out of some sense of
misplaced vanity. It's because he did the most work, and also had
ultimate editorial control.
Please give him due credit next time.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
sv_magic(sv, Nullsv, 'B', Nullch, 0); /* deep magic */
--Larry Wall, from util.c in the v5.0 perl distribution
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 2435
**************************************