Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my $timeout = 5; eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm $timeout; my $ret = qx/ping db01/; alarm 0; }; if ($@) { # timed out print "timeout handling ($! - $@) ...\n"; die unless $@ eq "alarm\n"; # propagate unexpected errors } else { # didn't print "no timeout timeout handling...\n"; }
I am writing watchdog scripts an I need response from the clients whithin a defined timeout period.
Any suggestions?
TIA
Retitled by g0n from 'timout problem with alarm'.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: timeout problem with alarm
by Limbic~Region (Chancellor) on Jul 12, 2005 at 14:02 UTC | |
by Anonymous Monk on Jul 13, 2005 at 09:46 UTC | |
by Anonymous Monk on Jul 13, 2005 at 10:04 UTC | |
by Limbic~Region (Chancellor) on Jul 13, 2005 at 12:42 UTC | |
|
Re: timeout problem with alarm
by BrowserUk (Patriarch) on Jul 12, 2005 at 14:07 UTC | |
|
Re: timeout problem with alarm
by derby (Abbot) on Jul 12, 2005 at 14:40 UTC |