in reply to Re: Fork/Spawn
in thread Fork/Spawn

The best way I know of to do the latter is not specifically documented in perlipc. Use alarm:
alarm 10; # send me a signal in 10 seconds # do some code which may not complete alarm 0; # if we get here in time, disable the alarm
If you're going to fork off children, be sure to read the section on SIGNALS in perlipc. You might even do something like this, in your child processes:
eval { local $SIG{ALRM} = sub { die "child process took too long to compl +ete" }; alarm 10; # do whatever your little heart desires, hope it's fast enough alarm 0; # whew, just made it }; if ($@ && $@ !~ /alarm clock restart/) { # abort the child process gra +cefully } else { # send the parent the information ? }