[12981] in Perl-Users-Digest
Perl-Users Digest, Issue: 391 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 5 19:17:17 1999
Date: Thu, 5 Aug 1999 16:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 5 Aug 1999 Volume: 9 Number: 391
Today's topics:
ActiveState's PerlScript -- funny problems <john@dlugosz.com>
Re: counterfeit cancels, was Re: chomp not working <flavell@mail.cern.ch>
Re: Determining if a POP3 message has been read (Eric Bohlman)
FAQ doesn't work in this case! inlandpac@my-deja.com
FAQ doesn't work in this case! inlandpac@my-deja.com
Re: Fwd: Re: My Last Words on =- vs comma (Chris Nandor)
Re: Get Executables path (Michael Wang)
Re: Help - Matching a variable in RegEx. <mike@crusaders.no>
Re: Help with a more elegant solution to common problem (Bill Moseley)
Re: Help with a more elegant solution to common problem <ltl@rgsun5.viasystems.com>
Re: How do I replace a "space" character? <makarand_kulkarni@my-deja.com>
Re: How do I replace a "space" character? (Larry Rosler)
Re: Is there any way to get user name <aqumsieh@matrox.com>
Re: My Last Words on => vs comma (Steve Linberg)
Re: Nastiness contrary to the spirit of perl? why@invite.flames
Re: Perl seems to be LAME! (Michael Wang)
Re: Signal handler to restart app david_deja@my-deja.com
Re: upload file <rootbeer@redcat.com>
web bot needed <takinmus@umich.edu>
Re: Why is it.... [REPOST] (Chris Nandor)
Re: Why is it.... [REPOST] <jbc@shell2.la.best.com>
Re: Why is it.... [REPOST] <elaine@chaos.wustl.edu>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 5 Aug 1999 17:52:38 -0500
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: ActiveState's PerlScript -- funny problems
Message-Id: <B147E403C4A425EE.37667E58323C4915.9F8670DC60950671@lp.airnews.net>
Here is an illustration of the problem I mentioned earlier (see test.html
file below). If $main::document is assigned to, the Perl engine crashes.
It doesn't even have to execute that statement -- just having it in the
script is enough! When the problem line is commented out, you will see a
report on all the symbols in the main package. 'document' is not one of
them.
Can anybody shed some light on this, please?
--John
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>script testing</title>
<SCRIPT LANGUAGE="PerlScript">
sub foo
{
foreach $name (sort keys %main::) {
$window->document->write ("$name<BR>");
}
}
sub bar
{
# this works.
$documentX= 5;
#this crashes Perl
# $document= 5; #un-comment this line to illustrate problem.
}
</SCRIPT>
</head>
<body>
<SCRIPT LANGUAGE="PerlScript">
foo();
# note that bar isn't called! The presence of $document= in the program is
enough to cause problems.
</SCRIPT>
</body>
------------------------------
Date: Thu, 5 Aug 1999 22:50:02 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: counterfeit cancels, was Re: chomp not working
Message-Id: <Pine.HPP.3.95a.990805223909.23290D-100000@hpplus03.cern.ch>
On Thu, 5 Aug 1999, Alan J. Flavell wrote:
(I'm superseding my previous posting)
Further investigation shows that the cancels that we've been discussing
here were not targetted specifically at clpm; the offender had clearly
been at it for at least 40 minutes before the cancel that I had picked
up and am quoting below, and had been rampaging across comp.* groups in
the meantime. Some kind of pathetic script kiddie, presumably.
Curiously the attack didn't seem to have got a mention on the
news.admin.net-abuse* groups, at least not until TC posted one.
> Path:
> cern.ch!EU.net!news-peer.gip.net!news.gsl.net!gip.net!news-peer1.sprintlink.net!
> news-in-central.sprintlink.net!news.sprintlink.net!news.VirtualVillage.com
> Newsgroups: comp.lang.perl.misc
> From: "M.Ray@ulcc.ac.uk (Malcolm Ray)" <M.Ray@ulcc.ac.uk>
> Subject: cancel <slrn7qgrjo.46k.M.Ray@carlova.ulcc.ac.uk>
> Message-ID: <B4D2B6EFB757D211B23B00805F59AC43BBC371@ukmail.virtualvillage.co.uk>
> Sender: "M.Ray@ulcc.ac.uk (Malcolm Ray)" <M.Ray@ulcc.ac.uk>
> Date: Thu, 5 Aug 1999 05:08:27 -0500
> Lines: 3
> X-Newsreader: Microsoft (R) Exchange Internet News Service Version 5.5.2448.0
> Control: cancel <slrn7qgrjo.46k.M.Ray@carlova.ulcc.ac.uk>
------------------------------
Date: 5 Aug 1999 22:28:00 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Determining if a POP3 message has been read
Message-Id: <7od35g$ggg@dfw-ixnews19.ix.netcom.com>
rook268@my-deja.com wrote:
: I'm tinkering with a web-based email client written in Perl. I'd like
: to be able to see only messages that haven't been read yet. I've looked
: through the Net::POP3 documentation, and can't seem to find anything
: that will tell you if a particular message has been read before. Am I
: missing something in Net::POP3, or is there another module I can use for
: this?
The problem is that there's nothing in the POP3 protocol itself for
keeping track of this sort of thing. You'll have to do it yourself,
either by keeping some sort of history locally (though you'll still have
to fetch at least part of each message from the server to determine if
it's in your history) or enforce a policy of deleting any messages from
the server after they've been fetched.
------------------------------
Date: Thu, 05 Aug 1999 22:22:45 GMT
From: inlandpac@my-deja.com
Subject: FAQ doesn't work in this case!
Message-Id: <7od2ra$21u$1@nnrp1.deja.com>
<IMG SRC="/directory/directory.fds/image/somewhere/$somevar/file.gif"
BORDER="0" WIDTH="47" HEIGHT="24" ALT="Search">
The above HTML tag is not removed when using LWP's HTML::Parser and I
cannot find a way to remove this type of tag through long-form
scripting.
Basically, I have a script that fetches URLs, reads in the text using
LWP::UserAgent, removes all HTML and only displays the text (that would
normally be visible to the viewer).
I have found that this problem occurs in more than this type of tag
where SRC attributes are extensive and complex (and include unusual
characters) or where there are attributes within tags that are not
normally used.
I would like to challenge our Perl Gurus out there to come up with a
pattern match to remove ALL HTML tags no matter how complex or how many
elements/attributes there are (so only the text between the tags will
be displayed).
I have yet to see anyone come up with anything. I have referenced many
books, have tried many patterns and have even used the methods in the
Perl FAQ.
I don't want to use HTML::Parser for this.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 05 Aug 1999 22:22:58 GMT
From: inlandpac@my-deja.com
Subject: FAQ doesn't work in this case!
Message-Id: <7od2rn$221$1@nnrp1.deja.com>
<IMG SRC="/directory/directory.fds/image/somewhere/$somevar/file.gif"
BORDER="0" WIDTH="47" HEIGHT="24" ALT="Search">
The above HTML tag is not removed when using LWP's HTML::Parser and I
cannot find a way to remove this type of tag through long-form
scripting.
Basically, I have a script that fetches URLs, reads in the text using
LWP::UserAgent, removes all HTML and only displays the text (that would
normally be visible to the viewer).
I have found that this problem occurs in more than this type of tag
where SRC attributes are extensive and complex (and include unusual
characters) or where there are attributes within tags that are not
normally used.
I would like to challenge our Perl Gurus out there to come up with a
pattern match to remove ALL HTML tags no matter how complex or how many
elements/attributes there are (so only the text between the tags will
be displayed).
I have yet to see anyone come up with anything. I have referenced many
books, have tried many patterns and have even used the methods in the
Perl FAQ.
I don't want to use HTML::Parser for this.
Thanks,
CLH
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 05 Aug 1999 21:13:19 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Fwd: Re: My Last Words on =- vs comma
Message-Id: <pudge-0508991713240001@192.168.0.16>
In article <37A9F823.434AD1A1@chaos.wustl.edu>, elaine@chaos.wustl.edu wrote:
>Oh, c'mon Chris...I'm still laughing at this obvious parody.
Being a jackass in a parody is still, often, being a jackass.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: 5 Aug 1999 22:46:23 GMT
From: mwang@tech.cicg.ml.com (Michael Wang)
Subject: Re: Get Executables path
Message-Id: <7od47v$9jq$1@news.ml.com>
Abigail <abigail@delanet.com> wrote:
>perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
# perl -v
This is perl, version 5.004_04 built for sun4-solaris
# perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
Use of uninitialized value at -e line 1.
what is the purpose showing buggy code? Thanks.
--
Michael Wang
http://www.mindspring.com/~mwang
------------------------------
Date: Fri, 6 Aug 1999 00:08:11 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Help - Matching a variable in RegEx.
Message-Id: <JWnq3.651$E%3.5913@news1.online.no>
Nico Zigouras <zigouras@mail.med.upenn.edu> wrote in message
news:Pine.OSF.4.05.9908051517160.7039-100000@mail.med.upenn.edu...
> I am interested in matching a variable in my RegEx like.
> $var = "hello";
> if ( $question_variable =~ /$var/ ) {
> print"$question_variable has the string \"hello\" in it.";
> }
But what is the value of $question_variable?
Try adding:
else {print $question_variable, " does not contain ", $var, "\n"}
--
Trond Michelsen
------------------------------
Date: Thu, 5 Aug 1999 13:58:54 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Help with a more elegant solution to common problem
Message-Id: <MPG.12139aeae70f3e3a98968a@nntp1.ba.best.com>
(reposted since the first one was eaten by someone's dog
sorry for any duplicates)
Larry Rosler (lr@hpl.hp.com) seems to say...
> The only serious problem I see in this code is here:
>
> > sub scan_lines {
>
> It strongly resembles the situation described in perlfaq6:
Ok, That makes sense. I can do this:
sub build {
my @regexp = @_; # this MUST not be local(); need my()
my $expr = join '||', map { "m/\$regexp[$_]/o" } (0..$#regexp);
my $match_func = eval "sub { $expr }";
die if $@; # propagate $@; this shouldn't happen!
return $match_func;
}
my @fields = qw/
UCB.rank
DC.identifier
DC.subject
DC.title
/;
my $find_fields = build(
map { qq[<META NAME="$_" CONTENT="(.+)">/I] } @fields
);
That seems to build a good regular expression, and I assume that which ever
matches will end up in $1.
But then I have this problem: How do I know WHICH of the regular expressions
matched? What is returned in $1 has to be place in the correct slot.
That is, I don't know what $fld is below.
foreach ( @$lines_ref ) {
if ( &$find_fields ) {
push( @{$content{$fld}}, $1 );
}
}
Also, sub build generates something like
m/$regexp[0]/o||m/$regexp[1]/o||m/$regexp[2]/o||m/$regexp[3]/o
Why use the array $regexp instead of just plain text passed to the eval
as with:
m/<META NAME="UCB.rank" CONTENT="(.+)"> ||
m/<META NAME="DC.identifier" CONTENT="(.+)">/ ||
m/<META NAME="DC.subject" CONTENT="(.+)">/ ||
m/<META NAME="DC.title" CONTENT="(.+)">/
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 5 Aug 1999 21:46:30 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Help with a more elegant solution to common problem
Message-Id: <7od0nm$o6e$1@rguxd.viasystems.com>
Bill Moseley <moseley@best.com> wrote:
:>Ok, That makes sense. I can do this:
:> sub build {
:> my @regexp = @_; # this MUST not be local(); need my()
:> my $expr = join '||', map { "m/\$regexp[$_]/o" } (0..$#regexp);
:> my $match_func = eval "sub { $expr }";
:> die if $@; # propagate $@; this shouldn't happen!
:> return $match_func;
:> }
:>my @fields = qw/
:> UCB.rank
:> DC.identifier
:> DC.subject
:> DC.title
:> /;
:> my $find_fields = build(
:> map { qq[<META NAME="$_" CONTENT="(.+)">/I] } @fields
:> );
Is the "/I" really there?
:>That seems to build a good regular expression, and I assume that which ever
:>matches will end up in $1.
:>But then I have this problem: How do I know WHICH of the regular expressions
:>matched? What is returned in $1 has to be place in the correct slot.
#!/usr/lib/lprgs/perl -w
use strict;
my (@fields) = qw/
UCB.rank
DC.identifier
DC.subject
DC.title
/;
my %slots;
my $find_fields = join('|', @fields);
my $find_fields_re = qr{<META NAME="($find_fields)" CONTENT="(.+)">/I}o;
# whatever looping you do here for getting values
# I'm not sure about the '/I' in that string above, but am faithfully
# reproducing it in my test cases.
my (@test_strings) = (
'<META NAME="DC.identifier" CONTENT="this is content">/I',
'<META NAME="DC.title" CONTENT="this is identifier content">/I',
'<META NAME="bogus" CONTENT="this is title content">/I',
);
foreach my $test_string (@test_strings) {
if ($test_string =~ $find_fields_re) {
$slots{$1} = $2;
}
}
# At whatever point that you need to see what you have
foreach my $key (@fields) {
if (exists $slots{$key}) {
# whatever you do with it
print "Found '$slots{$key}' for $key\n";
} else {
# whatever you do when it isn't in the data
print "Did not find $key\n";
}
}
####### ###########
On my system the above produces:
Did not find UCB.rank
Found 'this is content' for DC.identifier
Did not find DC.subject
Found 'this is identifier content' for DC.title
--
// Lee.Lindley /// Programmer shortage? What programmer shortage?
// @bigfoot.com /// Only *cheap* programmers are in short supply.
//////////////////// 50 cent beers are in short supply too.
------------------------------
Date: Thu, 05 Aug 1999 21:46:03 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: How do I replace a "space" character?
Message-Id: <7od0mo$cm$1@nnrp1.deja.com>
[In article <37A9D807.44E903AA@texas.net>,
Tom Briles <sariq@texas.net> wrote:
> You have an unusual definition of 'spaces'.
What do you mean unusual ?
> And tr is *much* quicker.
I would like to know where I can find more stuff to read
on how to write optimal PERL Programs. For example you
say that 'tr' is faster than the scheme I was suggesting.
Why ?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 5 Aug 1999 15:44:29 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I replace a "space" character?
Message-Id: <MPG.1213b3a6c312d4f0989de5@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7od0mo$cm$1@nnrp1.deja.com> on Thu, 05 Aug 1999 21:46:03
GMT, Makarand Kulkarni <makarand_kulkarni@my-deja.com> says...
> [In article <37A9D807.44E903AA@texas.net>,
> Tom Briles <sariq@texas.net> wrote:
>
> > You have an unusual definition of 'spaces'.
> What do you mean unusual ?
The original poster was very clear that he wanted to strip 'spaces':
" ". "I need to replace all " " characters with "" in a variable
called $CRITERIA. effectively I need to rid the variable of any spaces
that might be present."
You responded bu stripping 'whitespace characters':
$CRITERIA =~s/\s//g ;
Not the same thing. And much less efficient than it could be, because
of the omitted '+' that lets you grab more than one character at a time.
> > And tr is *much* quicker.
> I would like to know where I can find more stuff to read
> on how to write optimal PERL Programs. For example you
> say that 'tr' is faster than the scheme I was suggesting.
> Why ?
Because it does a very efficient character-by-character replacement
using a precompiled 256-character lookup map.
There is a lot in 'Programming Perl' on Efficiency, starting on page
537. The best approach is to design good algorithms. There are many
books on that, but the most fun is 'Programming Pearls' (yes, that's
right! :-) by Jon Bentley. He also wrote 'Writing Efficient Programs'
(1982, but still valid, of course).
For small-scale optimizations, your best friend is the Benchmark module.
`perldoc Benchmark` Here is a simple example, applied to the 'tr'
issue:
#!/usr/local/bin/perl -w
use strict;
use Benchmark;
my $string = 'foo bar ' x 100;
timethese(1 << (shift || 0), {
Regex1 => sub { (my $x = $string) =~ s/ //g },
Regex2 => sub { (my $x = $string) =~ s/ +//g },
Tr => sub { (my $x = $string) =~ tr/ //d },
});
__END__
Benchmark: timing 16384 iterations of Regex1, Regex2, Tr...
Regex1: 25 wallclock secs (23.97 usr + 0.00 sys = 23.97 CPU)
Regex2: 8 wallclock secs ( 7.98 usr + 0.00 sys = 7.98 CPU)
Tr: 2 wallclock secs ( 2.13 usr + 0.00 sys = 2.13 CPU)
But don't waste too much time on such things. Identify where your
program is spending most of its time (the times() function might be
useful there, and there is a profiling module also). Then spend your
time improving that piece. Repeat until you run out of time or energy.
If that still doesn't help, switch from Perl to C, or write C-based
modules for the compute-intensive stuff.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 5 Aug 1999 15:43:13 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Is there any way to get user name
Message-Id: <x3y7lnac8tr.fsf@tigre.matrox.com>
Tanvada Jagannadha <jaganna@shell.one.net> writes:
> is there anyway we could get the user information along with the
> environmental variables? I mean the login name.
Have a look at the %ENV special hash. It is documented (along with all
of Perl's other special variables) in perlvar. Type 'perldoc perlvar'
to view it.
Note: You can get the login name in $ENV{USER}.
HTH,
Ala
------------------------------
Date: Thu, 05 Aug 1999 18:48:38 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: My Last Words on => vs comma
Message-Id: <linberg-0508991848380001@ltl1.literacy.upenn.edu>
In article <MPG.12137aca1e7821a1989de1@nntp.hpl.hp.com>, lr@hpl.hp.com
(Larry Rosler) wrote:
> > I have not see it
> > used anywhere in Perl books or standard code except for hash
> > initialization.
>
> Then you don't read enough books. Let's see:
I nearly wet myself at this. I really enjoy your posts, Larry. :)
------------------------------
Date: Thu, 05 Aug 1999 21:50:21 GMT
From: why@invite.flames
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <37b502b1.17754449@news.iag.net>
Nastiness contrary to the spirit of perl? - YES - Open source is about
cooperation, not control.
I am going to answer to 2 replies here:
In article <so5ymocm.fsf@hume.jhuccp.org>,
James Meacham <jmeacham@hume.jhuccp.org> writes:
>|> ... the overwhelming tone of this newsgroup is one of nastiness,
>|> condescension, and intolerance.
>
>You're kidding, right? Sure, a couple of people have slightly
>over-itchy flame fingers, but it's really pretty tame compared to much
>of Usenet. Trying lurking on alt.atheism or talk.origins for a while
>to see what happens when some *seriously* wretched, hate-filled and
>dysfunctional folks start to mix it up. It's not pretty, and this
>group is a haven of peace and universal love by comparison.
Actually, I have found this group to be the most intolerant in all of
the "professional computing" (comp.data.*,comp.lang.*,sybase.*,etc.)
groups I monitor. EVERY group has questions from people who do not
invest time in reading README.1ST, it is the nature of a "bulletin
board" - a lot of junk, and some useful gems.
Those who seem to get overly upset over questions answered with RTFM,
to me are like those who want to censor everything in modern media.
Instead of ignoring what they do not want to see, they feel empowered
to tell everyone else what that can post. For me, "if you do not want
to see it, change the channel" works just fine.
Even so, I do find plenty of useful unformation here.
On 05 Aug 1999 06:57:45 -0500, James Meacham
<jmeacham@hume.jhuccp.org>, in
<so5ymocm.fsf@hume.jhuccp.org> wrote:
>
>[word wrapping at about 72 characters is considered a *good* thing]
>
>+ So while the creator of the language and really the language
>+ itself manifest an attitude of humanistic synthesis, the overwhelming
>+ tone of this newsgroup is one of nastiness, condescension, and
>+ intolerance.
>
>And that gives people leave to impose upon others do their work for
>them, when they could answer their own questions with only a little
>effort? from material on their own disk?
This statement is a perfect example of what, IMHO, is truly wrong with
this group (Is anyone requiring this person to do someone else's
work?). Not the line noise, but the noisy lines. After all, when one
"How can I do this" post generates several "RTFM dummy" replies, where
is the bulk of the wasted bandwidth generated? Not by the newbies.
>Contemplate this: why does Larry Wall no longer post in this newsgroup?
>And why did he lament the lack of a decent "kindergarden" for Usenet?
I remember kindergarten as a place full of individuals who had
difficulty sharing, often threw tantrums when things were not to their
liking, and got awful crabby when they did not get their naps.
I know nothing about Larry Wall, other than he wrote a great language.
But I suspect that if he no longer frequents this group, then he
decided to "change the channel." Good for him, on both counts.
P.S. For any of the UseNazi's who would like to comment on my
responding to 2 posts at once, my ordering or message/reply, or my
general disdain for their whining, I say with a smile - "If you don't
like it, don't read it - Otherwise, blow it out your ... "
------------------------------
Date: 5 Aug 1999 22:55:50 GMT
From: mwang@tech.cicg.ml.com (Michael Wang)
Subject: Re: Perl seems to be LAME!
Message-Id: <7od4pm$9nh$1@news.ml.com>
Kai Henningsen <kaih=7MHv$LfXw-B@khms.westfalen.de> wrote:
>Just like a real programmer can program FORTRAN in any language.
I do not think you can program FORTRAN in Postscript, for example.
--
Michael Wang
http://www.mindspring.com/~mwang
------------------------------
Date: Thu, 05 Aug 1999 21:04:12 GMT
From: david_deja@my-deja.com
Subject: Re: Signal handler to restart app
Message-Id: <7ocu83$ugv$1@nnrp1.deja.com>
I have the same problem.
I have a program (pb) that spawns and monitors
several other programs (pb-slaves).
pb-slaves themselves spawns other programs
(remotes). When remotes exit, the corresponding
pb-slave catches the exit code (simple wait() and
$? << 8).
If a pb-slave dies (which happens extremely
rarely, but it does happen), pb restart it.
This is when something weird starts happening:
the new pb-slave, although spawned exactely the
same way as the old ones, does not wait for the
"remote" processes anymore.
I have "trussed" the 3 levels of processes and
here is what I've found:
Everything works as expected, pb-slave is started,
spawns remote, remote exits, but pb-slave totally
ingores it.
There is no zombies, which tends to indicate that
the SIGCHLD signal was indeed caught. It is not
caught by pb.
Is there a bug in perl?
David.
In article <7m4lk8$7l1$1@nnrp1.deja.com>,
wilda1@my-deja.com wrote:
> I installed a signal handler in my program to
catch the HUP signal so
> that it would restart itself. The first time I
send the HUP signal to
> process it restarts itself fine. But, when I
then try and send a HUP
> signal to the restarted program it appears to
ignore the signal!
>
> My code goes something like this :
>
> Program: daemon.pl
>
> #!/usr/local/bin/perl
>
> $SIG{HUP} = \&restart;
>
> use POSIX qw(setsid);
>
> # Completely disassociate itself
>
> close STDIN;
> close STDOUT;
> open STDERR, ">/dev/null";
> fork() && exit(); # fork
> setsid(); # detach
>
> <snip - program code>
>
> # Signal handler to restart another version then
die
>
> sub restart {
>
> system("./daemon.pl");
> die;
>
> }
>
> Does anyone have any idea why the HUP signal is
being ignored in the
> restarted program?
>
> Thanks, Andrew.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 5 Aug 1999 14:06:06 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: upload file
Message-Id: <Pine.GSO.4.10.9908051402450.9452-100000@user2.teleport.com>
On Thu, 5 Aug 1999, Matt wrote:
> I've asked a question about CGI.pm a few days ago and how to use it to
> retrieve an uploaded file and save it to disk. Someone told me things to
> read but that didn't help. Its very hard for me to understand and doesn't
> give a full example.
>
> Could someone please help me in detail?
If the docs of CGI.pm aren't clear enough, we should make them clearer for
everyone. In what way were they insufficient for you?
> Then how would I save it as a binary image file to a specific location?
>
> chdir (location); right?
Maybe you should check the entries for open and print in the perlfunc
manpage.
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 05 Aug 1999 18:06:53 -0400
From: Toyin Akinmusuru <takinmus@umich.edu>
Subject: web bot needed
Message-Id: <37AA0AFD.7BC47B8B@umich.edu>
Hi folks,
I'm in need of a spider bot to pull info from a group of text files on
different sites and put it into a format my db can handle. We're
willing to pay at least US$1000 for this.
-Toyin
------------------------------
Date: Thu, 05 Aug 1999 21:12:45 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Why is it.... [REPOST]
Message-Id: <pudge-0508991712500001@192.168.0.16>
In article <37a9f8af@cs.colorado.edu>, tchrist@mox.perl.com (Tom
Christiansen) wrote:
>Ignorance can be cured, as you have so capably demonstrated through your
>own researches. Stupidity, however, is a crippling disability which is
>both congenital and incurable. Fortunately, we always seem to need people
>to pick up trash or give out fries at the drive-in window.
Rubbish. Very few people are born stupid. The dimness of the average
person is not borne of congenital stupidity but of carelessness of one
form or another, usually one or more of bad schools, lazy parents, and a
lack of concern by the individual.
>There's this dirty little secret that nobody likes to talk about in
>public today, for it is phenomenally politically incorrect to do so--as
>I predict the ensuing followups to this posting shall presently prove.
Don't label disagreement as being politically correct. I'd hold the same
view regardless of the view of others or the political climate, and I am
sure others would, too.
>That dirty little secret is that there exists a thing called "talent",
>and that either you have it, or you don't.
Talent is only a tiny part of the journey. Most of the journey is hard
work and determination and the other virtues you mentioned. Does that
mean anyone can be a programmer? No, but most people can. But many
people need to work a lot harder at it than others. Most people cannot be
good programmers, maybe. But most people can be programmers, given the
right environment in the formative years.
It is different things to say that someone is not born able to be a
programmer, and that one is not, as an adult, able to be a programmer. I
think we can all agree on the latter.
>Talent cannot be instilled.
>Talent cannot be learned.
>Talent cannot be taught.
>Talent cannot be bought.
>Talent cannot be created.
But talent is not required for programming. Like many things, it helps.
In programming, it helps more than in most disciplines, perhaps.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: 05 Aug 1999 22:16:30 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: Why is it.... [REPOST]
Message-Id: <37aa0d3e$0$214@nntp1.ba.best.com>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> Ignorance can be cured, as you have so capably demonstrated through your
> own researches. Stupidity, however, is a crippling disability which is
> both congenital and incurable. Fortunately, we always seem to need people
> to pick up trash or give out fries at the drive-in window. Unfortunately,
> many of these people get the idea in their heads that they're going
> to become "HTML programmers". And as yourself have doubtless noticed,
> many of these come here in desperation with their hands outstretched,
> begging for alms. One does what one can for such supplicants, but too
> often one can in the long run do nothing.
Certainly there are plenty of ignorant, objectionable people who
blunder into this group with Web-related questions. To imply, as you do
here and elsewhere, that every non-programmer coming to Perl via the
Web is congenitally stupid, is both untrue and unkind.
> There's this dirty little secret that nobody likes to talk about in
> public today, for it is phenomenally politically incorrect to do so--as
> I predict the ensuing followups to this posting shall presently prove.
> That dirty little secret is that there exists a thing called "talent",
> and that either you have it, or you don't.
So far, at least, most of the followups have sided with you rather than
against you. In this group, at least, the politically correct position
is closer to yours than otherwise.
> Some people have a knack for programming, but most people don't.
> Not everyone is born to do everything. As far as the case at hand is
> concerned, not everyone has the raw mental horsepower combined with
> that special problem-solving thinking style that it takes to be a good
> programmer.
No one is saying that "everyone" is suited to be a good programmer.
That's a strawman of your own making.
[much discussion of programming artistry snipped]
> Fine, so not everyone is cut out to become a great programmer. So what?
> Can't anyone be at least a regular programmer?
Again, a strawman. No on is claiming that literally *anyone* can be a
programmer.
> Well no, I'm afraid not. Not everyone is cut out to be any sort
> of programmer whatsoever. They just don't have the gift it takes.
> The explosion of the net and the disparagement of formal education have
> combined to generate a popular but perilous myth that anyone can be
> a programmer. They can't.
Strawman.
> You should no more try to entice these people into a career in rocket
> science or computer programming than should you attempt to teach a pig
> to sing. The appropriate biological hardware just isn't there, and all
> you'll end up with is a lot of frustrated and unhappy people. And pigs.
This was reasonably witty when Heinlein said it; here it comes off as
uncharacteristically unoriginal. And again, it's unfair. There are many
intelligent, capable people learning Perl as a way of taking their work
on the Web to the next level. Attempts to help them learn the
principles of good programming are demonstrably more productive than
singing lessons for pigs.
There is a consistently bipolar aspect to your more controversial
postings: White hats vs. black. Innocent, traditional beachgoers vs.
evil, carpetbagging gypsies. Genius programmers vs. idiot script
kiddies. In the real world, these axes represent continuous spectra,
with individuals distributed all along their length, rather than
concentrated at the ends. You want to clump everyone at either extreme
so you can argue that East is East and West is West and never the twain
shall meet. In the real world, though, movement along these axes is not
only possible, it is inevitable. In the case of non-programmer
Web-content creators teaching themselves Perl, there is a great deal of
movement going on in the middle, in effect obliterating the sharp
boundary between genius programmers and idiot non-programmers that you
are so intent on maintaining.
Genius in one area does not imply genius in any other, although as
Heinlein also pointed out, the narrower one's field of expertise the
more likely one is to think it does. I would never think to
characterize your own areas of accomplishment as particularly narrow,
but there *is* a common element to the fields you have mastered: they
allow you to focus on the manipulation of abstract symbols, rather than
the complexities of living, breathing human beings.
In analyzing the larger social implications of Perl's adoption by
people who would be unable to contend with the big-endian learning
curve of traditional programming languages, you might be able to pick
up some pointers from someone like Larry, who has written about the
interesting matter-transfer taking place near the center of the Perl
community's closely-orbiting masses, and who is wise enough to
appreciate the possibilities inherent in pursuing not only the virtues
of laziness, impatience, and hubris, but also those of diligence,
patience and humility.
Your paean to the unique genius of master programmers betrayed a
notable lack of at least one of those latter virtues.
I will never be able to program as cleverly as you. I will never win an
obfuscated Perl contest, or produce a JAPH one-liner that brings an
appreciative smile to Abigail's lips. That doesn't make me stupid.
*Perl* doesn't care if I'm Matt Wright. It diligently, patiently, and
humbly does its best to carry out my instructions regardless of my
background, experience, or IQ. That's a manifestation of Larry's
genius, a genius that I will readily acknowledge to be in sadly short
supply.
Anyone can write things that piss people off on Usenet. Not as
entertainingly as you, maybe, but still, I don't see that as an
especially worthy application of your particular genius. Building a
tool, and a resulting social movement, that brings positive change to a
great many people's lives--*that* takes talent.
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: Thu, 05 Aug 1999 18:54:30 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Why is it.... [REPOST]
Message-Id: <37AA1607.DA83492@chaos.wustl.edu>
Tom Christiansen wrote:
[..snip..]
"It is appallingly obvious that our technology exceeds our humanity."
-- Albert Einstein
"Genius is one percent inspiration, and ninety-nine percent perspiration."
-- Thomas Alva Edison
"The most beautiful thing we can experience is the mysterious. It is the
source of all true art and all science. He to whom this emotion is a
stranger, who can no longer pause to wonder and stand rapt in awe, is as
good as dead: his eyes are closed."
-- Albert Einstein
"Great spirits have always found violent opposition from mediocrities.
The latter cannot understand it when a man does not thoughtlessly submit
to hereditary prejudices but honestly and courageously uses his
intelligence."
-- Albert Einstein
The human mind is far from being understood at this time....I question
your assertions as fact. However, there is an interesting interview in
the current MIT "Technology Review" with Jeff Hawkins who invented the
Palm Pilot discussing how the brain works and possibly the key to why
some people are more bright than others.
http://www.techreview.com/articles/july99/qa.htm
e.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 391
*************************************