in reply to Net::Ping not working
$SIG{ALRM} = sub { die "timeout" }; eval { alarm(300); # do stuff here alarm(0); }; if($@) { if($@ =~ /timeout/) { # # Call our alrm_hdlr subroutine, we were hung up # alrm_hdlr(); } else { alarm(0); die; } } # continue on, manipulate data, etc... sub alrm_hdlr { # Handle the fact that we got hung up }
|
---|