http://www.perlmonks.org?node_id=572417


in reply to Killing a hanging child process

You could use a non-blocking waitpid and simply time all the children, then signal/kill them if they go over whatever limits you set.

(from perldoc -f waitpid)

use POSIX ":sys_wait_h"; ... do { $kid = waitpid(-1, WNOHANG); } until $kid > 0;

status of the child is in $?

HTH!