[comp.lang.perl] Does perl implement $SIG{'SIGCHLD'} ?

rahard@eeserv.ee.umanitoba.ca (Budi Rahardjo) (07/13/90)

Does perl implement $SIG{'SIGCHLD'} ?
The following program will fork a child and let it dies,
but it stays in "zombie" status. How do I exit from the child
properly ?
PS: run the program, and observe the status (ps -ux) before
    exiting.

Thanks for the help
-- Budi -----------------------------------------------------
#!/usr/local/bin/perl
# Test forking a child and exit

print "Testing fork\n";  
print "I will fork a child and let the child dies\n";
$SIG{'SIGCHLD'} = 'dofireman'; # trap zombies 
$child=fork;
if ($child == 0) {
    print "I am the children\n";
    print "I'll exit now\n";
    exit 0;
    }  
else {
    print "I am the parent\n";
    print "Please observe if the child is in zombie status\n";
    print "Hit return to quit ";
    getc;
    }    
sub dofireman {
    print "Catching ZOMBIE\n"; 
    wait;
    }
--
Budi Rahardjo                 <rahardj@ccu.umanitoba.ca>
<rahard@ee.umanitoba.ca>   <rahard@budi.ee.umanitoba.ca>
Electrical Engineering - University of Manitoba - Canada