One big reason why it doesn't work: THANKS $MICROSOFT.
In the early days of NT, they decided to only permit system calls and
drivers to interrupt system calls so that a user process could no longer
crash the system (think Windows 3.x). So it has never been possible to
implement 'alarm' unless the perl code was talking to a hardware driver
(e.g Win32::SerialPort - the driver has API calls to set the timeouts).
It appears you_know_who relented a bit with Win2K and provided a 'job
timeout' that could be setup from user code. So you want to look at the
Win32::job module on CPAN.
-bill
On Fri, 2010-04-02 at 16:56 -0400, Paul Rogers wrote:
> Trying to run the code below in Win32, any reason why it may not be working?
> Behaviour: It just sits there and doesn't time out as expected.
>
> Cheers,
> Paul ---
>
>
> my $timeout = 10;
> eval {
> local $SIG{ALRM} = sub { die "alarm\n" };
> alarm $timeout;
> print "Hit ENTER key within $timeout seconds: ";
> $buf = <>;
> alarm 0;
> };
>
> if ($@) {
> die unless $@ eq "alarm\n";
> # propagate unexpected errors
> # timed out
> } else {
> print "else\n";
> }
>
>
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs