in reply to Re: Strawberry Perl and alarm() on Windows
in thread Strawberry Perl and alarm() on Windows
Uhh, am I missing something?
use strict; use warnings; print scalar localtime, "\n"; eval { $SIG{__DIE__} = sub { alarm(0) }; $SIG{ALRM} = sub { die "timeout" }; alarm(2); system('sleep 5'); }; print $@ if $@; print scalar localtime, "\n";
Output:
Fri May 22 17:46:53 2015
timeout at C:\Temp\b.plx line 8.
Fri May 22 17:46:55 2015
Alarm appears to work just fine even when calling out to system
In Section
Seekers of Perl Wisdom