in reply to Re^4: $SIG{ALRM} and windows vista?
in thread $SIG{ALRM} and windows vista?
Windows doesn't have signals
No, but it simulates some of them:
use strict; use warnings; use 5.010; print 'Enter your password: '; my $password = eval { local $SIG{ALRM} = sub {die "timeout\n"}; alarm 5; # return <STDIN>; sleep 10; }; alarm 0; if ($@ =~ /timeout/) { print "You timed out.\n"; } __END__ [ 7:18:01.22] C:\test>alarmit.pl Enter your password: You timed out.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: $SIG{ALRM} and windows vista?
by ikegami (Patriarch) on Jan 04, 2010 at 07:20 UTC | |
Re^6: $SIG{ALRM} and windows vista?
by afoken (Chancellor) on Jan 04, 2010 at 08:29 UTC | |
by BrowserUk (Patriarch) on Jan 04, 2010 at 09:12 UTC | |
Re^6: $SIG{ALRM} and windows vista?
by 7stud (Deacon) on Jan 04, 2010 at 19:46 UTC | |
by BrowserUk (Patriarch) on Jan 04, 2010 at 20:37 UTC | |
by ikegami (Patriarch) on Jan 04, 2010 at 20:40 UTC |