Is it possible to (easily) tell perl to kill itself and all children if
the script doesn't execute in x seconds?
to kill a script in itself you could use alarm($seconds)
If you really are serious about killed all forked children properly write a function that will kill all pids in a global array
and catch SIG{ALRM} to call that function.
like
@gl::CHILDPIDS =();
sub kill_child {
kill @gl::CHILDPIDS;
print "Bye ...\n";
exit(0);
}$SIG{ALRM}=\&kill_child;
alarm(100);
...
....
while(...) {
if(defined($pid = fork())){
push @CHILDPIDS , $pid if($pid);
} else {
print "FOrk error ...........\n";
...}
__END__ Hope that helps
Ram
}
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
