Use the alarm() function, probably in conjunction with a signal handler, as documented in perlipc/"Signals" and the section on ``Signals'' in the Camel. You may instead use the more flexible Sys::AlarmCall module available from CPAN.