o I can't wait for the processes to end -- some might not until
I kill them.
o Most processes will end quickly.
o I don't want to fill up the process table with zombies.
o I'll be forking around 200 processes, of which up to 30 might
hang, worst case.
In case you haven't guessed, this is a cron job to test machines to make
sure they're up.
The examples on p. 216 of the book needs a wait to prevent zombies.
I can't really wait -- I need to check everything, even if some processes
in the middle hang.
Execs seem to take up a lot of resources, if I just re-execute the script.
Has anyone done this before?
---
# Daniel M. Rosenberg Daniel.R...@Corp.Sun.COM +1 415 688 9580
# Opinions expressed above aren't Sun's.
On some systems doing a $SIG{CHLD} = IGNORE seems to help in the prevention
of zombies.
Larry
Larry
The book indicates that CHLD and IGNORE above should be string values.
It seems to work both ways. Why? (Not a complaint).
--
Roy Johnson Shell Development Company (but speaking for myself)
"Nothing says 'I love my country' like higher taxes." -- Ed Ipser
check out the index entry for unquoted strings...
To quote (without permission) from the book
A word that doesn't have any other interpretation in the grammar
will be treated as if it had single quotes around it.
Mike
--
The "usual disclaimers" apply. | Meiko
Mike Stok | Reservoir Place
mi...@meiko.com | 1601 Trapelo Road
Meiko tel: (617) 890 7676 | Waltham, MA 02154
"Perl poetry mode", or "bare word mode" depending on how formal you
want to get about it.
A single C symbol without quotes that is not a keyword in a location
that can use a quoted string is automatically promoted to a quoted
string.
from the debugger:
DB<1> print join("X",foo,bar);
fooXbar
DB<2> print join(_,unpack(C99,A_Very_Odd_Example));
65_95_86_101_114_121_95_79_100_100_95_69_120_97_109_112_108_101
One good use of this minor syntactic sugar is to pass filehandles
without having to quote them:
sub say {
local($filehandle,$what) = @_;
print $filehandle $what;
}
&say(STDOUT,"Hello, world!\n");
Without bare word mode, we'd have to say:
&say("STDOUT","Hello, world!\n");
The real reason this was added was to support better Perl poetry.
(See the Camel book for an example of poetry, but there were many
others...) Right, Sharon?
print join($",Just,another,Perl,hacker),qq,\,,
--
Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
mer...@ora.com (semi-permanent) mer...@kandinsky.intel.com (temp)
factoid: "Portland, Oregon, home of the California Raisins and Lone-Star Beer!"
Yup. :-) There was even a paper on Perl poetry at the 1992 Winter Usenix
conference, with examples by myself, Larry Wall, and Craig Counterman,
plus a FORTRAN example by David Mar. Michael Cook has also written some
Perl poetry, and received his due reward.
For those who are new to the concept of programming-language poetry, I'm
including my "listen" poem (my first perl poem). Right now I'm mostly
waiting for Perl 5, which will have a few neat new things for me to try...
(Unless I can come up with something clever before then. :-)
print "Just another Perl (and REXX!) poet,"
--Sharon
--------------------------------------------------------------------------
#!/usr/bin/perl
APPEAL:
listen (please, please);
open yourself, wide,
join (you, me),
connect (us,together),
tell me.
do something if distressed;
@dawn, dance;
@evening, sing;
read (books,poems,stories) until peaceful;
study if able;
write me if-you-please;
sort your feelings, reset goals, seek (friends, family, anyone);
do not die (like this)
if sin abounds;
keys (hidden), open locks, doors, tell secrets;
do not, I-beg-you, close them, yet.
accept (yourself, changes),
bind (grief, despair);
require truth, goodness if-you-will, each moment;
select (always), length(of-days)
# Sharon Hopkins, Feb. 21, 1991
# listen (a perl poem)
# {for jimmy (and tom)}
( ... good stuff about perl poetry deleted ... )
>For those who are new to the concept of programming-language poetry, I'm
>including my "listen" poem (my first perl poem).
Hah! A likely story! Come clean, Sharon, and admit you wrote BLACK PERL! :-)
John
--
John W. Nall | Supercomputer Computations Research Institute
na...@mailer.scri.fsu.edu | Florida State University, Tallahassee, Florida
"You gotta know when to hold 'em/know when to fold 'em/
"know when to walk away/and know when to run..."
It's a base canard!!!
Ok, I can't deny *all* knowledge of the genesis of the "Black Perl" poem,
but my mind isn't *nearly* twisty enough to have been the creator.
You see, "Black Perl" was written BEFORE poetry optimizations were added
to Perl; look closely and you'll see that the bare-words trick isn't
used *at all* in the "Black Perl" poem! Clearly an Evil Genious was at
work. (Know any?)
:-)
Hmm, speaking of smileys, this is my favorite line of perl poetry:
getpeername(s) -- cute ones! :-) :-)) & sort carefully
Bonus points to the first person (other than Mark, Tom, Larry, or Randal)
who knows why that works...
print "Not just another Black Perl poet,"
--Sharon
>Hmm, speaking of smileys, this is my favorite line of perl poetry:
> getpeername(s) -- cute ones! :-) :-)) & sort carefully
>Bonus points to the first person (other than Mark, Tom, Larry, or Randal)
>who knows why that works...
That's really cute. It works because the s)...)...) substitute
takes the cute ones! and tries to replace them with smileys.....
Of course the sort does not do very much since it has nothing to sort.
Seems like Perl does not check that &carefully exists...
--
Erik Johansen
----
You're right on the substitution, but I fooled you with the "&":
it's actually a bitwise AND, not a subroutine call, so the sort really
is sorting "carefully".
One of the fun things to do with perl poetry is to go ahead and use
reserved words (and punctuation) whenever you can fit some in,
just to keep it looking like perl.
That line could have been something like:
getpeername() & laugh & smile & joke & sort lookswise carefully
if I wanted to get fancy. :-)
--Sharon