in reply to Re: Re: SIGALRM and gethostbyaddr
in thread SIGALRM and gethostbyaddr

Here is the new code using use Sys::SigAction. Thanks!!!
use Sys::SigAction qw( set_sig_handler ); .... eval { my $code = sub { die "alarm clock restart"; }; my $h = Sys::SigAction::set_sig_handler( 'ALRM', $code, { +flags => 0, safe => 1 } ); alarm 10; # schedule alarm for every 10 seconds eval { ($my_name, $my_aliases, $addrtype, $my_length, @my_add +r) = gethostbyname($my_hostname); }; alarm 0; }; alarm 0; die if $@ && $@ !~ /alarm clock restart/; #reraise