[9513] in Perl-Users-Digest
Perl-Users Digest, Issue: 3106 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 9 13:07:18 1998
Date: Thu, 9 Jul 98 10:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 9 Jul 1998 Volume: 8 Number: 3106
Today's topics:
-- Abigail, my sink is clogged (Chris Russo)
Re: -w on production code (was Re: better way of gettin (I R A Aggie)
Re: -w on production code (was Re: better way of gettin (Abigail)
Re: -w on production code (was Re: better way of gettin (Abigail)
Re: -w on production code (Scott Erickson)
Re: -w on production code (Scott Erickson)
Changing password with perl-skript <oliver.schoenwald@fernuni-hagen.de>
Re: Comparing arbitrary dates <xmarkjones@mindless.com>
Re: Do I understand this? (Josh Kortbein)
Re: Do we need lame msgs in discussions? Re : Martien V <quednauf@nortel.co.uk>
Explanation of: Can't find loadable object in module .. <ulf.wendel@kiel.netsurf.de>
Re: Finding text between two tags on the same line? (Larry Rosler)
Re: Finding text between two tags on the same line? <tchrist@mox.perl.com>
Re: Finding text between two tags on the same line? (Larry Rosler)
Re: Hash keys question (Mark-Jason Dominus)
HELP about cgi <matteo@gate2000.com>
Re: How can I print on both sides of a paper? (Josh Kortbein)
Re: How much space left on disk? (Marc Haber)
Re: HTTP connections WITHOUT the libwww module? <jc@ral1.zko.dec.com>
Re: Indexing servers (-)
Re: Indexing servers (Larry Rosler)
kill 0 always true? How test pid? <lrosen@alum.mit.edu>
Making web robot ...(search engine) <sub4eun@oxen.konkuk.ac.kr>
Re: modules (Craig Berry)
Re: new charter and moderator for comp.lang.perl.announ (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Re: new charter and moderator for comp.lang.perl.announ <gnat@frii.com>
Re: new charter and moderator for comp.lang.perl.announ <gnat@frii.com>
Re: new charter and moderator for comp.lang.perl.announ <gnat@frii.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 09 Jul 1998 08:44:15 -0700
From: news@russo.org (Chris Russo)
Subject: -- Abigail, my sink is clogged
Message-Id: <news-0907980844150001@buzz.hq.alink.net>
I'm sorry, I just couldn't resist.
Regards,
Chris Russo
--
Chris Russo
news@russo.org
http://www.russo.org
------------------------------
Date: Thu, 09 Jul 1998 11:17:19 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <fl_aggie-0907981117200001@aggie.coaps.fsu.edu>
In article <8cg1gbdt3v.fsf@gadget.cscaper.com>, Randal Schwartz
<merlyn@stonehenge.com> wrote:
+ >>>>> "Michael" == Michael D Schleif <mike.schleif@aquila.com> writes:
+
+ Michael> Let me toss this bone to the wolves:
+
+ Michael> If "-w" and "use strict" were compiled-in-standard in
Perl, how would
+ Michael> that affect the postings to clpm? What would change here?
+
+ We'd have a DAILY stream of people trying to run "perl" on Matt Wright's
+ Scripts and saying "I get this error... how do I fix it?".
Answer: don't use Matt's scripts for production work.
At that point it becomes a FAQ, and that won't change clp.misc a great
deal.
James - FAQs to the left, FAQs to the right, FAQs in the center
------------------------------
Date: 9 Jul 1998 16:10:08 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6o2q10$duh$1@client3.news.psi.net>
Tina Marie Holmboe (tina@scandinaviaonline.se) wrote on MDCCLXXIII
September MCMXCIII in <URL: news:6o257f$7dg$1@news1.sol.no>:
++
++ The company I work for have a set of programming guidelines. These
++ guidelines are for the most part ignored (another discussion), but what
++ is often *not* ignored is adding -w to production code.
++
++ *Lots* of our new programmers do that. But they don't add -w to their
++ *development* code.
You need better guidelines, and a QA system.
++ The process is something like this:
++
++ a) Develop something nifty. Don't bother with -w, 'cause they prolly
++ don't know about it anyway.
++
++ b) Put it in production - ohyes, the guidelines said to add -w, sure,
++ I can do that.
++
++ c) Walk away.
I'm sorry, but I can't consider that a serious production environment.
Just because you have incompetent coders working in your company isn't
a reason to advocate not using -w.
++ And yes, it scares me. More interesting a scenario is the following:
++
++ a) System programmer or system admin installs a new module.
++ b) The module sprouts warnings.
++ c) I used -w
++ d) I can't bloody debug my own script due to screefuls of warnings
++ from the *module*
++ e) I ask them to do something about the module
++ f) I am told to go fuck myself
g) Don't use the module.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 9 Jul 1998 16:13:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6o2q7u$duh$2@client3.news.psi.net>
Lloyd Zusman (ljz@asfast.com) wrote on MDCCLXXIII September MCMXCIII in
<URL: news:ltu34r5hw8.fsf@asfast.com>:
++
++ Perhaps you consider japh's and the Roman Numeral date displayer to be
++ exceptions to your rule; if so, I take this to be quite reasonable and
++ I would totally agree with you ... just like I also consider it to be
++ quite reasonable to leave out the very useful and eminently helpful
++ `-w' and `use strict;' in certain other occasional cases, as well.
I don't consider any of the quoted examples as good programming
practise, so I consider your argument moot.
Abigail
--
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: Thu, 09 Jul 1998 16:24:41 GMT
From: Scott.L.Erickson@HealthPartners.com (Scott Erickson)
Subject: Re: -w on production code
Message-Id: <35a4ed78.696185772@news.mr.net>
Previously, abigail@fnx.com (Abigail) wrote:
>Tina Marie Holmboe (tina@scandinaviaonline.se) wrote:
>++ And yes, it scares me. More interesting a scenario is the following:
>++
>++ a) System programmer or system admin installs a new module.
>++ b) The module sprouts warnings.
>++ c) I used -w
>++ d) I can't bloody debug my own script due to screefuls of warnings
>++ from the *module*
>++ e) I ask them to do something about the module
>++ f) I am told to go fuck myself
>
> g) Don't use the module.
I have to agree with Abigail on this one. I encountered a similar
situation where I work. Production code was generating non-fatal
errors which were not being caught because the programmer was not
using strict or -w. I pointed out the errors and provided solutions to
those errors, but the programmer responded by saying "why are you
using strict? no one else uses that?" I said that even if I did not
use strict, the code still generated error messages. His response was
"well it is in production and I am not going to change it." So, I
wrote own code and now I do not get error messages. It was that
simple.
Scott.
------------------------------
Date: Thu, 09 Jul 1998 16:28:14 GMT
From: Scott.L.Erickson@HealthPartners.com (Scott Erickson)
Subject: Re: -w on production code
Message-Id: <35a4ef01.696579368@news.mr.net>
Previously, fl_aggie@thepentagon.com (I R A Aggie) wrote:
>Randal Schwartz <merlyn@stonehenge.com> wrote:
>+ >>>>> Michael D Schleif <mike.schleif@aquila.com> writes:
>+
>+ Michael> Let me toss this bone to the wolves:
>+
>+ Michael> If "-w" and "use strict" were compiled-in-standard in
>Perl, how would
>+ Michael> that affect the postings to clpm? What would change here?
>+
>+ We'd have a DAILY stream of people trying to run "perl" on Matt Wright's
>+ Scripts and saying "I get this error... how do I fix it?".
>
>Answer: don't use Matt's scripts for production work.
I agree. It does not get any simpler than that. Do not knowingly and
intentionaly use buggy code. If you find out after the fact that it is
buggy, fix it. If you can't, ask the author to fix it. If he/she
won't, then do not use the code.
Scott.
------------------------------
Date: Thu, 09 Jul 1998 17:07:23 +0200
From: Oliver Schoenwald <oliver.schoenwald@fernuni-hagen.de>
Subject: Changing password with perl-skript
Message-Id: <35A4DCAB.C52FA3FD@fernuni-hagen.de>
Hello!
How can I change a user's password under unix (solaris 2.5.1)
using a perl-script? When using the passwd-command, this programm
asks for the old an two times the new password. How can the
perl-script handle this interaction? Or is there a better
solution? Any functioning example would be welcome!
Thank you in advance,
Oliver.
------------------------------
Date: Thu, 09 Jul 1998 10:25:41 -0500
From: Mark Evan Jones <xmarkjones@mindless.com>
Subject: Re: Comparing arbitrary dates
Message-Id: <35A4E0F5.B3F0BA47@mindless.com>
Adam Graham-Yooll wrote:
>
> try these two functions to get Julian and Gregorian dates.
>
> sub julianDt {
...
> }
>
> sub gregDt {
...
> }
Thank you muchly. That worked out to be precisely what I needed.
Mark Jones
------------------------------
Date: 9 Jul 1998 16:06:44 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Do I understand this?
Message-Id: <6o2pqk$or2$9@news.iastate.edu>
Mike Stok (mike@stok.co.uk) wrote:
: In article <6o1dk0$6br$3@client3.news.psi.net>,
: Abigail <abigail@fnx.com> wrote:
: >Phillip George Geiger (geiger@cs.ucdavis.edu) wrote on MDCCLXXIII
: >September MCMXCIII in <URL: news:6o125p$54j$1@mark.ucdavis.edu>:
: >++ My apologies if it's off topic here. Which newsgroup would be a
: >++ better place to ask it?
: >
: >
: >Some newsgroups with 3 w's in a row.
: Let's hope that the inhabitants of alt.swedish.chef.w.w.w have a sense of
: humour...
Is it even conceivable that they could not?! :)
Josh
--
__________________________________________
She had heard all about excluded middles;
they were bad shit, to be avoided.
- Thomas Pynchon
------------------------------
Date: Thu, 09 Jul 1998 16:20:40 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Do we need lame msgs in discussions? Re : Martien Verbruggen
Message-Id: <35A4DFC8.634B899F@nortel.co.uk>
John Chambers wrote:
>
> F.Quednau wrote:
> > Don't you think that ignoring people is far more dangerous in its implications
> > than give them a flame?
> > Ignoring someone means that you don't care at all, whatsoever.
>
> Oh, nonsense! Not answering could mean any number of other things:
>
> 1. I don't know the answer, and I don't want to waste people's time by
> posting a message that says "I don't know, either."
>
> 2. The news system garbled or lost the question, and I didn't see it.
>
> 3. Someone else already posted a good answer, so why should I?
>
> 4. I started an answer, got distracted, my computer crashed, and by the
> time I got back to it, someone else had answered it.
>
> 5. My news server doesn't carry that newsgroup, so although I know the
> answer, I never saw the question.
>
> 6. My news server carries that and 17,042 other newsgroups, and although
> I know the answer, there aren't enough hours in the day to read all
> questions in all newsgroups, so again I didn't see the question.
Far to down to earth and realistic for me ! I was talking about great, clear
principles of society and now you're throwing those stones called 'pragmatism'
and 'the-technicalities-of-crude-communication' at me :)
Just one thing to your first point. The whole thing was about 'flames'. If you
wouldn't know the answer, you wouldn't 'flame', I believe.
> (And I probably won't see any followups to this. ;-)
True!
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Thu, 09 Jul 1998 17:15:26 +0200
From: Ulf Wendel <ulf.wendel@kiel.netsurf.de>
Subject: Explanation of: Can't find loadable object in module ...
Message-Id: <35A4DE8E.34E7E0FE@kiel.netsurf.de>
Hi!
Can anyone give me a hint what the above error message means?
It occurs when I type a simple "use Win32::ODBC;". @INC is modified to
look in the current working directory for modules.
Thanks!
Ulf Wendel
------------------------------
Date: Thu, 9 Jul 1998 08:25:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Finding text between two tags on the same line?
Message-Id: <MPG.100e80aee504e1cd989729@nntp.hpl.hp.com>
In article <yk3sokbe1j6.fsf@ermine.ox.ac.uk> on 09 Jul 1998 11:55:57
+0100, Rob Hutchings <dlaser@ermine.ox.ac.uk> says...
...
> while (<DATA>) {
> push @links, m/$_tag(.*?)$e_tag/g;
> }
If $_tag and $e_tag are the same every time this loop is run, adding the
'o' modifier will make it run *much* faster. If they may be different,
still use the 'o' modifier, but encase the whole loop in an eval STRING,
thus:
eval q{
while (<DATA>) {
push @links, m/$_tag(.*?)$e_tag/go;
}
};
These comparisons might be a good way to get familiar with Benchmark.pm .
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 9 Jul 1998 15:37:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Finding text between two tags on the same line?
Message-Id: <6o2o3e$e97$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
lr@hpl.hp.com (Larry Rosler) writes:
:> while (<DATA>) {
:> push @links, m/$_tag(.*?)$e_tag/g;
:> }
<THIS> and <THIS> are </THIS>
you know </THIS>.
--tom
--
Nothing is created by a team or an organization. Every new idea comes out
of a single human mind. -- Admiral Rickover
------------------------------
Date: Thu, 9 Jul 1998 09:21:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Finding text between two tags on the same line?
Message-Id: <MPG.100e8dcf80d8fe1498972a@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6o2o3e$e97$2@csnews.cs.colorado.edu> on 9 Jul 1998 15:37:18
GMT, Tom Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc,
> lr@hpl.hp.com (Larry Rosler) writes:
> :> while (<DATA>) {
> :> push @links, m/$_tag(.*?)$e_tag/g;
> :> }
>
> <THIS> and <THIS> are </THIS>
> you know </THIS>.
I sure do know <THIS>, and I know the reasons why. But blame the
original submitter, </THIS>:
: This script finds all unknown strings between <LINK> and </LINK> and
: puts them into $s. The problem is that it can not find two strings on
: the same line. How do I modify this script in order to make it find two
: strings on the same line?
Each pair is on one line; he doesn't care what's between them; he just
wants to find more than one pair on the same line. The code works,
without a parser: ' and <THIS> are '.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 9 Jul 1998 11:41:03 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Hash keys question
Message-Id: <6o2oaf$3mp$1@monet.op.net>
In article <6o19mv$4j5$1@nnrp1.dejanews.com>,
<gcarvell2@my-dejanews.com> wrote:
> perl -we 'sub a {}; $hash{a} = 1; $hash{b} = 1;'
> "Ambiguous use of {a} resolved to {"a"}".
>The warning appears for {a}, but not for {b}.
>I thought that anything within the braces would just be treated as a
>string.
That's right. Anything within the braces is treated as a string.
That's what the warning says: It had a choice of whether to interpret
that `a' as the string "a" or as a call to function &a(), and it is
reminding you that it always chooses to treat it as a string:
Ambiguous use of {a} resolved to {"a"}
> Is that the case, or am I just missing something obvious?
Both, I guess.
The reminder is in case you thought maybe it was going to call &a();
it's warning you that it isn't going to do that. You couldn't
possibly have thought that $hash{b} was going to invoke &b(), because
there is no &b(), so it doesn't issue any warnings about b.
>I notice that some modules always quote hash keys Can someone explain
>why?
Because different modules are written by different people with
different styles.
------------------------------
Date: 9 Jul 98 16:31:45 GMT
From: "Matteo" <matteo@gate2000.com>
Subject: HELP about cgi
Message-Id: <01bdab54$85014f20$LocalHost@matteo>
Hi, I'm Matteo from Italy.
I wrote a cgi program with perl to send multiple mails using:
Print "to: address@domain.com\n";
Print "from: address@domain.com\n";
and so on
how to attach a file?
I tried with
Print "attach: address@domain.com\n";
but it doesn't work.
Please help me and write me to matteo@gate2000.com
thank you very much
Matteo
------------------------------
Date: 9 Jul 1998 15:53:00 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: How can I print on both sides of a paper?
Message-Id: <6o2p0s$or2$8@news.iastate.edu>
Ophir Marko (ophir@saifun.com) wrote:
: HI All,
: I need to write a perl script for Unix to print on both sides of a
: paper. Our printer can do that but I have no idea how. So far I could
: only get it to print on one side only.
man -k print
This was not a perl question, and asking it twice didn't make it
any more of one.
Josh
--
__________________________________________
She had heard all about excluded middles;
they were bad shit, to be avoided.
- Thomas Pynchon
------------------------------
Date: Thu, 09 Jul 1998 15:04:07 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: How much space left on disk?
Message-Id: <6o2m6c$beh$2@nz12.rz.uni-karlsruhe.de>
mgjv@comdyn.com.au (Martien Verbruggen) wrote:
>You can use www.dejanews.com.au to read some of them.
^^^^ really?*grin*
>statfs is not portable at all, which is why perl doesn't have it. You
>can always call it yourself with syscall, or by wrapping it in an
>XSub. It will be highly unportable though.
>
>Maybe a call to quota and df might be easier to implement. Just as
>unportable of course.
Doesn't look satisfying. *shrug*. Simply, too bad :-(
Thanks anyway.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Thu, 09 Jul 1998 11:19:38 -0400
From: John Chambers <jc@ral1.zko.dec.com>
Subject: Re: HTTP connections WITHOUT the libwww module?
Message-Id: <35A4DF8A.AB2820F@ral1.zko.dec.com>
David Thompson wrote:
>
> Is it possible to retrieve a URL (and store for later parsing) WITHOUT
> using the LibWWW module?
Of course, and there are lots of us doing such things. My usual
motivation is that I do a prototype using the libwww stuff, and
before long I stumble across something that it can't handle the
way I need it handled, so I start replacing the failing parts with
my own routines. What sort of things? Well, I have a bunch of
tools that need to download HTML files that very often contain
bits of invalid HTML. They come from tools like MS's FrontPage,
and the users insist that the HTML must be valid, because IE shows
the right thing. But some parts seem to be invisible or garbled
when libwww (which likes valid HTML ;-) reads them. Asking
questions about how to deal with Bill Gates' buggy products just
gets you sneers hereabouts, of course, so what can ya do? I just
start rolling my own ...
Two of my programs (a month or two out of date but usable as samples)
that download files and directory trees:
<URL:href="http://eddie.mit.edu/~jc/html/w3cat>
<URL:href="http://eddie.mit.edu/~jc/html/w3ld>
These require a couple of other little files that you'll find in the
same directory. A bit of digging around in AltaVista or Yahoo or
other search sites will turn up quite a number of other such tools
that various people have written.
> Is it possible to just import the useragent functions into a script?
> (not my preferred solution, but workable).
Sure. All the code is available, and you can cut and paste as you
see fit. This can be useful especially if you are having performance
problems. You can go in and cut out just the things you need (and
they things they need ...), and make a much smaller script with shorter
load time. It takes a bit of your time, but it's not that difficult.
You might just look into the Socket library that came with your perl
distribution. That's one way to learn how to do it yourself. and a
good source of code when you need an extract that doesn't do the full
job.
If anyone tries telling you that you have to use the standard modules,
or that it's too difficult for a dummy like you to understand, don't
pay them any mind. It's not all that difficult.
For an example of how easy it all is, try this:
: telnet altavista.digital.com 80
GET / HTTP/1.0
and hit Return twice. You'll probably recognize the results.
------------------------------
Date: Thu, 09 Jul 1998 15:04:44 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Indexing servers
Message-Id: <35a4dac8.43012645@nntp.idsonline.com>
mgjv@comdyn.com.au (Martien Verbruggen) Said this:
>In article <6nvcrn$hds$1@taliesin.netcom.net.uk>,
> "Clinton Gormley" <clint@netcomuk.co.ukXX> writes:
>> I want to build a web site that works a bit like the Microsoft Knowledge
>> Base - so a searchable index of articles - probably a key word search rather
>> than full text indexing.
>
>This is not a trivial task by any means, and maybe instead of trying
>to implement this yourself you should first have a look at freely
>available search engines. Check Yahoo and pick one or two that seem to
<snip>
>through a bunch of files every time a search is done. You're on the
>right track with an index of articles.
FreeWais and some other wais-like scripts are probably the best for
this sort of thing. I guess the fact that wais is a product that's
been around far longer than microsoft's awareness of the internet
makes it a less-than-desirable solution for the microsoft fools out
there, but I think it's the most powerful and versatile solution out
there.
These URLs may be outdated by now, but it's worth a shot:
ftp://ftp.maxwell.syr.edu/infosystems/wais/FreeWAIS-sf/
ftp://ftp.egg.com/pub/infosystems/freeWAIS-sf-2.0/
And SFgate provides the CGI interface for free-WAIS
ftp://ftp.maxwell.syr.edu/infosystems/wais/SFgate-4.0/
------------------------------
Date: Thu, 9 Jul 1998 08:11:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Indexing servers
Message-Id: <MPG.100e7d5b98e1b463989728@nntp.hpl.hp.com>
In article <6o2dln$6po$1@earth.superlink.net> on Thu, 9 Jul 1998
08:39:19 EDT, David A. Black <dblack@saturn.superlink.net> says...
...
> 5. You could use the dreaded grep() to find the files you want to open:
>
> opendir(DOCDIR,"html") or die "Can't opendir html: $!";
> for my $search_doc (grep /\.html$/i, readdir DOCDIR) { ... }
In the 'real' world:
for my $search_doc (grep /\.html?$/i, readdir DOCDIR) { ... }
Sigh...
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 09 Jul 1998 12:18:49 -0400
From: "Larry P. Rosen" <lrosen@alum.mit.edu>
Subject: kill 0 always true? How test pid?
Message-Id: <35A4ED69.BFEAA979@alum.mit.edu>
I want to determine if another process is still
running. The process happens to be a "detached"
grandchild process. I tried the "trick" on page 339
of the camel book, sending signal 0. Unfortunately
that seems to always return 1 (true) on our irix 6.2.
(Sample code follows). Any ideas how to test for
the process in a pretty portable way? (I need it
to work on irix, linux, and Solaris).
Thanks,
Larry
#!/usr/local/bin/perl -w
# Can a process send kill 0 to a running grandchild
# and get back 1 (true), then send kill 0 to the
# process after it exits and get back 0 (false)?
use strict;
my $cpid = -1; # The grandchild process ID.
# Fork off a child:
my $pid = fork();
die "fork failed: $!" if (!defined($pid) ||
($pid < 0));
unless ($pid) { # child
$cpid = fork();
if (!defined($cpid) or ($cpid < 0)) {
print "unable to fork grandchild: $!";
exit -2;
}
unless ($cpid) { # grandchild
print "Grandchild - process is $$.\n";
print "Grandchild - Sleep at ", time, ".\n";
sleep (10);
print "Grandchild done at ", time, ".\n";
exit 0; # grandchild exits.
}
print "Child - grandchild pid is $cpid.\n",
"Child exiting.\n";
exit 0; # child exits.
}
# parent
waitpid ($pid, 0); # Reap dead child.
sleep (3); # Give grandchild a chance to go to sleep.
print "Parent - Send kill 0 to grandchild at ", time,
".\n";
my $status = kill 0, $cpid;
print "Parent - signal sent by ", time, ".\n";
print "Parent - kill returned: $status\n";
# wait for grandchild to end by sleeping longer.
sleep (10);
print "Parent - test grandchild again at ", time,
".\n", time should be > Grandchild done time.\n";
$status = kill 0, $cpid;
print "Parent - signal sent by ", time, ".\n";
print "Parent - kill returned: $status\n";
print "Parent done.\n";
1;
------------------------------
Date: Fri, 10 Jul 1998 01:12:37 +0900
From: "=EHq<7" <sub4eun@oxen.konkuk.ac.kr>
Subject: Making web robot ...(search engine)
Message-Id: <6o2q85$b0m$1@kpt2005.hitel.net>
Hello all.
I'm making web robot (like scooter) which collect MP3 link data
in HTML.
Please help me.
I looked up robot source...
but I didn't find it.
Do you have a robot source?
------------------------------
Date: 9 Jul 1998 16:22:25 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: modules
Message-Id: <6o2qo2$c9a$1@marina.cinenet.net>
M.J.T. Guy (mjtg@cus.cam.ac.uk) wrote:
: Craig Berry <cberry@cinenet.net> wrote:
: >Ulf Wendel (ulf.wendel@kiel.netsruf.de) wrote:
: >: use lib $cwb;
: >
: > use lib '.';
: >
: >has the same effect, with less typing.
:
: Not if the script subsequently does a chdir().
Though unless the chdir() is in a BEGIN block, this will affect only
require, not use. Still, you're right, it's worth keeping in mind.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Thu, 09 Jul 1998 16:58:28 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <lassehp-0907981658280001@ra.imv.aau.dk>
In article <6o2ia3$mtk1@eccws1.dearborn.ford.com>,
cpierce1@cp500.fsic.ford.com (Clinton Pierce) wrote:
>Oh I'd trust a moderator for c.l.p.a to do the Right Thing. I can't
>imagine that clpa would ever be flooded with inappropriate announcements.
>Even with one of the O'Reilly 'associates' as a moderator, I'd still
>trust them to do the Right Thing. Although it might be an uncomfortable
>position (as Randal said earlier).
If the moderator was uncomfortable because he might be handling
announcements in which he had a direct interest, then a few more
comoderators could be added, and the charter could say that announcements
in which a moderator has some sort of interest must be approved by a
different moderator. Comfortable enough?
-Lasse
------------------------------
Date: 09 Jul 1998 09:45:49 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <5qhg0r2fki.fsf@prometheus.frii.com>
mgjv@comdyn.com.au (Martien Verbruggen) writes:
> Please. Not that. We'll be inundated with announcements of every CGI
> program that is written in Perl.
Yes, quite possibly. Of course, they would be marked [CGI] on the
subject line, so you could automatically kill them by subject. Then
again, the Perl newsgroups have such an enshrined "no damn CGI" ethos
that it wouldn't be out of place to say "no damn CGI for
comp.lang.perl.announce". After all, there are already other
newsgroups for That Sort of Thing.
I just don't want to refuse announcements of scripts. Don't forget
that the scripts section of CPAN will soon be reborn. I want to see
uploads announced on c.l.p.a. This doesn't mean that we can restrict
announcements to only CPAN scripts, though. That would rule out
commercial software like Tom Boutell's PerlMud, for instance.
> Imagine comp.lang.c.moderated getting advertisements
> for every program that uses C or interfaces with C in some way.
I think this argument is bogus. First, .moderated is not .announce.
They have different raisons d'etre. Second, even comparing .moderated
to .moderated, the charter for comp.lang.perl.moderated doesn't seem
to forbid such advertisements. Third, Perl is not C--Perl is not used
as widely as C, and shooting down Perl software announcements because
of the number of C programs seems to be faulty argumentation.
I think that ruling out script announcements entirely would be a loss
to the community, in the end. Currently, c.l.p.a does permit scripts.
Merlyn's improvised behaviour is to reject scripts unless they're
CPANned. If the author refuses to CPAN it, Merlyn then gives in and
allows the announcement anyway. For instance, txt2pdf was announced
in c.l.p.a, despite costing $10 for a license and not being on CPAN.
In summary, I don't mind saying "no CGI". I do mind saying "no
scripts".
Nat
------------------------------
Date: 09 Jul 1998 10:17:25 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <5qg1gb2e3u.fsf@prometheus.frii.com>
Daniel Grisinger <dgris@rand.dimensional.com> writes:
> I don't think merely using perl should qualify a product for announcement
> on clpa. I don't think that Oracle should be announcing new products
> on clpa just because they bundled oraperl with their product.
I like the suggestion you made of only allowing announcements like
this if the API has changed.
The problem is that I want to allow small-time commercial stuff
through. I want the people making Perl editors, Perl debuggers,
scientific visualization tools, all that fun stuff, to have a place to
announce their software. They're interesting, they may be useful to
the community, and I think they should be encouraged.
It's difficult to do that without letting the bigtime folks through.
If that's the price we have to pay, I'm willing to accept it. I can't
see it being a large problem--hardly anyone *has* a Perl API :-)
> I agree that these are good and desirable ends, but clpa does not
> exist to create more jobs with better salaries. It exists to
> provide announcements that are relevant to the task of perl
> programming.
Then we're lucky that these two overlap :-) I know that I have used
programs that I heard about in comp.lang.perl.announce, either
directly or by reading and adapting the code in them. They made my
life much easier. That's the great thing about interpreted source
languages.
Would it make your life easier if such things were tagged on the
subject line with [SCRIPT]? That way you could killfile them and
would never need to see them.
> I have no objections to you serving as moderator (but, then again,
> the only person I'd object to having as moderator is myself :-).
"I wouldn't moderate any group that would have me as a moderator"
-- Groucho Grisinger :-)
Nat
------------------------------
Date: 09 Jul 1998 10:29:18 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <5qemvv2dk1.fsf@prometheus.frii.com>
cpierce1@cp500.fsic.ford.com (Clinton Pierce) writes:
> I'd just like to know what to expect. Commercials? Fine, I watch
> cable TV, I know what a commercial is. I'd just rather not have the
> Home Shopping Network in clpa. Or maybe that's what the moderator and
> clpm wants? Fine. Just let me know in the channel guide that clpa
> is going to have lots of semi-relevant commercials. We don't need a
> Constitution to run a newsgroup...just an accurate TV Listing.
Amen, brother. Testify!
I'd like to be able to use discretion, and reject the hypothetical
pointless Oracle announcements. Like I told Merlyn on #perl, it's a
judgement call and someone has to make that call. He's not willing to
do it, because he feels that the act of making the call exposes him
legally. I don't have the bad experiences with the law that Merlyn
has had, so I don't have any problem is stepping up and taking
responsibility for the decisions I'd make as moderator.
I think the posts on "what would you do in THIS case" is the community
deciding on what they want to see. No matter how big the charter is,
judgement will always be required. These questions are just to get a
feel for how the judge will lean.
Nat
(could make a comment about bent judges and hung juries, but won't :-)
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 3106
**************************************