Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How Perl Saved Planet Earth

Reply
Thread Tools

How Perl Saved Planet Earth

 
 
dave@subcreations.com
Guest
Posts: n/a
 
      03-08-2005
The year is 2525. Anyone who even utters the word "evolution" is
immediately annihilated. Object oriented programming is owned by the
huge conglomerate Microsoft-Fox-Bush-Bin-laden.

Most "computers" are always on, but the radical underground have fitted
some with "off" buttons and there has been a wild rumor circulating
that someone has created an "interface" to a computer that allows a
certain amount of control over sequencing.

You don't find out until much later that people at the conglomerate
have not only known about these "interfaces" but other things as well.

You don't have time right now to explain how it is you wound up a
stowaway aboard an intergalactic conglomerate mining vessel and learned
of the Perl programming language by eavesdropping on the crew, but
after numerous stops on various planets, a horrible reality sets in.

As near as you can surmise, once "warp drive" became practical, the
conglomerate suddenly began to lower their prices of consumer goods
that obviously have been created in other galaxies on planets such as
these. Originally the whole concept of warp was very controversial
because scientists realized the dangerous paradoxes created by
excursions into the past and was only allowed if a space ship returned
after it departed (relative to conditions at departure).

This did not stop the conglomerate from sending "seed" ships into the
past (and out of the source tree) and returning at certain intervals to
make "harvests" and deal with local problems. (Usually by creating
"reality" using Fox news.)

You decided to remain behind on one of these planets to alert the
inhabitants to the fact that when the expiration date occurs, all the
planet's content will be harvested, and there will be no survivors.

You have learned enough about physics to realize that all the
technological answers currently exist on this planet so you set about
establishing communications between concerned scientists.

Having done so, you now become concerned with "over-population" and you
look in your Perl Cookbook to see what you can do about the problem.

Although your English is a bit rusty and some of the terms seem a bit
quaint, you start finding some programs that just might work.

Considering your initial impression of the educational system creating
"Zombies", that is where you start your search.

Good Fortune! On page 660 of the Perl Cookbook, you find the amazingly
simple solution to your problem under the heading, "16.19 Avoiding
Zombie Processes", where it says:

Problem: Your program forks children, but the dead children accumulate,
fill up your process table, and aggravate your system administrator.

Solution: If you don't need to record the children that have
terminated, use: $SIG{CHLD} = 'IGNORE';

To keep better track of deceased children, install a SIGCHLD handler to
call waitpid:

use POSIX ":sys_wait_h";

$SIG{CHLD} = \&REAPER;
sub REAPER {
my $stiff;
while (($stiff = waitpid(-1, WNOHANG)) > 0) {
# do something with $stiff if you want
}
SIG{CHLD} = \&REAPER; # install *after* calling waitpid
}

After considerable scrutiny, you determine that the children have been
forking mothers and fathers and that it is the mother forkers that are
the real problem because they are the actual cause of the forked up
children.

You are currently engaged in writing a CPAN module to contend with all
these mother forkers.

May the forks be with you...

 
Reply With Quote
 
 
 
 
John W. Kennedy
Guest
Posts: n/a
 
      03-08-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> The year is 2525. Anyone who even utters the word "evolution" is
> immediately annihilated.


Must be rough on drillmasters and choreographers....

---
John W. Kennedy
"Those in the seat of power oft forget their failings and seek only the
obeisance of others! Thus is bad government born! Hold in your heart
that you and the people are one, human beings all, and good government
shall arise of its own accord! Such is the path of virtue!"
-- Kazuo Koike. "Lone Wolf and Cub: Thirteen Strings" (tr. Dana Lewis)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
The brief introduction of Planet earth ? shirleyhsshopping DVD Video 0 05-08-2008 03:36 AM
Windows Media Player won't play BBC Planet Earth Phisherman DVD Video 3 01-23-2008 12:22 PM
Planet Earth Phisherman DVD Video 38 05-27-2007 02:45 PM



Advertisments