How Perl Saved Planet Earth

Discussion in 'Perl Misc' started by dave@subcreations.com, Mar 8, 2005.

  1. Guest

    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...
    , Mar 8, 2005
    #1
    1. Advertising

  2. 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)
    John W. Kennedy, Mar 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    20
    Views:
    783
    Hywel Jenkins
    Dec 14, 2005
  2. Shane Hathaway

    How to get listed on planet.python.org

    Shane Hathaway, Oct 17, 2005, in forum: Python
    Replies:
    0
    Views:
    270
    Shane Hathaway
    Oct 17, 2005
  3. jacob navia

    The C language in the planet Mars

    jacob navia, Jul 23, 2006, in forum: C Programming
    Replies:
    33
    Views:
    921
    goose
    Jul 30, 2006
  4. MC felon
    Replies:
    5
    Views:
    303
    red floyd
    Sep 21, 2006
  5. Marc Girod

    KeyError: ... updated type, in planet

    Marc Girod, Aug 8, 2007, in forum: Python
    Replies:
    0
    Views:
    253
    Marc Girod
    Aug 8, 2007
Loading...

Share This Page