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 #### eval { local $SIG{ALRM} = sub { die "child process took too long to complete" }; 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 gracefully } else { # send the parent the information ? }