expresspotato has asked for the wisdom of the Perl Monks concerning the following question:
Ideally the script shouldn't exit, but rather return something from the eval but I'm not sure how to return from the local $SIG{ALRM}... Any help would be greatly appreciated :)print "Evaluating... \n"; eval{ local $SIG{ALRM} = sub { $sys_check_mount{$mount_server} = 0; print "Alarm!"; exit(); }; alarm(5); print "Alarm Set... Trying system commands... \n"; if (-e $mount_server_check_path && utime(undef, undef, "$moun +t_server_check_path/mount_check")){ #print "OK\n"; $sys_check_mount{$mount_server} = 1; }else{ #print "Broken\n"; $sys_check_mount{$mount_server} = 0; push (@mount_server_broken,$mount_server); } alarm(0); print "Reset Alarm... \n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Alarm and blocking I/O.
by BrowserUk (Patriarch) on May 29, 2010 at 17:36 UTC | |
by expresspotato (Beadle) on May 29, 2010 at 17:55 UTC | |
by BrowserUk (Patriarch) on May 29, 2010 at 18:50 UTC | |
by expresspotato (Beadle) on May 29, 2010 at 19:25 UTC | |
by ikegami (Patriarch) on May 31, 2010 at 03:38 UTC | |
by expresspotato (Beadle) on May 29, 2010 at 22:04 UTC | |
by BrowserUk (Patriarch) on May 29, 2010 at 22:49 UTC | |
by expresspotato (Beadle) on May 29, 2010 at 22:18 UTC |