in reply to Safety of using alarm

One way to do this in perl safely, without too much more code, is to fork/exec and have the parent just execute a non-blocking waitpid followed by a short sleep in a loop until the time limit expires, and then kill the child. If you decide to use alarm, it is a good idea to have the parent process kill the child when the alarm occurs (i.e. I've seen cases were ALARM doesn't kill the child process and it ends up sticking around).

bluto