perldoc -q timeout
Found in /usr/share/perl/5.8/pod/perlfaq8.pod
How do I timeout a slow event?
Use the alarm() function, probably in conjunction with a
signal handler, as documented in "Signals"
in perlipc and the section on ``Signals'' in the Camel.
You may instead use the more flexible Sys::AlarmCall module av
+ailable from CPAN.
The alarm() function is not implemented on all versions of Wind
+ows.
Check the documentation for your specific version of Perl.
That should help.... check the specific docs for
alarm and
eval for more information.
Update:Actually, I just had a look and IO::Socket has its own timeout method. So you probably want to use that :p