in reply to Process time out

The alarm code might look something like this:
$SIG{ALRM} = sub { die "timeout"; }; eval { alarm(60); # shouldn't take more than a minute # do something here alarm(0); # if the last op finished, cancel the alarm }; if ($@ =~ /timeout/) { # you know it didn't finish } else { # continue }
Shamelessly adapted from the Perl Cookbook, though I once wrote code like this anyway.