Re: perl fork exec

From: Steven Kurylo <sk_at_no.spam.please>
Date: Mon May 14 2007 - 16:18:36 CST

On 5/14/07, Scott Walde <scott@waldetech.ca> wrote:
> How do I reap my dead children when using fork/exec in perl? I have it
> working except for the defunct children.
>
> ttyl
> srw

The few times I've had to do it, I've always used the following, from
the perl manual

    sub REAPER {
        $waitedpid = wait;
        $SIG{CHLD} = \&REAPER; # loathe sysV
        logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
    }

    $SIG{CHLD} = \&REAPER;

However the perl cookbook has a more robust method

http://72.14.253.104/search?q=cache:MvvoYgfZDNMJ:www.unix.org.ua/orelly/perl/cookbook/ch16_20.ht
Received on Mon May 14 16:18:51 2007

This archive was generated by hypermail 2.1.8 : Mon May 14 2007 - 16:19:02 CST