in reply to Executing Systems Calls with Care

Isn't this exactly what alarm is designed for? perldoc -f alarm worked pretty well for me in the past.

Replies are listed 'Best First'.
Re^2: Executing Systems Calls with Care
by diotalevi (Canon) on Feb 15, 2005 at 21:10 UTC

    alarm() will not interrupt system calls in perl starting with 5.8. Since you are using a version older than that, you may be able to use it.

      But it does.

      $ perl5.8.6 -wle 'alarm 3; `cat /dev/zero`' Stops after 3 seconds.
        FWIW, on MacOS and AIX,

        perl -le 'alarm 3; system("sleep 100");'

        does kill perl, but it doesn't kill the sleep.