[18329] in Perl-Users-Digest
Perl-Users Digest, Issue: 497 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 15 18:16:10 2001
Date: Thu, 15 Mar 2001 15:15:28 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984698127-v10-i497@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 15 Mar 2001 Volume: 10 Number: 497
Today's topics:
Re: HTTP Client Question (David H. Adler)
Re: HTTP Client Question (David H. Adler)
Re: HTTP Client Question <webmaster@webdragon.munge.net>
Re: HTTP Client Question <webmaster@webdragon.munge.net>
Re: HTTP Client Question <flavell@mail.cern.ch>
Re: HTTP Client Question <revjack@revjack.net>
Limiting the number of connections with a fork'ing serv <djberge@uswest.com>
Re: Limiting the number of connections with a fork'ing <djberge@uswest.com>
Newbie need help... <marcab@hotmail.com>
Re: Newbie need help... <shanem@ll.mit.edu>
parameters <Waarddebon@chello.nl>
Re: parameters <Jonathan.L.Ericson@jpl.nasa.gov>
pattern matching <milliwave@rfengineering.freeserve.co.uk>
Re: pb with a cgi script nobull@mail.com
Re: Perl FAQ? <mjcarman@home.com>
Re: Perl FAQ? <lmoran@wtsg.com>
perl hacker wanted <uri@sysarch.com>
Re: Pipe delimited string parsing or Newbie needs a clu <lbrodeur@NOSPAMwdconsulting.com>
Powers <g9karkav@cdf.toronto.edu>
Re: Powers (Abigail)
Re: Print own "die" message <mischief@velma.motion.net>
Read enum values from a column with perl DBI / Cannot u <linux@wizdom.org.uk>
Re: RFC: FAQ3 update -- Using less memory <mischief@velma.motion.net>
Re: Unix trap command in Perl on Win? <dlheim@collins.rockwell.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Mar 2001 19:31:42 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: HTTP Client Question
Message-Id: <slrn9b264s.9nh.dha@panix2.panix.com>
On Thu, 15 Mar 2001 11:36:39 -0600, Al Spohn <spohn@mayo.edu> wrote:
>
>Gary O'Keefe <gokeefe@gssec.bt.co.uk> wrote in message
>
>> But power in the hands of the common person is not a bad thing.
>> Killfiling someone who fills up your forum with a lot of (or any) crap
>> is cool. Just don't go reaching for the usenet weapons of mass
>> destruction.
>
>Couldn't agree more, but making a public display implies (for me at least)
>that the person's agenda goes well beyond the simple God-given right of
>noise reduction.
The way I see it, a public killfiling says that the person doing it
thinks that the person getting killfiled is worth killfiling. I. e. it
is a public statement of an opinion.
It is not as though Abigail is *quiet* about her reasons for killfiling
people. Although I think highly of abigail, I would never killfile
someone *just* because she did so. If I did so (which I don't, as a
general rule), it would be because I agreed with her *reasons* for doing
so. Anyone who killfiles purely on the basis of someone else doing so
is, at best, abdicating his or her power of decision.
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
I have 'somefunc' bound to the 'any' key.
- Jim Flanagan, c.l.p.misc
------------------------------
Date: 15 Mar 2001 19:57:05 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: HTTP Client Question
Message-Id: <slrn9b27kh.9nh.dha@panix2.panix.com>
On Thu, 15 Mar 2001 16:23:26 GMT, Bob Dilworth <avast@hortonsbay.com> wrote:
>
>I guess I just don't understand why the public "plonking", the angry
>RTFM responses, etc., etc., are necessary. Doesn't it take time away
>from reading the things you want to read? How hard is it to click the
>left mouse button a couple of times to move on to the next posting?
>I'm actually very interested in answers to these questions because I
>just don't understand where all the anger comes from.
Without doubt, anyone coming into the fray will not understand. Perhaps
I can provide some reasons.
Usenet is, for better or worse, a world with customs. It *used* to be
that you were rarely, if ever, given access to it until you learned what
those were. For instance, off topic posts are a nono. Same with job
postings in non .jobs groups. With the descent of the entire populace
onto the internet, this learning of the rules has come to be seen as
optional. Those who have been on usenet for years and saw for
themselves *why* those customs came into being, do not take well to
this, and try to educate those less aware of them.
Perl is, for better or worse, a very popular language for CGI
programming. With the descent of the entire populace into the realm of
web programming, understanding things such as the fact that Perl and CGI
are *entirely* different things has come to be seen as unimportant.
Sadly, it also seems to be seen by many as unimportant that they do any
of their own work. The people here are not a paid help desk, despite
the fact that some of them are some of the more knowledgeable (and often
helpful) people in the perl community - but people treat them as though
they are *required* to help them. Many of them spend a lot of their
time correcting bad answers given by people who, although helpful, are
*not* extremely knowledgeable.
One of the tenets of both usenet and the perl community is that you
familiarize yourself with the available information *before* you ask
others for help - particularly the FAQs. People have spent a lot of
time writing these for the express purpose of making it easier for
people to find the answers they need without asking the experts the
questions for the 300,472,000th time.
And here we come to the crux of the problem. People in a position of
authority and knowledge have worked *very* hard to be helpful, both by
writing documentation and by answering questions. These people get
*very* weary of answering questions from people who cannot be bothered
to look on their own systems, where, more often than not, the answers
can be found. I have *never* seen anyone be unpleasant to someone who
has indicated that they have tried to work out their problem themselves
and have read the documentation, but still don't have an answer.
clp.misc has a *lot* of traffic. This accounts for off-topic posts (and
repeated FAQs) being particularly unwelcome. In fact, it would not
surprise me to find that a lot of the unpleasantness comes
(intentionally or not) from a feeling that if rebuffed sufficiently, the
people who post these questions will act in a way that might be
considered more appropriate next time they have a question.
The repeated (and I mean *repeated*) disgregard for much or all of what
I've discussed above (often quite willful disregard) has made a number
of the regulars quite, as has been said in this thread, "grumpy" - and
that's not surprising. Some people are nicer when they're grumpy than
others - that's the way people are. This is unfortunate, but not overly
surprising.
The point may be driven home by the fact that many people, when given a
pointer to where their question is answered (often *in full*), will make
loud noises about how unpleasant people are here because we didn't feel
the need to actually parrot the documentation to them. I will not haul
out the "fish" metaphor again, but I'm sure you'll see it here somewhere
in short order.
Abigail (whose actions are part of the inspiration for this thread) is
often sarcastic, often curt, often dismissive. But when someone comes
to this newsgroup with a legitimatly difficult question, she is often
one of the posters willing to discuss the issue. Many, unfortunately,
don't get that far.
The jeapoardy posting thing is not confined to clp.misc, but is
particularly disliked here. I will not argue the point. That's been
done enough. What I will note is that a number of people have seen
there to be a great relation between top-posting and
off-topic/faq/other-considered-not-good-things posts. I have not made
such a study myself, but I will admit that I have seen little to dispute
this theory.
Ok. I'm getting to the point where I'm losing my thread, so I'll
summarize.
Many posters do things that, by the customs of usenet and particularly
this group, are considered rude. Many of the longtime denizens of
clp.misc have lost their patience. Feel free to read the above for some
details.
Hopefully this will make things, if not more pleasant, more
comprehensible.
Yours for a better usenet,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
A picture is worth
several hundred thousand words...
in the right haiku - Damian Conway
------------------------------
Date: 15 Mar 2001 21:24:03 GMT
From: "Scott R. Godin" <webmaster@webdragon.munge.net>
Subject: Re: HTTP Client Question
Message-Id: <98rbtj$lqh$2@216.155.32.198>
In article <3aafa15d.12498754@news.mco.edu>, avast@hortonsbay.com
wrote:
| The above little worthless commentary from one of the members of the
| clpm Taliban indicates that you've violated on of their favorite
| "rules" - posting the answer to a message before the part of the
| message you're commenting on. Abigail is indicating that you're now
| part of her kill file which means she'll not be reading any of your
| postings any more. My advice is to welcome such "plonking" since
| it'll weed out the Taliban and you can concentrate on getting help
| from folks who are less concerned with a slavish regard for random
| rules.
said 'rules' (read: "posting conventions" not "rules") are neither
worthless, slavish, nor random; nor are they in any way, shape, or form,
difficult, or confusing to effect.
what's a "taliban" ?
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 15 Mar 2001 21:29:45 GMT
From: "Scott R. Godin" <webmaster@webdragon.munge.net>
Subject: Re: HTTP Client Question
Message-Id: <98rc89$lqh$3@216.155.32.198>
In article <3ab0e842.9357992@news.mco.edu>, avast@hortonsbay.com wrote:
| There's an interesting assumption in the above snippet. First - just
| because someone comes to clpm to ask what you may consider an
| inappropriate question does not imply that they have little or no
| motivation to learn Perl. It may be true for some but not for all.
| Publicly "plonking" them for "jeopardy" posting serves no purpose
| other than, in my view, arrogance. It is also seems quite mean and
| intolerant. Why waste all that energy on public humiliation when you
| can simply ignore the posting?
on THIS, you and I can agree.
Generally in such cases I tend to advise said poster of the 'posting
conventions' 'round these parts, and attempt to educate them (via
several URL's of discussion of the issue) as to why it's considered a
bad thing around here.
Their *response* to said helpful information is what may or may not get
them plonked (or simply ignored). :)
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Thu, 15 Mar 2001 22:42:19 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: HTTP Client Question
Message-Id: <Pine.LNX.4.30.0103152241260.17630-100000@lxplus003.cern.ch>
On 15 Mar 2001, Scott R. Godin wrote:
> what's a "taliban" ?
Something that blows up historical treasures.
------------------------------
Date: 15 Mar 2001 22:34:57 GMT
From: revjack <revjack@revjack.net>
Subject: Re: HTTP Client Question
Message-Id: <98rg2h$fo4$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
: You *so* missed the point here.
I missed it too, at the time, and posted a negative critical
followup then. I've since come around to supporting your
actions, and I'd like to waste everyone's time here by
posting this.
Sorry, Randal, I was wrong. :)
--
___________________
revjack@revjack.net
------------------------------
Date: Thu, 15 Mar 2001 16:01:30 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Limiting the number of connections with a fork'ing server
Message-Id: <3AB13BBA.7FD81231@uswest.com>
--------------9C52AADB4EBC24F762C5CE4F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi all,
I've got a fork'ing echo server (yes, it's a toy while I'm learning). I want
to limit the maximum number of connections to 2. However, because I'm
fork'ing, simply using "IO::Socket::INET->new(Listen => 2) doesn't work. I'd
rather not have 100 or more children being created at 5 MB per child!
Will I simply have to 'grep' through a ps -ef command in this case? Is there a
better way? I realize this is somewhat silly since there's no point in
fork'ing if I want to limit the maximum number of connections to such a small
number, but hey, I just wanna know for academic reasons.
Thanks in advance.
Dan
--
"Evil will always triumph because Good is *dumb*"
- Dark Helmet, Spaceballs
--------------9C52AADB4EBC24F762C5CE4F
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi all,
<p>I've got a fork'ing echo server (yes, it's a toy while I'm learning).
I want to limit the maximum number of connections to 2. However,
because I'm fork'ing, simply using "IO::Socket::INET->new(Listen => 2)
doesn't work. I'd rather not have 100 or more children being created
at 5 MB per child!
<p>Will I simply have to 'grep' through a ps -ef command in this case?
Is there a better way? I realize this is somewhat silly since
there's no point in fork'ing if I want to limit the maximum number of connections
to such a small number, but hey, I just wanna know for academic reasons.
<p>Thanks in advance.
<p>Dan
<pre>--
"Evil will always triumph because Good is *dumb*"
- Dark Helmet, Spaceballs</pre>
</html>
--------------9C52AADB4EBC24F762C5CE4F--
------------------------------
Date: Thu, 15 Mar 2001 17:01:11 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: Limiting the number of connections with a fork'ing server
Message-Id: <3AB149B7.42D1F742@uswest.com>
--------------2C2E79072532086E269AE30F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Daniel Berger wrote:
> Hi all,
>
> I've got a fork'ing echo server (yes, it's a toy while I'm learning). I want
> to limit the maximum number of connections to 2. However, because I'm
> fork'ing, simply using "IO::Socket::INET->new(Listen => 2) doesn't work. I'd
> rather not have 100 or more children being created at 5 MB per child!
>
> Will I simply have to 'grep' through a ps -ef command in this case? Is there
> a better way? I realize this is somewhat silly since there's no point in
> fork'ing if I want to limit the maximum number of connections to such a small
> number, but hey, I just wanna know for academic reasons.
>
> Thanks in advance.
>
> Dan
>
Hmmm....looks like the "Fork::Queue" module does exactly that!
--
"Evil will always triumph because Good is *dumb*"
- Dark Helmet, Spaceballs
--------------2C2E79072532086E269AE30F
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Daniel Berger wrote:
<blockquote TYPE=CITE>Hi all,
<p>I've got a fork'ing echo server (yes, it's a toy while I'm learning).
I want to limit the maximum number of connections to 2. However,
because I'm fork'ing, simply using "IO::Socket::INET->new(Listen => 2)
doesn't work. I'd rather not have 100 or more children being created
at 5 MB per child!
<p>Will I simply have to 'grep' through a ps -ef command in this case?
Is there a better way? I realize this is somewhat silly since there's
no point in fork'ing if I want to limit the maximum number of connections
to such a small number, but hey, I just wanna know for academic reasons.
<p>Thanks in advance.
<p>Dan
<br> </blockquote>
Hmmm....looks like the "Fork::Queue" module does exactly that!
<pre>--
"Evil will always triumph because Good is *dumb*"
- Dark Helmet, Spaceballs</pre>
</html>
--------------2C2E79072532086E269AE30F--
------------------------------
Date: Thu, 15 Mar 2001 20:56:36 +0100
From: "Marc ABEHASSERA" <marcab@hotmail.com>
Subject: Newbie need help...
Message-Id: <3ab11e7b@news.microsoft.com>
Hi all,
I'm totally new to perl and I need to parse some web logs.
The script should extract each column and replace the value with an ID,
based on other files which should contains all the columns data and for each
an unique value.
exemple :
Web log :
2000-01-01 default.asp 200
Time File
1 2000-01-01
URL File
1 Default.asp
HTTP Values
1 200
The Script goes here.... and send back a new file
New File
1 1 1
and if the data doesn't not exist in the column, it should add it to the
data files...
Does anyone has an idea where to start ?? any books or websites ? or small
samples so that I could understand how it should works ???
THANKS for any help.
Marc.
------------------------------
Date: Thu, 15 Mar 2001 16:57:43 -0500
From: Shane McDaniel <shanem@ll.mit.edu>
Subject: Re: Newbie need help...
Message-Id: <3AB13AD7.A782BAB9@ll.mit.edu>
As with all perl newbies you should investe in either Learning Perl or
Programming Perl both by O'reilly. If you are a previous programmer you
can probably get away with PP, otherwise LP will start you off.
Marc ABEHASSERA wrote:
>
> Hi all,
>
> I'm totally new to perl and I need to parse some web logs.
> The script should extract each column and replace the value with an ID,
> based on other files which should contains all the columns data and for each
> an unique value.
>
> exemple :
>
> Web log :
> 2000-01-01 default.asp 200
>
> Time File
> 1 2000-01-01
>
> URL File
> 1 Default.asp
>
> HTTP Values
> 1 200
>
> The Script goes here.... and send back a new file
>
> New File
> 1 1 1
>
> and if the data doesn't not exist in the column, it should add it to the
> data files...
>
> Does anyone has an idea where to start ?? any books or websites ? or small
> samples so that I could understand how it should works ???
>
> THANKS for any help.
>
> Marc.
------------------------------
Date: Thu, 15 Mar 2001 20:22:19 GMT
From: "Waarddebon" <Waarddebon@chello.nl>
Subject: parameters
Message-Id: <%v9s6.2029072$%C1.26695372@Flipper>
With my cgi-script i read out parameters submitted by a form, like this:
$user=$q->param('user');
$password=$q->param('password');
and I store a parameter in a variable like this:
@ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'});
$ARGV[0] =~ s/\W//g;
$value=$ARGV[0];
These three variables($user,$password and $value) are then written to a
file.
Here is my question:
How to prefent that the user renews the page or clicks on the back and
forward button, because then
everything will be stored twice !! It must be possible to store multiple
values of the same user in
the file, but not when the user renews or clicks back and forward...
Hope you understand my question and can help me out...
------------------------------
Date: 15 Mar 2001 21:22:51 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: parameters
Message-Id: <86itla7mms.fsf@jon_ericson.jpl.nasa.gov>
"Waarddebon" <Waarddebon@chello.nl> writes:
> These three variables($user,$password and $value) are then written to a
> file.
>
> Here is my question:
> How to prefent that the user renews the page or clicks on the back and
> forward button, because then
> everything will be stored twice !! It must be possible to store multiple
> values of the same user in
> the file, but not when the user renews or clicks back and forward...
It sounds to me that you need a more sophisticated database system.
Take a look at the DBI module, especially the DBD::RAM database
driver. Start your search at search.cpan.org.
Jon
------------------------------
Date: Thu, 15 Mar 2001 22:17:54 -0000
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: pattern matching
Message-Id: <98rf06$dao$1@newsg2.svr.pol.co.uk>
Hello I'm new to perl and have a couple of questions, based on code which I
have written recently.
question1) Initilisation
question2) pattern matching
question 3) While loops
Question 1
---------------
I have written the code below, and would like to know why the perl
interpreter complains about
an uninitilized variable. I would also apprecite if you could inform me how
to declare variables
locally and globally?
The Code for question 1
---------------------------------
$flagds2 = 0;
while (<FILE>)
{
chomp;
if ($_ =~ m/^DS\s(\d*)\s(\d*)\s(\d*);/)
$comp =$1;
$flagds2 =1;
if ($table[$comp]==$comp) # Warning indicates
to this line
{
#print "$comp\n";
$tcell_type_flag = Hello;
printf(ONE "Entering the Sub Routine: $1\n");
printf(TWO "Entering the Sub Routine: $1\n");
}
else
{
$tcell_type_flag = Goodbye;
}
}
Question 2
--------------
I am trying to match the following pattern in a big file! (The numbers of P
are randomn)
I need to detect each one of the "P" and capture the digits (both + and -ve
numbers)
Example:
P 1234 4567 23 244 445 1236 1234 7890
1234 555 6 666 -450 -900 670 -30;
P 1234 456 -700 -800 -76000 -600 -900 -785
1234 455;
P 1234 4567 23 244 445 1236 1234 7890
1234 555 6 666 -450 -900 670 -30
45 44 3 -20;
Code I have Written
---------------------------
elsif ((($_ =~
m/^P\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\d*|-\d*)/)
or ($_ =~
m/^\s\s(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\d*|-\d*);/)
or ($_ =~
m/^\s\s(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)\s*(\S*)/) or
($_ =~ m/^\s\s(\S*)\s*(\S*)\s*(\S*)\s*(\S*);/) or ($_ =~
m/^\s\s(\S*)\s*(\S*;)/)) and (($flagds2 ==1) and ($tcell_type_flag eq
Leaf)))
{
$Pflag =1;
if ($_ =~ m/^\s\s(\S*)\s*(\S*);/)
{
$x1 = $1; # Polgon Set 1 X -coordinate
$y1 = $2; # Polgon Set 1 Y -coordinate
@polyvarx =$x1;
@polyvary =$y1;
printf(POLY "$x1 $y1\n");
}
elsif ($_ =~ m/^\s\s(\S*)\s*(\S*)\s*(\S*)\s*(\S*);/)
{
$x1 = $1; # Polgon Set 1 X -coordinate
$y1 = $2; # Polgon Set 1 Y -coordinate
$x2 = $3; # Polgon Set 2 X -coordinate
$y2 = $4; # Polgon Set 2 Y -coordinate
@polyvarx =($x1, $x2);
@polyvary =($y1, $y2);
printf(POLY"$x1 $y1 $x2 $y2\n");
}
else
{
$x1 = $1; # Polgon Set 1 X -coordinate
$y1 = $2; # Polgon Set 1 Y -coordinate
$x2 = $3; # Polgon Set 2 X -coordinate
$y2 = $4; # Polgon Set 2 Y -coordinate
$x3 = $5; # Polgon Set 3 X -coordinate
$y3 = $6; # Polgon Set 3 Y -coordinate
$x4 = $7; # Polgon Set 4 X -coordinate
$y4 = $8; # Polgon Set 4 Y -coordinate
@polyvarx =($x1, $x2, $x3, $x4);
@polyvary =($y1, $y2, $y3, $y4);
printf(POLY "$x1 $y1 $x2 $y2 $x3 $y3 $x4 $y4\n");
}
IS there anyway to shrink the $_ =~ pattern to something more smaller much
more efficient than the
looooong one I have written. It should be able to detect both +ve and
negative numbers, and I don't
want to assign "ANY" semi-colons present at the end of the P patterns to
variables like $1 $2 etc
question 3
---------------
If I have two spearate while loops does while loop no execute first, and
then while loop2?
while(loop1)
{
}
while(loop2)
{
}
Thanking You for your input
Kev
------------------------------
Date: 15 Mar 2001 19:03:32 +0000
From: nobull@mail.com
Subject: Re: pb with a cgi script
Message-Id: <u9snkeetx7.fsf@wcl-l.bham.ac.uk>
Mathieu Peltier <Mathieu.Peltier@netcourrier.com> writes:
> Subject: pb with a cgi script
Please try to use Usenet subject lines that characterise the essense
of subject matter of the thread and not to describe what you happened
to be doing at the time that the issue arrose.
Your question has nothing whatever to do with CGI. The behaviour in
question would be exactly the same if your script was written to run
from shell.
Can you explain the reasoning by which you concluded that the problem
you are experiencing was in any way related to the fact that your
script is being called through the CGI API?
> $pid = open(RESULTS,"-|");
> unless ( defined($pid) ) {
> error( $q, "Couldn't open pipe to subprocess." );
> }
>
> if ( $pid ) {
> # processus pere
> while (<RESULTS>) {
> print;
> }
> close RESULTS;
>
> } else {
> # processus fils
> # $COMMAND contains the name of the C program
> exec $COMMAND, $tmpfilename;
> print $q->p( "Couldn't exec command." );
> exit 1;
> }
> When an error occurs (core dump) in my C program, "Could'nt exec
> command" is never displayed.
Well of course it isn't. It is only displayed if the exec() fails.
Please read at least the first paragraph (preferably more) of the
documentation of the exec() function.
To find out how the child process exited check the value of $? after
you close(RESULTS).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 15 Mar 2001 12:02:46 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Perl FAQ?
Message-Id: <3AB103C6.F539D577@home.com>
kellyboy wrote:
>
> [...] these faq that yahoo came up still doesn't have answer to my
> question... :-)
Well, then it probably isn't an FAQ. Maybe a less frequently asked one.
If you've consulted the docs and can't find an answer, this is the place
to ask. What is it you're trying to do?
-mjc
------------------------------
Date: Thu, 15 Mar 2001 16:19:28 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Perl FAQ?
Message-Id: <74c2btot5i78pfhfkutiu7o4bsofb7kfqc@4ax.com>
On Wed, 14 Mar 2001 12:36:08 -0600, "kellyboy" <kellyboy@nospanner>
wrote wonderful things about sparkplugs:
>Is there any Perl FAQ out there on the Net??
I assume the one that comes with Perl is problematic for you (it was
for me. But then Tad M "learned me" how to use perldoc and it's
mostly all better.) Try this site:
http://www.perldoc.com/
>
>Not just "FAQ" but a really comprehensive FAQ that cover many topics under
>Perl?
>
>kellyboy
--
Member of the Nondeterministic Football League
------------------------------
Date: Thu, 15 Mar 2001 22:37:15 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: perl hacker wanted
Message-Id: <x7ofv28xr7.fsf@home.sysarch.com>
this is a test of the dha no jobs posting responder system. we are
trying to see if dha has updated his responder text to reflect the new
location and addresses of the perl jobs list. if this was a real jobs
post it would have been off topic and excused by the clueless author as
why not post a perl job where the perl hackers hang out. remember, this
is only a test. if you see a real perl jobs post in this newsgroup,
please duck and cover and wait for the dhabot to followup. if you
interfere you may get caught in a nasty flame war (hence the duck and
cover warning).
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Thu, 15 Mar 2001 22:26:01 GMT
From: "Lawrence Brodeur" <lbrodeur@NOSPAMwdconsulting.com>
Subject: Re: Pipe delimited string parsing or Newbie needs a clue
Message-Id: <Zjbs6.17025$R_6.1806944@newsread2.prod.itd.earthlink.net>
Thank you Darryl
That hit the spot!!
I've disected your code and understand what my problems were.
If you are ever in the northwest suburbs of chi, I'll buy you lunch.
Larry
"Darryl Olthoff" <olthoff@multiboard.com> wrote in message
news:98r087$nq$1@panther.uwo.ca...
> > I have a file of pipe delimited records which I need to parse.
> >
> > I need to modify each field in each record and write that to a new file.
> >
> > I have been going around in circles with while and split and am at a
loss.
> >
> > While I've never been a strong proponant of spoon feeding, can someone
> > please help?
>
> open(SRC, filename) || die("Unable to open source file: filename\n");
> open(DST, '>' . dest_filename) || die("Unable to open new file\n");
> while (<SRC>) {
> chomp;
> ($field1, $field2...) = split(/\|/, $_);
> $field1 = 'something new';
> printf(DST "%s\n", join('|', $field1, $field2...));
> };
> close(SRC);
> close(DST);
> unlink(filename);
> rename(dest_filename, filename);
>
>
>
------------------------------
Date: Thu, 15 Mar 2001 18:53:42 GMT
From: "Kauser Ali Karim ;)" <g9karkav@cdf.toronto.edu>
Subject: Powers
Message-Id: <Pine.LNX.4.30.0103151348030.4037-100000@babirusa.cdf.toronto.edu>
Hi,
Is there a function in perl, similar to pow() in C,
that would enable me to get 10^some_number.
Thanks.
Kauser
------
------------------------------
Date: 15 Mar 2001 19:18:34 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Powers
Message-Id: <slrn9b25ca.p0e.abigail@tsathoggua.rlyeh.net>
Kauser Ali Karim ;) (g9karkav@cdf.toronto.edu) wrote on MMDCCLIII
September MCMXCIII in <URL:news:Pine.LNX.4.30.0103151348030.4037-100000@babirusa.cdf.toronto.edu>:
**
** Hi,
**
** Is there a function in perl, similar to pow() in C,
** that would enable me to get 10^some_number.
10 ** $some_number;
Abigail
--
split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
------------------------------
Date: Thu, 15 Mar 2001 22:49:10 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Print own "die" message
Message-Id: <tb2hn6419lsh32@corp.supernews.com>
Bart Lateur <bart.lateur@skynet.be> wrote:
> What A Man ! wrote:
>>> I think you want:
>>>
>>> use CGI::Carp qw(fatalsToBrowser);
>>> die "Fatal error messages are now sent to browser";
>>>
>>> See perldoc CGI::Carp
>>Thanks, Brad.. but I was hoping not to have to use another module. I'm
>>using 10 modules in the script already. Is there another way?
> There's nothing stopping you from looking at the source of the module.
> The whole trick is in setting $SIG{__DIE__}, in which you can do
> whatever you like with the error message. And don't forget to quit the
> program when you're through, or you're stuck with your own problem.
Or even execute a block in which your print() your message then
exit() -- or you can do that inside a die handler...
Chris
--
Christopher E. Stith
Programming is a tool. A tool is neither good nor evil. It is
the user who determines how it is used and to what ends.
------------------------------
Date: Thu, 15 Mar 2001 22:07:10 +0000
From: Mark Worsdall <linux@wizdom.org.uk>
Subject: Read enum values from a column with perl DBI / Cannot understand this match thing or why it is not working
Message-Id: <cj5a8iAO0Ts6EwA+@worsdall.demon.co.uk>
Hi,
Trying to read enum values from a specifed column but it does not work
cos I do not understand the /^enum part.
Any help?
my $dbh = DBI->connect( "dbi:$datasrc", "$sqlUser", "$sqlPassword") or
die DBI->errstr;
my $sth = $dbh->prepare("SELECT $column FROM $sqlTable");
$sth->execute;
#@row = $sth->fetchrow_array;
/^enum\((.*)\)/ and do {
my $values = $1;
$values =~ s/^'//;
$values =~ s/'$//;
my @values = split /','/, $values;
# now print your dropdown with @values
foreach (@values) {
print $_ . "<br>";
}
};
--
Mark Worsdall
------------------------------
Date: Thu, 15 Mar 2001 19:43:47 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: RFC: FAQ3 update -- Using less memory
Message-Id: <tb26rjacnopjb4@corp.supernews.com>
In comp.lang.perl.moderated Heiner Marxen <Heiner.Marxen@drb.insel.de> wrote:
> In article <3AA56BEC.A7F9F0CD@home.com>,
> Michael Carman <mjcarman@home.com> wrote:
> [snip]
>>=item * Consider using C<eval BLOCK>
>>
>>If you need to initialize a large variable in your code, you
>>might consider doing it with an eval statement like this:
>>
>> my $large_string = eval ' "a" x 5_000_000 ';
>>
>>This allows perl to immediately free the memory allocated to the
>>eval statement, but carries a (small) performance penalty.
> Sorry, I just don't get it: which "memory allocated to the eval"?
The memory used to create the large string by concatenating the
q<"a"> five million times.
> And also, without the eval there is no such memory allocated in the
> first place, since there is no eval, right? So, what does
The memory is allocated, but to the main program instead of the
eval. I think it therefore does not get released as soon.
> my $large_string = "a" x 5_000_000;
> allocate, what the eval version does free?
They both allocate the same (except for the overhead of the eval).
The difference is when the memory gets freed.
Chris
--
Christopher E. Stith
You must not lose faith in humanity. Humanity is an ocean;
if a few drops of the ocean are dirty, the ocean does not
become dirty. -- Mohandas K. Gandhi
------------------------------
Date: Thu, 15 Mar 2001 12:17:49 -0600
From: "David L. Heim" <dlheim@collins.rockwell.com>
Subject: Re: Unix trap command in Perl on Win?
Message-Id: <3AB1074D.D0844297@collins.rockwell.com>
Thanks.
Exactly the help that I needed.
Anno Siegel wrote:
>
> According to David L. Heim <dlheim@collins.rockwell.com>:
> > -=-=-=-=-=-
> >
> > Is there a way to mimic the behavior of the Unix "trap" command in
> > Perl on a windows platform?
>
> See what the %SIG array does.
>
> [snip]
>
> Anno
--
=======================================================================
David L. Heim phone: (319)295-8616
Mechanical Design Support page: (319)490-0933
Rockwell Collins, Inc. fax: (319)295-4182 (Include M/S 106-186)
400 Collins Road NE email: dlheim@collins.rockwell.com
Cedar Rapids, IA 52498
M/S 106-186
=======================================================================
------------------------------
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 V10 Issue 497
**************************************