[15578] in Perl-Users-Digest
Perl-Users Digest, Issue: 2991 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 9 14:05:53 2000
Date: Tue, 9 May 2000 11:05:26 -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: <957895525-v9-i2991@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 9 May 2000 Volume: 9 Number: 2991
Today's topics:
1xPERL PROGRMMER NEEDED... bee_line@mailcity.com
Re: 1xPERL PROGRMMER NEEDED... <lauren_smith13@hotmail.com>
Re: a cgi problem... <red_orc@my-deja.com>
Re: Accidental Creation of Static Variable <sariq@texas.net>
Re: after the whatever.cgi? question? <erick.jensen@unisys.com>
Re: after the whatever.cgi? question? <tony_curtis32@yahoo.com>
Re: after the whatever.cgi? question? <flavell@mail.cern.ch>
Re: after the whatever.cgi? question? <rrindels@arkansas.net>
Re: BEGIN and use <lr@hpl.hp.com>
Re: BEGIN and use <bmb@ginger.libs.uga.edu>
Re: CGI.pm <lr@hpl.hp.com>
Re: Checking if Child Process is still Alive abeall@ipcell.com
Re: Checking if Child Process is still Alive <rootbeer@redcat.com>
Re: compile perl ? <Robert@nospam.edu>
Re: Conditional compilation in Perl?? (Bart Lateur)
Re: Cookie <baughj@rpi.edu>
Re: Flame my code <andy@u2me3.com>
Re: goto function <andy@u2me3.com>
How can I call a perl script from html-page <saddek@arch.chalmers.se>
Re: How can I call a perl script from html-page <jeff@vpservices.com>
Re: How does argument order affect long string variable <baughj@rpi.edu>
Re: How to include lines beginning and ending with a st <lr@hpl.hp.com>
Re: How to tell if <> operator will work on a given sca (Ilya Zakharevich)
Re: HTTP::Request=HASH(0x7bb141c) ? (brian d foy)
Install Help needed Mail::Sender.pm <skpurcell@hotmail.com>
Re: Is Perl fast enough? (brian d foy)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 09 May 2000 15:36:22 GMT
From: bee_line@mailcity.com
Subject: 1xPERL PROGRMMER NEEDED...
Message-Id: <8f9b9k$ajt$1@nnrp1.deja.com>
Hi folks,
I'm in need of someone who'll help me set up my own auction site using
EveryAuction (or any other auction). I have no knowledge of Perl.
I'm just experimenting, and am dirt poor...(lol), but it's true.
I can't afford to pay anyone the usual fees, so I need someone who'll
help me out with this for a very reasonable price. But I also don't
want or expect anyone to work for free.
I'm new to setting up a web site, been on the Internet for 5 years, yet
never explored setting up a site until now, so I'll need some help.
If anyone's interested in helping me, I'd appreciate it a great deal.
There's much I also want/need to learn, so I'm looking for someone
who'll spend just a bit of time with me educating me about how a site
works, how it's upgraded, hosting ins and outs, trouble shooting, etc.
I'm a quick learn, and I won't take up too much of your time. I'm an
entreprenuer at heart, and if I can get this project off the ground,
which I fully expect to, I'll be asking you to set up a couple more
sites in the very near future (if you're interested).
If anyone can help, please email, and thanks.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 9 May 2000 10:13:32 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: 1xPERL PROGRMMER NEEDED...
Message-Id: <8f9gvo$c6b$1@brokaw.wa.com>
<bee_line@mailcity.com> wrote in message news:8f9b9k$ajt$1@nnrp1.deja.com...
>
> I'm in need of someone who'll help me set up my own auction site using
> EveryAuction (or any other auction). I have no knowledge of Perl.
>
> I can't afford to pay anyone the usual fees, so I need someone who'll
> help me out with this for a very reasonable price. But I also don't
> want or expect anyone to work for free.
>
> I'm new to setting up a web site, been on the Internet for 5 years, yet
> never explored setting up a site until now, so I'll need some help.
>
> If anyone's interested in helping me, I'd appreciate it a great deal.
> There's much I also want/need to learn, so I'm looking for someone
> who'll spend just a bit of time with me educating me about how a site
> works, how it's upgraded, hosting ins and outs, trouble shooting, etc.
> I'm a quick learn, and I won't take up too much of your time. I'm an
> entreprenuer at heart, and if I can get this project off the ground,
> which I fully expect to, I'll be asking you to set up a couple more
> sites in the very near future (if you're interested).
Go over to your favorite online bookstore and do a search for 'Lincoln
Stein'. Figure out which ones fit your needs, then buy it from your
favorite bookseller.
As for learning Perl, check out Uri Guttman's book page. There are lots of
good books to help you through the rough spots.
If you are interested in finding someone for a job, you'd be well served by
posting a message to your local Perl Mongers/Users Group. http://www.pm.org
Lauren
------------------------------
Date: Tue, 09 May 2000 16:18:27 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: a cgi problem...
Message-Id: <8f9do1$dfk$1@nnrp1.deja.com>
In article <39167353.37FAB50@hongkong.com>,
Ken Wong Lai Yin <lywong7@hongkong.com> wrote:
> Dear all,
>
> I have met with a problem...
>
> I'm now trying to set up a http server on pc(Apache), with perl
support.
>
> My problem is, when i try send the request from the web page to server
> by using form, it works improperly...
>
> By using Netscape...
> with no proxy setting, directly connected to Internet, it returns "The
> request method POST is not allowed for the URL / testre1.pl"
> with proxy setting , the returns is "The requested URL could not be
> retrieved........"
>
> what's wrong with it?
1. are the permissions set correctly for the file?
2. have you set the AutoHandler cgi-script configuration parameter for
apache correctly to accept .pl extensions?
3. have you checked the apache FAQ?
F:Dynamic Content (CGI & SSI)
3.Why do I keep getting "Method Not Allowed" for form POST requests?
>
> Thanks in advanced.
>
> --
> Best regards,
>
> Ken
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 09 May 2000 10:15:40 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Accidental Creation of Static Variable
Message-Id: <39182B9C.61892B2D@texas.net>
Ala Qumsieh wrote:
>
> nobull@mail.com writes:
>
> > Tom Briles <sariq@texas.net> writes:
> >
> > > Is this behavior documented?
> >
> > Not that I know of, I'd call it a bug.
>
> I believe I saw a discussion of this a few months ago on p5p. IIRC, the
> consensus was that it is indeed a bug, and I believe was (or will be)
> fixed.
>
> Check the archives for more details.
Thanks for the info.
I looked through the archives and found a couple of threads in 09/1998
and 10/1998, but no proposed patch passed muster.
And as Abigail indirectly pointed out, it may be too late now. It could
wreak havoc on existing code.
Still, it could draw a warning, or be documented in perltrap.
- Tom
------------------------------
Date: Tue, 9 May 2000 11:11:04 -0400
From: "Erick Jensen" <erick.jensen@unisys.com>
Subject: Re: after the whatever.cgi? question?
Message-Id: <8f99qb$lge$1@mail.pl.unisys.com>
I didn't say it was better. I'm sure it isn't. I just replied with what
I've used in the past. I didn't realize this was such a hostile newsgroup.
If you have an idea that you think is better, post it and say so. There's
no need to get personal like that Alex Rhomberg character. This back and
forth bickering isn't for what newsgroups are intended, so I'll end it here.
-Erick Jensen
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:877ld3rcts.fsf@shleppie.uh.edu...
> >> On Tue, 9 May 2000 10:43:06 -0400,
> >> "Erick Jensen" <erick.jensen@unisys.com> said:
>
> > What would really help is if you removed the bug up your
> > ass. -Erick Jensen
>
> Please post your replies *after* the cited text you want
> to reply to, otherwise it's very difficult to follow
> dangling referents in the thread of articles.
>
> Also, this isn't comp.lang.perl.ad-hominem -- if you have
> an opinion about why you think this hardcoded QUERY_STRING
> code is better than CGI.pm, let's hear it. Simply emoting
> one-liners (in the canonical sense of "one-liner") doesn't
> get us anywhere.
>
> So...do you think your code is better than CGI.pm? And if
> so, why?
>
> Having programmed CGI before Lincoln's magic incantations,
> CGI.pm was a ${deity}send.
------------------------------
Date: 09 May 2000 10:29:18 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: after the whatever.cgi? question?
Message-Id: <874s87rbch.fsf@shleppie.uh.edu>
>> On Tue, 9 May 2000 11:11:04 -0400,
>> "Erick Jensen" <erick.jensen@unisys.com> said:
> I didn't say it was better. I'm sure it isn't. I just
> replied with what I've used in the past. I didn't
> realize this was such a hostile newsgroup. If you have
> an idea that you think is better, post it and say so.
I did.
> There's no need to get personal like that Alex Rhomberg
> character. This back and forth bickering isn't for what
> newsgroups are intended, so I'll end it here.
please post your new content *after* the text you're
replying to.
>> <erick.jensen@unisys.com> said:
>> > What would really help is if you removed the bug up
>> your ass.
and *you* are complaining about getting personal?
This newsgroup is *not* comp.lang.perl.help, it is
comp.lang.perl.misc. It is a discussion group, not an
instantaneous and free helpdesk.
If you think this group is hostile, please take a look
back at the recent postings in it (you did do that before
posting here didn't you?). The same questions repeated
over and over and over again, often cropping up multiple
times on the same day.
The code you posted contains known security problems (or
at least, the approach you used is likely to lead to such
problems, especially if you use the same tactics for
handling POST requests). This buggy style of code pops up
here over and over again. It gets very tiring and trying
after a while. People who are just starting out with perl
and CGI probably will not know why that style of code is
problematic and will blindly copy it. It will work for a
while and then all hell will break loose when someone
pokes the POST buffer-overflow hole.
It's not this group alone -- many technical groups I
suspect are now flooded with repeated old questions; and
the answers could have been found quite easily by looking
at the recent postings in that group before posting.
------------------------------
Date: Tue, 9 May 2000 17:55:25 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: after the whatever.cgi? question?
Message-Id: <Pine.GHP.4.21.0005091752560.2402-100000@hpplus03.cern.ch>
On Tue, 9 May 2000, Erick Jensen stood usenet upside down and blurted
out (along with a whole lot of other nasty stuff on this thread):
> Sorry Mr. Perl Guru. I've used that bit of code for over 3 years now and
> have never had a problem.
The way things are going, it seems I'm likely to run out of disk quota
for the killfile before long.
> Maybe you should post your replies to
> alt.unwanted.commentary.
Try a mirror.
------------------------------
Date: Tue, 9 May 2000 11:30:14 -0500
From: "Rodney Rindels" <rrindels@arkansas.net>
Subject: Re: after the whatever.cgi? question?
Message-Id: <h1XR4.21114$Lx.3602135@news-west.usenetserver.com>
Take a look at CGI.pm
Should help you out. You can get it from CPAN.
Basically you have to be able to get the input value from STDIN and assign a
name value pair.
CGI really helps in this regards. Just make sure you read everything about
security.
Rodney
Jeff Winner <no@spaming-or-else-ill-lame-you.com> wrote in message
news:8f954t$ncp$1@supernews.com...
> say if i had whatever.cgi?chacha=lalala
>
> how do i get the value of the think after the question mark (chacha) and
> after the equals (lalala)
>
> Thanks
>
> Jeff
>
>
------------------------------
Date: Tue, 9 May 2000 09:43:00 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: BEGIN and use
Message-Id: <MPG.1381dfeb9ec4782c98aa28@nntp.hpl.hp.com>
In article <8f8ngd$ha4$2@slb0.atl.mindspring.net> on 9 May 2000 09:58:37
GMT, Eric Bohlman <ebohlman@netcom.com> says...
> Tony Curtis (tony_curtis32@yahoo.com) wrote:
> : statements in perl are terminated by `;'
>
> Nope. They're *separated* by ';'.
>
> In Perl (and Pascal and possibly other languages), semicolons are part of
> a grammatical structure that could be loosely called "list of statements"
sequence
> which consists of either a single statement, or a bunch of statements
> with semicolons in between them.
Therefore, if there were a formal Perl definition for STATEMENT, one of
the forms would be 'null statement' -- a statement comprising no tokens.
> In C (and Java and possibly other
> languages), semicolons are parts of the statements themselves; a list of
> statements is just one statement immediately after another with nothing
> in between.
Whereas in C, a 'null statement' consists of a semicolon.
That all makes sense, though I wonder how many Perl programmers writing
a block like
{
STATEMENT;
STATEMENT;
}
realize that there are *three* statements in the body of the block.
(Operationally, it doesn't matter, of course.)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 9 May 2000 13:37:01 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: BEGIN and use
Message-Id: <Pine.A41.4.10.10005091314090.8776-100000@ginger.libs.uga.edu>
On Tue, 9 May 2000, Larry Rosler wrote:
[snip]
> Therefore, if there were a formal Perl definition for STATEMENT, one of
> the forms would be 'null statement' -- a statement comprising no tokens.
[snip]
> Whereas in C, a 'null statement' consists of a semicolon.
>
> That all makes sense, though I wonder how many Perl programmers writing
> a block like
>
> {
> STATEMENT;
> STATEMENT;
> }
>
> realize that there are *three* statements in the body of the block.
> (Operationally, it doesn't matter, of course.)
Given the idea that in a string there is a null string at the
beginning, between each character, and at the end, why wouldn't there be
five statements in the body of the block?
On the other hand, why wouldn't there be 7 elements in the array:
@a = split //, 'abc';
Isn't it the case that a statement is properly ended by one of:
1) a semicolon
2) a closing brace
3) end of file
E.g.,
1 #!/usr/local/bin/perl -w
2 use strict;
3
4 {
5 my $a = 'Eh? ';
6 print $a
7 }
8
9 print 'What?'
Output:
Eh? What?
--
Brad
------------------------------
Date: Tue, 9 May 2000 10:24:22 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: CGI.pm
Message-Id: <MPG.1381e9a488836c698aa2b@nntp.hpl.hp.com>
In article <8f76qj$2v7$1@orpheus.gellyfish.com> on 8 May 2000 21:07:47
+0100, Jonathan Stowe <gellyfish@gellyfish.com> says...
> On Mon, 08 May 2000 18:31:13 GMT Jason Malone wrote:
...
> > $FORM{var1} == "value1"
> > $FORM{var2} == "value2"
> > $FORM{var3} == "value3"
>
> I havent the faintest idea why you would want to do this but you can do:
>
> use CGI qw(:standard);
>
> my %FORM;
>
> $FORM{$_} = param($_) foreach (param());
>
> But unless you have some compelling reason to do this you might as well
> do :
>
> param('var1');
>
> whenever you need that value.
^^^^^^^^
Don't Perl's relatively slow method invocations count for something?
The following might well be the most efficient way of capturing the
parameters en masse into a hash for later, fast retrieval:
my @params = param;
@FORM{@params} = map param($_) => @params;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 09 May 2000 12:24:02 EDT
From: abeall@ipcell.com
Subject: Re: Checking if Child Process is still Alive
Message-Id: <39183a65.50358431@news.ipcell.com>
It makes no difference how long I wait. The if statements always
returns true. I modified my script to keep trying to kill the process
and check to see if it is alive. I put this logic into an endless
loop. Try the script yourself and tell me what your results are...
#!/usr/bin/perl
die "can't fork: $!" unless defined($kidpid = fork());
# the if{} block runs only in the parent process
if ($kidpid) {
print "I am the main process: $kidpid\n";
if (kill 0 => $kidpid){
print "I should see this\n";
}
kill("TERM", $kidpid); # send SIGTERM to child
while (1) {
$cnt = kill 0 => $kidpid;
sleep 5;
kill 9 => $kidpid;
print "cnt is $cnt and $kidpid still exists\n";
}
}
# the else{} block runs only in the child process
else {
print "I am the child process $kidpid\n";
exit;
}
On Mon, 8 May 2000 17:21:17 -0700, Tom Phoenix <rootbeer@redcat.com>
wrote:
>On 8 May 2000 abeall@ipcell.com wrote:
>
>> kill("TERM", $kidpid); # send SIGTERM to child
>> if (kill 0 => $kidpid){
>
>It may still be alive for a moment after it gets the first signal; give it
>a moment to get a time slice so that it has a chance to die!
>
>--
>Tom Phoenix Perl Training and Hacking Esperanto
>Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
------------------------------
Date: Tue, 9 May 2000 10:01:59 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Checking if Child Process is still Alive
Message-Id: <Pine.GSO.4.10.10005090938580.3921-100000@user2.teleport.com>
On 9 May 2000 abeall@ipcell.com wrote:
> It makes no difference how long I wait.
I think I have it now; it's because you're not reaping the child process.
Try waitpid or wait to reap that, and see whether that helps. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 09 May 2000 16:32:18 GMT
From: "Robert" <Robert@nospam.edu>
Subject: Re: compile perl ?
Message-Id: <m4XR4.210$u42.8140@news>
Actually I think 5.6 allows you to compile...but don't quote me.
"Matthias Auchmann" <hostmaster@thestormtroopers.com> wrote in message
news:3917f579$0$41650@SSP1NO17.highway.telekom.at...
> Hello world !
>
> Is there any possibility to compile my perl-program ?
>
> thnx !
>
>
------------------------------
Date: Tue, 09 May 2000 15:45:50 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Conditional compilation in Perl??
Message-Id: <391b30e3.24575916@news.skynet.be>
[Sorry to poiggyback, but the original post didn't appear on lmy
server.]
On Tue, 9 May 2000, Daniel Garcia Fernandez wrote:
> Im trying to port a win32 perl script to unix, but i have a problem with
> it: Some of the modules I use are exclusive from w32 (like TieRegistry),
> and even though I call them in a part of code that is not runned under
> unix i get an error telling that the module doesn't exist.
Use separate files for both platforms. See File::Spec (a standard
module) for an example to see how it can be done.
--
Bart.
------------------------------
Date: Tue, 09 May 2000 12:17:04 -0400
From: justin baugh <baughj@rpi.edu>
Subject: Re: Cookie
Message-Id: <39183A00.FEF40D61@rpi.edu>
Chello wrote:
>
> Hi all,
>
> First Question:
>
> I'm looking to write a cookie with that code:
>
> #!/usr/bin/perl -w
>
> use CGI;
>
> $q = new CGI;
>
> $cookie=$q->cookie(-name=>'moonkey_exchange',-value=>$cook_value,-expires=>'
> +1y');
>
> print $q->header(-cookie=>$cookie);
>
Does IE or Netscape fail with this? I had a similar problem where IE
wouldn't grab the cookie to save its life (still have it, actually).
Here's my code. This works fine under Netscape but not under IE
(I'm not exactly sure why. Does anyone know why this would occur?)
# generate session ID
$session_id = join("", @chars[map{rand @chars} (1 .. 16) ]);
my $cookie_value = $session_id . ":" . $author_id;
my $cookie = cookie (-name => "session-id",
-value => $cookie_value,
-expires => "+1y");
print header(-cookie => $cookie);
BTW you don't need to make a new CGI object (iirc).
~j
--
==================================================
Justin Baugh (baughj@nocannedmeat.rpi.edu)
PGP: http://www.rpi.edu/~baughj/keys.txt
"Evil is easy, and has infinite forms." - Pascal
------------------------------
Date: Tue, 9 May 2000 18:50:05 +0100
From: "Andy Chantrill" <andy@u2me3.com>
Subject: Re: Flame my code
Message-Id: <8f9j3k$33$1@uranium.btinternet.com>
Hehe, granted ... maybe using a hash there would be better :o)
------------------------------
Date: Tue, 9 May 2000 18:47:53 +0100
From: "Andy Chantrill" <andy@u2me3.com>
Subject: Re: goto function
Message-Id: <8f9ivv$t2t$1@uranium.btinternet.com>
Hey,
See my post "signal trapper" which outlines the system that I'm trying to
get werkin' ...
>Are you related to this guy? :-)
>http://www.userfriendly.org/cartoons/archives/00may/20000506.html
Admittedly, asking for help on "goto" does make me look rather stupid :o)
Thanks, Andy.
andy@u2me3.com
------------------------------
Date: Tue, 09 May 2000 18:46:16 +0200
From: Saddek Rehal <saddek@arch.chalmers.se>
Subject: How can I call a perl script from html-page
Message-Id: <391840D7.49724550@arch.chalmers.se>
My perl script start with some default variables. I would like to call
my script from from html-page with other variables. How can I call my
script from a html-page and the same time assign new values to variables
???
--
Saddek
------------------------------
Date: Tue, 09 May 2000 10:01:20 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How can I call a perl script from html-page
Message-Id: <39184460.CB9C67D5@vpservices.com>
Saddek Rehal wrote:
>
> My perl script start with some default variables. I would like to call
> my script from from html-page with other variables. How can I call my
> script from a html-page and the same time assign new values to variables
> ???
There are at least three ways to pass variables from an HTML page to a
CGI script. They are all the same regardless of whether the script is
written in Perl or some other langauge so you should check with a CGI
group or documentaion if you have further questions. But the short
answer is, either you put the variables in a link
<a href="myscript.cgi?var1=foo&var2=bar"> run myscript.cgi </a>
Or you put them in an HTML form as any kind of field (including hidden
if it doesn't require user input):
<form action = "myscript.cgi"
method = "POST"
enctype = "application/x-www-form-urlencoded">
<input type="text" name="var1" value="foo">
<input type="hidden" name="var2" value="bar">
# anything else in the form
<input type="submit">
</form>
Then, no matter how you sent them to the script, within the script you
do something like:
use CGI qw(:standard);
print param('var1'), " ... ", param('var2');
Which should print out "foo ... bar" regardless of which of the methods
above you used to send the variables.
CGI.pm comes with Perl itself so if you have Perl, you have it. It has
tons of documentation. Please read that for further information.
--
Jeff
------------------------------
Date: Tue, 09 May 2000 12:09:20 -0400
From: justin baugh <baughj@rpi.edu>
Subject: Re: How does argument order affect long string variables
Message-Id: <39183830.C5FDE25F@rpi.edu>
> As long as the body is less than 1790 characters everything works fine,
> but once it goes past that length the page blows up, IIS crashes and I
> have to reboot the IIS machine to get it back up.
jesus...just another reason to use apache
~j
--
==================================================
Justin Baugh (baughj@nocannedmeat.rpi.edu)
PGP: http://www.rpi.edu/~baughj/keys.txt
"Evil is easy, and has infinite forms." - Pascal
------------------------------
Date: Tue, 9 May 2000 10:56:14 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to include lines beginning and ending with a string
Message-Id: <MPG.1381f11c1c92383e98aa2d@nntp.hpl.hp.com>
In article <8f8kju$hes$1@nnrp1.deja.com> on Tue, 09 May 2000 09:09:25
GMT, c_neak@my-deja.com <c_neak@my-deja.com> says...
> I want to include lines in a array , and include only the lines which
> begins with a string which is "SEIINF" and ends with another string
> which is "SCEIINF" . "SEIINF" and "SCEIINF" are excluded from my array .
> Why the code below does'nt work (I'm newbie in Perl) ?
>
> $file_stat="STAT_2000020400.txt";
> open(FILE,$file_stat) || die "Cannot open $file_stat :$!...\n";
Excellent! Now start to use '-w' and 'use strict;' also. Always.
> while ($line = <FILE>){
If you use the default $_ instead of this assignment, the subsequent
code is much cleaner.
> if ($line =~ /SEIINF(RT\D{4})SCEIINF/){ #problem here !!!
The problem is that you are reading one line only, so this cannot match.
What you can use best here is the 'scalar range operator' '..' (see
perlop).
> chomp($line) ; my @array = split /\s/,$line ;
> $line =~ s/\s//;$line =~ s/\n/;/;$line =~ s/\s/;/;
> print "\n@array";
I can't comment on the above, because it isn't clear why you are
modifying $line and then forgetting about it.
> }
> }
Here is a simple example, which just collects and later prints the
included lines:
#!/usr/bin/perl -w
use strict;
my @array;
while (<DATA>) {
next unless /SEIINF/ .. /SCEIINF/; # Look only between matches.
next if /SEIINF/ || /SCEIINF/; # Ignore the bracketing matches.
push @array, $_;
}
print @array;
__END__
EIDLGS 0
SEINOT 0
GEITRN 0
SEIINF #beginning of extracting lines
RTICMM 0 2241 1 1 1 122
RTGALR 2 0 2 0 0 36
.....
TEIINF
RTRTRY 0 36 3 2 14 56
RTDLVA 1 56 2 3 36 21
.....
DLVMS0 12 3 2 0 5 56
DLVMS1 15 3 2 0 5 520
.....
GEIINF
RTRTFD 0 36 3 2 14 56
RTDHBN 1 56 2 3 36 21
SCEIINF #ending there
RTICMM 0 36 3 2 14 56
RTGALR 1 56 2 3 36 21
.....
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 9 May 2000 17:07:42 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How to tell if <> operator will work on a given scalar?
Message-Id: <8f9gku$qvg$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Ilmari Karonen
<usenet11084@itz.pp.sci.fi>],
who wrote in article <957726600.29276@itz.pp.sci.fi>:
> >Hmmmm.... I wonder then... it is *always* true that <$foo>
> >will work if fileno($foo) is defined? In this uncertain
> >age of tiehandle, I find myself just a wee bit unsure....
>
> Perhaps not - but you'll still have the value of fileno($foo), which
> should be a valid file descriptor number. If it isn't, you'll find
> that out quickly in the next step:
>
> open FILE, "<&=$fd" or die "Can't open file descriptor $fd: $!\n";
perl -wle "open FILE, qq(<&=2) or die; print <FILE>"
Hmm, it works!
Same with
perl -wle "open F, '>&STDERR' or die 1; \
open FILE, qq(<&=).fileno F or die 2; print <FILE>"
perl -wle "open F, '>&=2 or die 1; \
open FILE, qq(<&=).fileno F or die 2; print <FILE>"
(OS/2 and Solaris)...
Ilya
------------------------------
Date: Tue, 09 May 2000 13:23:45 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: HTTP::Request=HASH(0x7bb141c) ?
Message-Id: <brian-0905001323450001@sri.dialup.access.net>
In article <8f7nts$9pv$0@216.155.33.35>, The WebDragon <nospam@devnull.com> wrote:
> my $request = new HTTP::Request 'GET',
>print OUT "$request";
>why does $request only contain "HTTP::Request=HASH(0x7bb14ac)" at output
>time?
because you aren't using the module's interface to access the
object data. see the module documentation for details.
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 9 May 2000 11:46:18 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: Install Help needed Mail::Sender.pm
Message-Id: <391840c3$0$25099@wodc7nh1.news.uu.net>
Does anyone out there use the Mail::Sender.pm module from jendra?
If so, how do I install this module?
On the site http://jenda.mccann.cz there are four files to grab.
Mail::Sender.pm
Sender.pm html
Sender.pm.txt
Mail-Sender-0.7.05.tar.gz
So I grabbed the files, but can't figure out how to install them.
Could someone help me with this?
Thanks
Scott
------------------------------
Date: Tue, 09 May 2000 13:21:38 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Is Perl fast enough?
Message-Id: <brian-0905001321380001@sri.dialup.access.net>
In article <8f83aa$v3l$1@nnrp1.deja.com>, pohanl@my-deja.com wrote:
>The reason I am asking is, I created a neat perl program that
>resembles a dynamic glossary.
>But anyhow, because it is a dictionary type of perl program, it
>uses a lot of memory and it does a lot of comparisons (it will
>need speed).
the problem is not necessarily the language used, but how you set
up the system. if the system is slow because the language that
was used to implement parts of it, then switching to another language
will probably only solve the problem for the current scale, but have
the same problem at larger scales.
i suggest looking closely at what the system is doing, and find the
parts that it doesn't need to do. for instance, if you are generating
the recursive comparisons every time someone accesses a term in the
glossary, modify the system to cache that result and update it only
when the glossary changes (as appropriate).
additionally, you may consider computing other results when the system
is not loaded, instead of when they are requested. once this is
implemented, sending data to the user is simply dumping the contents
of a file, which is much better than computing it no matter which
language you use.
i do this sort of thing extensively for our very high traffic web
clients. the bottleneck has never been the language though - it's
always the database stuff. changing the implementation language
doesn't significantly improve performance.
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 2991
**************************************