perldoc -f alarm
Alarm allows a program to set a timer, at the expiration of which, a SIGALRM is sent to the program.
By eval'ing a block that includes re-assignment of the $SIG{ALRM} handler, then setting the alarm, the block can be made to exit if the timer expires before the block finishes normally. Examining $@ allows you to ensure that the block died for the expected reason. Very useful for anything that interacts over the network.
I think a process can only have one alarm running at a time, so if any of your routines or modules you're use'ing uses it already, you may be out of luck. But if the module is using alarm, it should be doing so to implment a timeout of it's own, so the trick is to make it timeout the way you want it to.
--Bob Niederman, http://bob-n.com