[19675] in Perl-Users-Digest
Perl-Users Digest, Issue: 1870 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 4 11:05:50 2001
Date: Thu, 4 Oct 2001 08:05:10 -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: <1002207910-v10-i1870@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 4 Oct 2001 Volume: 10 Number: 1870
Today's topics:
Re: 2 newlines after Headerlines in HTTP? <Rainer.Klier@erl.sbs.de>
2nd request pls-Embed sound to cgi? <casey1@adelphia.net>
Re: Accurate timing <bart.lateur@skynet.be>
Re: building perl - installing modules in Win32 <bart.lateur@skynet.be>
Re: Can't unlink file under Perl for NT <bart.lateur@skynet.be>
Re: Efficient code? <joe+usenet@sunstarsys.com>
Re: Efficient code? <echang@netstorm.net>
Embedding Problem Win32 (Thomas Stammeier)
escape character for a space <magrav@wnt.sas.com>
get "REMOTE_ADDR" with perl.. <gis88559@ultra2.cis.nctu.edu.tw>
help this newbie please - server error <gethinc@hotmail.com>
Help With Network (Sebastian)
Re: Help <mjcarman@home.com>
How make install pkg <pmishra@mailcity.com>
Re: How make install pkg <mjcarman@home.com>
How to install a module without AD privilege?? (smax)
Re: How to install a module without AD privilege?? (Anno Siegel)
Re: How to install a module without AD privilege?? nobull@mail.com
Re: Is Perl for CGI going the way of the dodo? (Tim Hammerquist)
Re: Is Perl for CGI going the way of the dodo? (Richard)
Re: Is Perl for CGI going the way of the dodo? <thurbermingus1@netscape.net>
Re: Is Perl for CGI going the way of the dodo? <nobody@nowhere.com>
Re: Is Perl for CGI going the way of the dodo? <nobody@nowhere.com>
Re: parallel http-requests with LWP::Parallel <mr.thanquol@gmx.de>
Re: parallel http-requests with LWP::Parallel <mr.thanquol@gmx.de>
Re: Perl 5.6.0 bug: best workaround? <newspost@coppit.org>
pervent multiple instances of a server (perl misk)
Re: pervent multiple instances of a server <Thomas@Baetzler.de>
Positive lookbehind with variable length? (Markus Dehmann)
Re: Skipping following lines if the same (Bernard El-Hagin)
Re: Skipping following lines if the same (Anno Siegel)
Re: Skipping following lines if the same <Thomas@Baetzler.de>
Re: Skipping following lines if the same <hafner@augusta.de>
Re: Skipping following lines if the same <JPFauvelle@Colt-Telecom.fr>
Re: Template-Toolkit <bart.lateur@skynet.be>
Re: Whither Palm Perl? <bart.lateur@skynet.be>
Re: Why does if statement not work ? (Mark Taylor)
Re: Why does if statement not work ? <bart.lateur@skynet.be>
Re: XS Question (Anno Siegel)
Re: Yet another fork question <djberge@qwest.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 04 Oct 2001 11:38:08 -0100
From: Rainer Klier <Rainer.Klier@erl.sbs.de>
Subject: Re: 2 newlines after Headerlines in HTTP?
Message-Id: <3BBC5830.A322A1B4@erl.sbs.de>
Rafael Garcia-Suarez wrote:
>
> Rainer Klier wrote in comp.lang.perl.misc:
> }
> } to make visible, what a browser sends to a webserver,
> } I coded this tiny webserver, that shall bounce the
> } Requestheader back to the Browser.
> } Interesstingly it says, that the browser sent
> } 2 newlines after the headerrequest. RFC 2616 says,
> } there should be one newline. Did I miss something?
>
> Yes, there's an empty line for the body of the request sent by the
> browser. Have you tried with a POST instead of a GET?
This is it. Thanx. Of course I meant 2 black lines
instead of newlines.
Rainer
------------------------------
Date: Thu, 04 Oct 2001 14:29:22 GMT
From: christo <casey1@adelphia.net>
Subject: 2nd request pls-Embed sound to cgi?
Message-Id: <0gsortsf8mfenjkommmotm1smto9gsh8eb@4ax.com>
I have a free chat cgi script im running and would like to know if a
beep sound can be embeded somehow to advise me when someone logs in to
the chat room. any help would be appreciated.
It is running on my machine that is logged in to the chat room. I have
access to the server that is using the cgi script. Im not clear at all
regarding a strategically placed 'system( "start whatever.wav" )'
Again the URL is http://www.crystalservice.com/help/bluechat.cgi
What im trying to accomplish is the same principal that is selling
for $200 at http://www.realtimeaide.com/home.htm
Another words when someone logs in the admistrator is chimed to advise
that somone has logged in. I hope this additional info helps.
thanks for taking your valuable time to consider this.
------------------------------
Date: Thu, 04 Oct 2001 14:21:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Accurate timing
Message-Id: <v0sort4t1j8td4p63lbjadmbjcgdg9hvfg@4ax.com>
Neb wrote:
>I have a script that I want to calculate its total running time from start
>to finish. It takes less than a second to run, so I can't use the time()
>function to calcule it. Is there a way to get milliseconds?
Use the Benchmark module. Er... that's only up to hunderds of a second,
IIRC. Or use the Time::HiRes module.
--
Bart.
------------------------------
Date: Thu, 04 Oct 2001 14:18:25 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: building perl - installing modules in Win32
Message-Id: <gerortc1jge3fe4190mbid1hcdhb3pv0o9@4ax.com>
Hessu wrote:
>1) ok, I need a compiler but have it to be VC++?
>(cannot afford it!)
>Can I use Borland's free stuff or what comes
>with Cygwin!?
Only if your perl executable is compiled with the same compiler. The
extension modules (DLL's) and EXE file must be able to interconnect
without wflaw, which means that they have to be binary compatible. Note
that Activestate's modules compiled for perl 5.005 cannot work with
Activestate's perl 5.6, even though both are compiled with the same
compiler...
So, if you want to use another compiler, start with building perl from
the source. Good luck. ;-) Oh, yeah: there's an introduction manual on
how to do this on Activestate's site.
<http://aspn.activestate.com//ASPN/Reference/Products/ActivePerl/lib/Pod/perlwin32.html>
There's a separate document for Cygwin.
<http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/lib/Pod/perlcygwin.html>
>2) I downloaded ActiveState, in Installer.bat
>there several instances of string "ActivePerl\Perl\"
>i guess it means "c:\ActivePerl\Perl\"
>can I replace them with "MyDir\Perl\" (meaning "c:\MyDir\Perl\")?
I guess so. Take care to avoid spaces in your path.
>-and what is "ActivePerl\Perl\bin\perl" then? A mistyping?!
That is perl.exe which resides in the directory "bin" in the
distribution file tree located at "ActivePerl\Perl".
--
Bart.
------------------------------
Date: Thu, 04 Oct 2001 12:34:44 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Can't unlink file under Perl for NT
Message-Id: <rklortsmoatq4a40lun2rgqikcfd5fhpqj@4ax.com>
Glenn wrote:
>The following worked...
>
> @list= glob ("e:/somedir/testfile.*");
> $numdeleted=unlink @list;
>
>Thanks to all for your help!
and in another post:
>> $numdeleted = unlink glob('e:/somedir/testfile.*');
>
>Just tried that -- interesting result... each time I execute the script,
>it deletes 1 file, until they're all gone.
That is strange. If it is indeed the case, and why shouldn't it be ;-),
it looks to me as unlink() gives the wrong context to glob()? Because
glob() in scalar context will return the path of the first matching
file, and all of the matching files in list context. But then why does
it work with an array?
--
Bart.
------------------------------
Date: 04 Oct 2001 09:18:09 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Efficient code?
Message-Id: <m3hetfk0ha.fsf@mumonkan.sunstarsys.com>
"S Warhurst" <s.warhurst@rl.ac.uk> writes:
> "Joe Schaefer" <joe+usenet@sunstarsys.com> wrote in message
> news:m33d51n4rw.fsf@mumonkan.sunstarsys.com...
>
> <snip>
> > The line marked XXX might be accelerated by first inverting @line_break
> > outside the loops:
[...]
> Hmmm.. that's quite a different way of doing it than otherwise
> suggested. I can imagine how it might speed things up though. I'll
> have to do some benchmarking on this when I get more time. Thanks for
> writing all that out.. this thread is all going into a reference file
> I'm keeping :)
After a little testing, the original code seems to have some off-by-one
errors. Here's a cleaner version (w/ study() omitted since it does slow
things down):
read TEXTFILE, $_, -s TEXTFILE;
my @line_break = 0;
push @line_break, pos while /\n/g;
# just in case the last char in $_ isn't a newline:
push @line_break, length $_ unless $line_break[-1] == length $_;
my %line_num; # inverts @line_break
@line_num{@line_break} = 0..$#line_break;
# just in case last char isn't "\n":
$line_num{ 0 } = $line_num{ $line_break[-1] };
my @re = map qr/$_/, qw/list of 50 regexps/;
foreach my $r (@re) {
while (/$r/g) {
# first get $line: assumes $r won't match across lines-
# i.e. be careful with "\s"
my $n = $line_num{ index($_, "\n", pos) + 1 };
my $line = substr $_, $line_break[$n-1],
$line_break[$n] - $line_break[$n-1];
# avoids mutiple matches on the same line by advancing pos
pos = $line_break[$n];
# now do something
}
}
--
Joe Schaefer "Few things are harder to put up with than the annoyance of a
good example."
--Mark Twain
------------------------------
Date: Thu, 04 Oct 2001 14:35:00 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: Efficient code?
Message-Id: <Xns91306C8C93140echangnetstormnet@207.106.92.86>
"S Warhurst" <s.warhurst@rl.ac.uk> wrote in
news:9ph8he$12re@newton.cc.rl.ac.uk:
[snip]
> I hadn't heard of the qr function before. It isn't in the reference
> guide I use.. and after a bit of searching only seems to appear in
> about half of the online reference guides. I note there are other
> ones aswell like qq & qx.
>
> Is there a complete reference guide you can buy in book form that
> gives ALL the perl 5.6 functions & operators etc, that gives a
> detailed descriptions of each one and an example of how it is most
> commonly used?
First and foremost, the documentation that comes with Perl.
perldoc perlfunc
perldoc perlop
All the documentation is available online at http://perldoc.com.
Second, Programming Perl, 3rd Edition, Larry Wall et al, from O'Reilly
--
EBC
------------------------------
Date: 4 Oct 2001 07:49:48 -0700
From: tst3000@hotmail.com (Thomas Stammeier)
Subject: Embedding Problem Win32
Message-Id: <6a8da949.0110040649.4d6ee4f1@posting.google.com>
Hi,
I'm having problems embedding Perl 5.6.1 (W2k) in my application. I
downloaded the source code, compiled, installed...everything OK.
When I try to link my application I get a couple of linker errors, for
example the symbol "Perl_Isv_undef_ptr" is not defined.
The thing is, I can compile and link perfectly using ActiveState's
ActivePerl 5.6.
The symbol in question (among others) is exported by ActiveState's
perl56.dll but not by perl56.dll that I have compiled myself.
Looking up in perlapi.h i found
#undef PL_sv_undef
#define PL_sv_undef (*Perl_Isv_undef_ptr(aTHXo))
Scanning through the source code, I found that "Perl_Isv_undef_ptr" is
defined nowhere ?
Am I getting something totally confused or is this a bug ?
Thanks for any hints,
Thomas
------------------------------
Date: Thu, 04 Oct 2001 09:54:38 -0400
From: Max Gravitt <magrav@wnt.sas.com>
Subject: escape character for a space
Message-Id: <p9qortkkn9em4l31e1p5hrdrgnfpbksihh@4ax.com>
I'm trying to use a space in the replacement string of a regular
expression. It is embedded in a batch file, so I can't pass a *real*
space. I can match a space using "\s", but I need a character that
will insert a space at the specific place.
For example:
s/Old\sString/New\sString/g
obviously does not work. I need the equivalent to " " to insert in
place of the "\s" between New and String.
Any ideas?
thanks
Max
------------------------------
Date: Thu, 4 Oct 2001 13:22:59 +0000 (UTC)
From: 8823559 <gis88559@ultra2.cis.nctu.edu.tw>
Subject: get "REMOTE_ADDR" with perl..
Message-Id: <9phnrj$1i7t$1@news.cis.nctu.edu.tw>
Hi there,
Can anyone of you help me with this problem? Thanks a lot..:)
It's O.K for me to get the environment variable "REMOTE_ADDR", while
fail to get the "REMOTE_HOST". I know some hosts turn off the feature
for some speed concerns, the problem is, how should I turn it on again?
I've also tried the perl built-in function "gethostbyaddr", but still
in vain. ($name = gethostbyaddr($IP, AF_INET))
Could you please also reply it to my e-mail address? Then I would be
easier to see your great answers...:)
My e-mail is: gis88559@cis.nctu.edu.tw
--
------------------------------
Date: Thu, 4 Oct 2001 22:45:16 +0930
From: "Getho" <gethinc@hotmail.com>
Subject: help this newbie please - server error
Message-Id: <1eZu7.49441$812.70815@newsfeeds.bigpond.com>
Howdy,
I'm very new to this so applogies for the crap questions:
I'm trying to get a "classifieds" script working (abs5.06 by
ads-programming). I've got several other scripts working fine - I can just
about follow some of the script language. I'm sure I've covered all the
obvious things: permissions (all 777), paths, path to perl, cgi bin etc.
When I ran the script initially I just got a server error. For some reason
I changed all the double-quotes in the script to single ones and the script
started to work.
Why would that make a difference?
I've tried it on two servers now.
Should I cut my losses and give up?
getho
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.282 / Virus Database: 150 - Release Date: 25/09/01
------------------------------
Date: 4 Oct 2001 05:46:16 -0700
From: esn@ematic.com (Sebastian)
Subject: Help With Network
Message-Id: <58565008.0110040446.4a8b2364@posting.google.com>
Hi all
Is Ther a fast and simple way to get with perl info
of my Ethernet Card like ( my current Bandwidth, my
current transmition speed, and my current reception speed )
ThanX
------------------------------
Date: Thu, 04 Oct 2001 07:53:00 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Help
Message-Id: <3BBC5BAC.2C2D6EBA@home.com>
Jonathan Clover wrote:
>
> Well, I am getting this error:
> syntax error at ./admin.cgi line 1252, near "for "
> syntax error at ./admin.cgi line 1260, near "else"
> when I run this program(excerpt below).
Did you enable warnings? When I ran your snippet through perl -cw it
told me
Missing right curly or square bracket at foo.pl line 6,
within string
> use an computer using the $top{"OS} Operating System, while browsing
^
You have either one double-quote too few or one too many.
-mjc
------------------------------
Date: Thu, 04 Oct 2001 18:15:51 +0530
From: Prakash Mishra <pmishra@mailcity.com>
Subject: How make install pkg
Message-Id: <3BBC59FF.FE16B907@mailcity.com>
I have developed a tool. Can anybody tell me how to write a install package for
my tool.
------------------------------
Date: Thu, 04 Oct 2001 08:17:00 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: How make install pkg
Message-Id: <3BBC614C.F1EF5062@home.com>
Prakash Mishra wrote:
>
> I have developed a tool. Can anybody tell me how to write a
> install package for my tool.
By tool I assume you mean module? Use h2xs to create the template and it
will create a Makefile script for you.
-mjc
------------------------------
Date: 4 Oct 2001 03:08:24 -0700
From: digiko@lovehinaplus.com (smax)
Subject: How to install a module without AD privilege??
Message-Id: <d5d975e8.0110040208.13cced24@posting.google.com>
Hello, all...
If my scripts uses some modules not installed on server, is there any
way to let me use this module without asking administrator to install
a single module for me??
Thanx...
------------------------------
Date: 4 Oct 2001 10:58:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to install a module without AD privilege??
Message-Id: <9phfc9$fpv$1@mamenchi.zrz.TU-Berlin.DE>
According to smax <digiko@lovehinaplus.com>:
> Hello, all...
>
> If my scripts uses some modules not installed on server, is there any
> way to let me use this module without asking administrator to install
> a single module for me??
That's a FAQ. perldoc -q "own module"
Anno
------------------------------
Date: 04 Oct 2001 11:58:06 +0100
From: nobull@mail.com
Subject: Re: How to install a module without AD privilege??
Message-Id: <u9669vzn7l.fsf@wcl-l.bham.ac.uk>
digiko@lovehinaplus.com (smax) writes:
> If my scripts uses some modules not installed on server, is there any
> way to let me use this module without asking administrator to install
> a single module for me??
See FAQ: "How do I keep my own module/library directory?"
Please check the FAQ _before_ you post.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 04 Oct 2001 11:52:15 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Is Perl for CGI going the way of the dodo?
Message-Id: <slrn9rok5k.1pe.tim@vegeta.ath.cx>
Me parece que Thurber Mingus <thurbermingus1@netscape.net> dijo:
> I am curious as to the opinions of informed people in this ng about the
> future of Perl for CGI. JSP and ASP seem to be where its at and where its
> going. TIA
Ah. The old "Isn't Perl[*] dead, already?" troll attack. And the whole
"where it's at and where it's going" manager-speak. Next you're gonna
tell me Amway's "where it's at", right? Well, that guy told me Amyway
was "where it's at" when he wanted to show me "the plan". Good thing I
didn't take his word for it; he had to sell his Corvette, 5-seat pickup
with 10 foot bed, huge house, and "quaint coffee shop" when his
"business" went under. Maybe you should watch out who you listen to
when they tell you "where it's at". Or are you the one starting all
this crap? ...
Ah, what the hell.
JSP[*]? Oh, yeah. Let's take the net's most convoluted and so far slow
technology and use it for web sites, something that demands speed. A
questionable idea from the beginning, but it's got the word "Java[*]" in
it, and a lot of managers don't know any better. Java's a buzzword.
Yes, it's a popular language. Does that make it good? To quote an old
Steve Taylor song:
"So they love Jerry Lewis in France.
...Does that make him funny?"
Please, no java-zealot flames. I tried it, it was kinda fun, but it sure
as hell didn't make my job any easier. And when I can't get the job
done, well, you get the point. You could also pay Java programmers for
30 hours (You know what they charge per hour?) to do something a perler
could do in 5-10 minutes.
ASP[*]:
ASP is an "environment", not a language. First know the difference. ASP
takes some of the most commonly used actions in web site development and
make them easier to access...with whatever language you choose.
ASP/VBScript[*]: Like seeing-eye dog leading Godzilla through the streets
of Boston. ASP, as useful as it can be, needs a good interface. Some
people have been able to accomplish a lot with VBScript. It was just a
pain in the arse. Consider the task I had of sending mail to a remote
user from an ASP page that accepted FORM input.
In VBScript:
- Get ASP COM component[*] (ASPMail or ASPEmail work)
- Pay for said ASP component (if it was ASPMail)
- Bug the sysadmin until he registers the DLL on the server
- Learn the (simple) API
- Write the page.
In PerlScript:
- Download Jenda's Mail::Sender
- Learn the (simple) API
- Write the page
I saved $50-100 (from ASPMail), and 2 days worth of coercing co-workers
into installing software. This is just one real example of how Perl
saved my behind _while_ using ASP.
Perl also has built-in socket support, so I could have done the work of
Mail::Sender without any additional modules.
Perl has built-in[*] support for OOP[*] with multiple inheritance[*] and
polymorphism[*] and any other buzzwords I can think of. Earlier
VBScript had this not at all, and JScript[*] OO support is crude at
best.
Although, to be honest, my preference, as well as my prediction, would
be toward ASP/Python[*] ...for IIS servers anyway; there _are_ other servers,
but many of the run on *gasp!* *nix operating systems. For example: *BSD,
Linux, Solaris (hey, they developed Java!)
Python has the best OO support and highest maintainability I've seen in
a long time. Using it is quick, fun, and has growing support every day.
[*] - IT buzzword (count: 10 unique buzzwords)
--
I'm not an alien. I'm discontent.
-- Stan, "The Faculty"
------------------------------
Date: 4 Oct 2001 06:05:46 -0700
From: google@richmore.com (Richard)
Subject: Re: Is Perl for CGI going the way of the dodo?
Message-Id: <81f7a6eb.0110040505.6584abb8@posting.google.com>
"Gregory Toomey" <nobody@nowhere.com> wrote in message news:<zpSu7.48394$812.66214@newsfeeds.bigpond.com>...
> "Thurber Mingus" <thurbermingus1@netscape.net> wrote in message
> news:9pgo09$76r$1@suaar1ab.prod.compuserve.com...
> > I am curious as to the opinions of informed people in this ng about the
> > future of Perl for CGI. JSP and ASP seem to be where its at and where its
> > going. TIA
>
>
> I would use ASP or CF for the easy stuff. But for anything with background
> processing/interprocess communication/sockets, Perl is the way to go.
Don't forget you can use Perl/PerlScript in an ASP page!!!
Rich
------------------------------
Date: Thu, 4 Oct 2001 07:54:04 -0600
From: "Thurber Mingus" <thurbermingus1@netscape.net>
Subject: Re: Is Perl for CGI going the way of the dodo?
Message-Id: <9phpm2$5i9$1@suaar1aa.prod.compuserve.com>
I appreciate the responses. I am not a troll, as was suggested, but I
wanted to see what people thought of the issue; I don't know anyone at my
college that is knowledgeable about either subject, and I wanted to bounce
this question off of people who actually used Perl. I have used VBScript
for ASP and am looking at ASP.NET for the future, yet I wanted to know where
Perl users stood on the alluded-to feeling among some that Perl's use for
CGI, as well as CGI itself, was falling into disfavor. I was thinking of
learning Perl, but wasn't sure what motivation I should have for doing so.
I think Perl's use in OOP is interesting, I am going to look into it. Thank
you for your time.
"Thurber Mingus" <thurbermingus1@netscape.net> wrote in message
news:9pgo09$76r$1@suaar1ab.prod.compuserve.com...
> I am curious as to the opinions of informed people in this ng about the
> future of Perl for CGI. JSP and ASP seem to be where its at and where its
> going. TIA
>
>
>
>
------------------------------
Date: Fri, 5 Oct 2001 00:07:34 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: Is Perl for CGI going the way of the dodo?
Message-Id: <D0_u7.49655$812.72639@newsfeeds.bigpond.com>
"Richard" <google@richmore.com> wrote in message
news:81f7a6eb.0110040505.6584abb8@posting.google.com...
> "Gregory Toomey" <nobody@nowhere.com> wrote in message
news:<zpSu7.48394$812.66214@newsfeeds.bigpond.com>...
> > "Thurber Mingus" <thurbermingus1@netscape.net> wrote in message
> > news:9pgo09$76r$1@suaar1ab.prod.compuserve.com...
> > > I am curious as to the opinions of informed people in this ng about
the
> > > future of Perl for CGI. JSP and ASP seem to be where its at and where
its
> > > going. TIA
> >
> >
> > I would use ASP or CF for the easy stuff. But for anything with
background
> > processing/interprocess communication/sockets, Perl is the way to go.
>
> Don't forget you can use Perl/PerlScript in an ASP page!!!
Yes, and don't forget ASP can run on *nix.
gtoomey
------------------------------
Date: Fri, 5 Oct 2001 00:36:06 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: Is Perl for CGI going the way of the dodo?
Message-Id: <mr_u7.49917$812.69504@newsfeeds.bigpond.com>
"Tim Hammerquist" <tim@vegeta.ath.cx> wrote in message
news:slrn9rok5k.1pe.tim@vegeta.ath.cx...
...
> JSP[*]? Oh, yeah. Let's take the net's most convoluted and so far slow
> technology and use it for web sites, something that demands speed. A
> questionable idea from the beginning, but it's got the word "Java[*]" in
> it, and a lot of managers don't know any better. Java's a buzzword.
> Yes, it's a popular language. Does that make it good? To quote an old
> Steve Taylor song:
...
> "So they love Jerry Lewis in France.
> ...Does that make him funny?"
...
> Please, no java-zealot flames. I tried it, it was kinda fun, but it sure
> as hell didn't make my job any easier. And when I can't get the job
> done, well, you get the point. You could also pay Java programmers for
> 30 hours (You know what they charge per hour?) to do something a perler
> could do in 5-10 minutes.
>
> ASP[*]:
> ASP is an "environment", not a language. First know the difference. ASP
> takes some of the most commonly used actions in web site development and
> make them easier to access...with whatever language you choose.
>
......
> Although, to be honest, my preference, as well as my prediction, would
> be toward ASP/Python[*] ...for IIS servers anyway; there _are_ other
servers,
> but many of the run on *gasp!* *nix operating systems. For example: *BSD,
> Linux, Solaris (hey, they developed Java!)
I totally agree. JSP is a maintenance nightmare and too slow. I once tried
straight java/cgi printing to stdout. It was fast but nowhere as sexy (or
slow) as Weblogic.
I reasons I like Perl (& Python) are
1. I use a Linux web hosting service, and I like telnet and vi! Programming
in ASP and using FTP to upload files sucks.
2. They can be used for much more than cgi. You can write one liner or a
10,000 line OO system. (Just look at how many lines a "hello world" Java
program has.) You can run a script in a telnet session or thru a web server.
3. With 2Ghz CPUs, the compile/link/execute model is old fashioned. I get
complex Perl/mysql/cgi scripts taking 1-2 seconds elapsed.
gtoomey
------------------------------
Date: Thu, 4 Oct 2001 12:14:20 +0200
From: "felix" <mr.thanquol@gmx.de>
Subject: Re: parallel http-requests with LWP::Parallel
Message-Id: <9phcpt$k3c$1@crusher.de.colt.net>
"felix" <mr.thanquol@gmx.de> wrote in message
news:9phb1m$j6c$1@crusher.de.colt.net...
> Hi,
>
> I'm trying to make some parallel request to my website. This is not the
> problem, but I think If go a logical problem and I am actually not able to
> see it... :-(( . I am reading the URL's out of my database and want to
> call 5 of them parallel with this part of my code
>
>
>
> foreach my $categoryid (@CategoryValues){
> my $StoreUrl = $StoreCatalogUrl . $sid . $categoryid;
> my $StoreRequest = HTTP::Request->new('GET', $StoreUrl);
> push (@RequestCount, $StoreRequest);
>
> if (scalar @RequestCount eq $MaxRequestCount){
> foreach my $requests
equestCount){
> # Create $MaxRequestPerTime http-requests
> print "Registering '" . $requests->url . "'\n"
> if (my $res = $ua->register ($requests));
> }
>
> my $entries = $ua->wait();
> foreach (keys %$entries){
> my $response = $entries->{$_}->response;
> print "Answer for '", $response->request->url, "' \n";}
> @RequestCount = ();
> print "Scalar of REQEUSTCOUNTER = ". scalar @RequestCount .
> "\n";}
> else { print "not enough url's yet";}
> }
>
> this calls first 5 than 10 than 15 ... urls. but I what i need is that it
> always calls 5 urls....
>
> thx
> fe
solved the problem... I just created a new useragent in the loop and the requests are no longer attached
thx
fe
------------------------------
Date: Thu, 4 Oct 2001 12:14:28 +0200
From: "felix" <mr.thanquol@gmx.de>
Subject: Re: parallel http-requests with LWP::Parallel
Message-Id: <9phcq4$k3f$1@crusher.de.colt.net>
"felix" <mr.thanquol@gmx.de> wrote in message
news:9phb1m$j6c$1@crusher.de.colt.net...
> Hi,
>
> I'm trying to make some parallel request to my website. This is not the
> problem, but I think If go a logical problem and I am actually not able to
> see it... :-(( . I am reading the URL's out of my database and want to
> call 5 of them parallel with this part of my code
>
>
>
> foreach my $categoryid (@CategoryValues){
> my $StoreUrl = $StoreCatalogUrl . $sid . $categoryid;
> my $StoreRequest = HTTP::Request->new('GET', $StoreUrl);
> push (@RequestCount, $StoreRequest);
>
> if (scalar @RequestCount eq $MaxRequestCount){
> foreach my $requests
equestCount){
> # Create $MaxRequestPerTime http-requests
> print "Registering '" . $requests->url . "'\n"
> if (my $res = $ua->register ($requests));
> }
>
> my $entries = $ua->wait();
> foreach (keys %$entries){
> my $response = $entries->{$_}->response;
> print "Answer for '", $response->request->url, "' \n";}
> @RequestCount = ();
> print "Scalar of REQEUSTCOUNTER = ". scalar @RequestCount .
> "\n";}
> else { print "not enough url's yet";}
> }
>
> this calls first 5 than 10 than 15 ... urls. but I what i need is that it
> always calls 5 urls....
>
> thx
> fe
solved the problem... I just created a new useragent in the loop and the requests are no longer attached
thx
fe
------------------------------
Date: Thu, 04 Oct 2001 10:49:10 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: Perl 5.6.0 bug: best workaround?
Message-Id: <3BBC76E6.1080208@coppit.org>
Benjamin Goldberg wrote:
> my ($x, $y, $z, $t) = getargs(@{[@_]}, qw(x=i y=ARRAY z t=FOO));
Unfortunately, getargs wants to also modify the arguments of the calling
function, so this won't work because it will be modifying the arguments
of the copy instead.
> Or remove the prototype from getargs, and call it as:
> my ($x, $y, $z, $t) = getargs( [@_], qw(x=i y=ARRAY z t=FOO) );
I'm not sure if the module author wants to change his interface in order
to work around a bug in one version of Perl.
In the end, the patch I submitted had a big warning in Makefile.PL for 5.6.0 users, telling them that they have to make a copy of the arguments they want to check:
try {
my @args = @_;
getargs(@args, qw(x=i y=ARRAY z t=FOO));
...
}
This method puts the burden on the person using the buggy version of
Perl, and lets people using other versions continue to use the same
interface. I also had to patch Log::Agent::Rotate to use this method so
that 5.6.0 users of that module wouldn't have problems... Sigh. This is
the second or third bug I've encountered in 5.6.0--seems like a DOA version.
David
------------------------------
Date: 4 Oct 2001 04:02:26 -0700
From: perlmisk@yahoo.co.uk (perl misk)
Subject: pervent multiple instances of a server
Message-Id: <7fe42fcd.0110040302.44a65f39@posting.google.com>
what is the best way to prevent multiple instances of a server from
being invoked?
possible solutions I can think of are:
1. $ps = `ps -fuusername`;
m/$ps/$server_name/
this seems a little messy, and a server could be started after you
call ps but before you get to start yours
2. sub start_server {
open >>FH, ~/tmp/server_running.lock
}
ditto
3. try connecting to a predefined socket
??
------------------------------
Date: Thu, 04 Oct 2001 13:52:18 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: pervent multiple instances of a server
Message-Id: <58jortc5i116vaq1qu235b4suipncml2c6@4ax.com>
On 4 Oct 2001 04:02:26 -0700, perlmisk@yahoo.co.uk (perl misk) wrote:
>what is the best way to prevent multiple instances of a server from
>being invoked?
>3. try connecting to a predefined socket
You probably mean binding instead of connecting.
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: 4 Oct 2001 03:05:24 -0700
From: markus.cl@gmx.de (Markus Dehmann)
Subject: Positive lookbehind with variable length?
Message-Id: <c1e48b51.0110040205.2666f72@posting.google.com>
Hi,
as you know, positive lookbehind is only allowed with fixed-width:
s/(?<=A)B
This matches B only if there is a A before it, but doesnt match the A
itself.
This is not allowed:
s/(?<=\w+)B
because the lookbehind assertion has a variable length and this is not
implemented in Perl yet.
I heard in Perl6 this feature will be allowed.
Are there tools that allow it by now? Python seems not to allow it.
What about other Unix tools?
Markus.
PS: By the way, when will Perl6 be available?
------------------------------
Date: Thu, 4 Oct 2001 11:10:52 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Skipping following lines if the same
Message-Id: <slrn9roght.8li.bernard.el-hagin@gdndev25.lido-tech>
On 4 Oct 2001 02:12:56 -0700, Laird <kenlaird@yahoo.com> wrote:
[snipped examples]
>skipping following lines if the same.
>But only following lines.
Try this:
------------------------------
#!/usr/bin/perl -w
use strict;
open( IN, 'input_file') or die $!;
my @data = <IN>;
for( my $i = 0; $i < @data; $i++ ){
if( $data[$i + 1] and $data[$i] eq $data[$i + 1] ){
next;
}
else{
print $data[$i];
}
}
------------------------------
Cheers,
Bernard
------------------------------
Date: 4 Oct 2001 11:15:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Skipping following lines if the same
Message-Id: <9phgct$fpv$2@mamenchi.zrz.TU-Berlin.DE>
According to Laird <kenlaird@yahoo.com>:
> Hi everyone,
>
> I've got this array
>
> aaa
> aaa
> bbbbb
> cccc
> cccc
> c
> ddd
> ddd
> fff
> fff
> fff
> ffff
> ffff
>
>
> and would like to transform it into this
>
>
> aaa
> bbbbb
> cccc
> c
> ddd
> fff
> ffff
>
>
> skipping following lines if the same.
> But only following lines.
>
> I tried this but it doesn't work.
Please. If it doesn't work, tell us in which way it doesn't. Without
that, people have to either run your code or hand-inspect it to find
out what you are complaining about.
> #!/usr/bin/perl
No strict? No warnings? If Perl code gives you trouble, always
switch these on.
> open (IN,data);
No check on open? Always check for success.
> @a=<IN>;
Needless file slurping. What you are doing can be done in a single
pass.
> for (@a){
> $i++;
> chomp $a[$i];
Why chomp it? You want to either drop the line, or print it
unchanged.
> print "$a[$i]\n" if /$a[$i]/ ne /$a[$i+1]/
Here the (unnecessary) chomp bites you. $a[ $i] is chomped, but
$a[ $i+1] isn't. They can't be equal.
> }
Try this:
my $previous;
while ( <DATA> ) {
next if defined $previous and $previous eq $_;
print;
$previous = $_;
}
Anno
------------------------------
Date: Thu, 04 Oct 2001 13:56:14 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Skipping following lines if the same
Message-Id: <gejortsm4b57d9os8ojk8gkjgfsmaq0nns@4ax.com>
On 4 Oct 2001, anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
>> for (@a){
>> $i++;
>> chomp $a[$i];
>Why chomp it? You want to either drop the line, or print it
>unchanged.
Chomping can make sense when the last two lines are identical and the
last line is not terminated. Of course you would have to chomp all
lines, as you rightly pointed out.
Cheers,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: 04 Oct 2001 15:00:32 +0200
From: Walter Hafner <hafner@augusta.de>
Subject: Re: Skipping following lines if the same
Message-Id: <qdf1ykjk1an.fsf@www.ibexnet.de>
kenlaird@yahoo.com (Laird) writes:
> aaa
> aaa
> bbbbb
> cccc
> cccc
> c
> ddd
> ddd
> fff
> fff
> fff
> ffff
> ffff
>
> and would like to transform it into this
>
> aaa
> bbbbb
> cccc
> c
> ddd
> fff
> ffff
system("unique", "data")
*duck and run* :-)
-Walter
------------------------------
Date: Thu, 04 Oct 2001 16:03:02 +0200
From: Jean-Philippe Fauvelle <JPFauvelle@Colt-Telecom.fr>
Subject: Re: Skipping following lines if the same
Message-Id: <c0qortcre56np450pot24v4np582igcqd8@4ax.com>
Le 4 Oct 2001 02:12:56 -0700, kenlaird@yahoo.com (Laird) +AOk-crit:
>skipping following lines if the same.
>But only following lines.
>
>I tried this but it doesn't work.
>
>#!/usr/bin/perl
> open (IN,data);
> @a=<IN>;
> for (@a){
> $i+ACsAKw-;
> chomp $a[$i];
> print "$a[$i]+AFw-n" if /$a[$i]/ ne /$a[$i+-1]/
> }
>
# Remove all doubles [1]
open(IN,"filename") or die "open failed - $!";
@data = keys map { chomp; $_ => 1 } <IN>;
# Remove all doubles [2]
%seen = ();
open(IN,"filename") or die "open failed - $!";
@data = grep { chomp; return +ACsAKw-$seen{$_} } <IN>;
# Remove only consecutive doubles [long version]
open(IN,"filename") or die "open failed - $!";
while ( chomp($current = <IN>) ) {
next if $previous eq $current;
$previous = $current ;
print "$current+AFw-n";
}
# Remove only consecutive doubles [short version]
open(IN,"filename") or die "open failed - $!";
while ( chomp($current = <IN>) ) {
($previous eq $current) ? next : print ($previous=$current), "+AFw-n";
}
Hope that helps.
Jean-Philippe Fauvelle
------------------------------
Date: Thu, 04 Oct 2001 14:29:09 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Template-Toolkit
Message-Id: <b7sort0mqnqe4os51aqfg2prem1a9j5prb@4ax.com>
Evil Overlord wrote:
>Subject: Template-Toolkit
>Anybody use this? Is it any good?
No, it's crap. Kidding!
Actually, I have no clue whether you'll like it or not, but at least,
there's an article written about it. Check it out.
<http://www.perl.com/pub/a/2001/01/tt2.html>
And apparently this module has its own domain name.
<http://template-toolkit.org/>
--
Bart.
------------------------------
Date: Thu, 04 Oct 2001 14:22:54 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Whither Palm Perl?
Message-Id: <t4sort88or0ghbnse8ogmacqjnm2idp11d@4ax.com>
DrDebug wrote:
>Is there some reason why Perl has not been ported to the PalmOS?
>
>Sure it's big, but couldn't something be done?
>
>Is there other reasons why not?
Perl6 will most likely run on the Palm. A few months, or years, of
patience, please.
--
Bart.
------------------------------
Date: 4 Oct 2001 07:16:27 -0500
From: maintainer@setifaq.org (Mark Taylor)
Subject: Re: Why does if statement not work ?
Message-Id: <Xns91304CADB3938maintainersetifaqorg@128.242.171.114>
"Nick Blake" <nick.blake@qr.com.au> wrote in
<9ph8sv$bli1@inetbws1.citec.com.au>:
>I tried but still receiving a error.
>
>Can't find string terminator "'" anywhere before EOF at roky.pl line 10.
>
>while ( <> ){
>
>($path, $who, $acl) = split(/,/, $_);
>chomp $acl;
>
> $length = length( $path );
>
>$newpath = substr($path, -1, $length);
>
>if ( $newpath eq '\'){ print "yes it is\n" }
>}
>
>
>
><benhopkins@mindspring.com> wrote in message
><news:3j4hp9.193.ln@127.0.0.1...
>> Nick Blake <nick.blake@qr.com.au> wrote:
>>
>> > while ( <> ){
>>
>> > ($path, $who, $acl) = split(/,/, $_);
>> > chomp $acl;
>>
>> > $length = length( $path );
>>
>> > $newpath = substr($path, -1, $length);
>>
>> > if ( $newpath = '\'){
>> if ( $newpath eq '\'){ # '=' is an assignment operator, 'eq'
>> or
>'=='
>> # tests for equality
>> > (print "yes it is\n") }
>> > }
>>
>>
>
>
This..
if ( $newpath = '\'){
needs to be this..
if ( $newpath eq '\\'){
Mark
______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net
------------------------------
Date: Thu, 04 Oct 2001 14:33:09 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Why does if statement not work ?
Message-Id: <oisortca67l9jbjnpc2gq246p5kthga82g@4ax.com>
Nick Blake wrote:
>if ( $newpath = '\'){
>
>(print "yes it is\n") }
>}
Please enable warnings (append " -w" in the "#!" line at the top). It
would have warned you.
You are assigning "/" to $newpath, and testing if this has a true value.
It has. You want to test for string equality, thus use "eq". "==" should
be used to test for numerical equality, which is not appropriate in this
particular case.
--
Bart.
------------------------------
Date: 4 Oct 2001 14:59:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: XS Question
Message-Id: <9phtfm$h8$1@mamenchi.zrz.TU-Berlin.DE>
According to pkent <adverts@teaselsyn.co.uk>:
> In article <m3d746mwnx.fsf@mumonkan.sunstarsys.com>,
> Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> <some helpful things>
>
> thanks very much. I'm also looking at using SWIG, which might be better
> for my purposes (basically taking computationally intensive maths stuff
> out of perl and into C).
In that case you should probably also look at the PDL module.
Anno
------------------------------
Date: Thu, 4 Oct 2001 08:02:44 -0500
From: "Mr. Sunblade" <djberge@qwest.com>
Subject: Re: Yet another fork question
Message-Id: <G1Zu7.46$sE3.39091@news.uswest.net>
"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3BBB6A99.E79AACE9@earthlink.net...
<snip>
> If you eliminate the explicit wait, and just have it in the signal
> handler, it's possible for the main program to exit while the children
> are still running. Sometimes this is desired, but sometimes not.
Slowly, but surely, I'm learning... :)
<snip nice examples & stuff>
> > Then again, perhaps I just had the 'wait' in the wrong place, or maybe
> > adding a second 'wait' when I already had a $SIG{CHLD} handler set up
> > screwed it up.
>
> Yeah, having the signal handler can mess things up if you're trying to
> call wait() in the main body of your code.
>
> Like I said, signal handlers are really funky things... in general, if
> you can, try and avoid having to mess with them.
I read Lincoln Stein's "Network Programming with Perl" book and that's how
he set up the signal handlers for client/server apps (i.e. with $SIG{CHLD}).
After I saw that, I started getting into the habit of using it everywhere I
used fork. Perhaps it was a case of "give someone a hammer...".
Thanks for the tips. I'll have to break this habit now (for non
client/server apps, anyway). :)
I also welcome any other comments (from anyone) on the subject of signal
handlers.
Regards,
Mr. Sunblade
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1870
***************************************