Chas Owens wrote: > > You can also use $SIG{CHLD} to install a handler if you are not as > heartless as I am. This is similar to calling waitpid() in your main > loop, but has the benefit of handling all children as soon as > possible. The only drawback is that make the code harder to read and > debug (since it is hard to predict exactly when the handler will run). > > use POSIX ":sys_wait_h"; > > my $handler = sub { > my $pid; > while (($pid = waitpid(-1, &WNOHANG)) > 0) { > # do something with $pid > } > $SIG{CHLD} = $handler #reinstall the handler
When perl compiles this it will use $main::handler for the assignment. > } > $SIG{CHLD} = $handler; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>