http://www.perlmonks.org?node_id=649916


in reply to socket time out

you could try using alarm in an eval block (untested):
eval { local $SIG{'ALRM'} = sub { die "Timed out" }; alarm($timeout); while(<$conn>) { .... alarm($timeout); } alarm(0); } if ($@ =~ /Timed out/) { print STDOUT "Timed Out.\r\n"; }
Oha