RE: Having trouble porting an application to MS-Windows



In "perlport - Writing portable Perl" in the Alphabetic list of Perl
Functions:

alarm SECONDS
alarm
Not implemented. (Win32)

I couldn't find anything in the ActiveState release notes that
contradicted that.

Bob McConnell

-----Original Message-----
From: Chas Owens [mailto:chas.owens@xxxxxxxxx]
Sent: Thursday, June 14, 2007 11:15 AM
To: Bob McConnell
Cc: beginners@xxxxxxxx
Subject: Re: Having trouble porting an application to MS-Windows

On 6/14/07, Bob McConnell <rvm@xxxxxxxxx> wrote
snip
On the Win32 platform, this form of select is only implemented for
sockets, and alarm() is not implemented at all.
snip

What makes you think the alarm function is not implemented? Running
the following code with the latest version of ActiveState Perl on
Windows XP works.

#!/usr/bin/perl

use strict;
use warnings;

print localtime() . "\n";
eval {
local $SIG{ALRM} = sub { die "timeout\n" };
alarm 3;
while (1) {}
};
print $@ if $@;
print localtime() . "\n";

.



Relevant Pages

  • Re: Bash: command output to variable
    ... list top 10 cpu intensive processes. ... An optimized perl solution: ... # reads a key without echo and with a timeout of $timeout seconds ... alarm $timeout; ...
    (comp.unix.shell)
  • Re: How to time out a forked command but still see output?
    ... Haven't done Perl in years. ... I tried a few things involving alarm() and eval but couldn't get them ... I also tried something like redirecting CMD to STDOUT but when I do ... die "\nTimed out command $command after waiting ...
    (comp.lang.perl.misc)
  • Re: Bash: command output to variable
    ... ReadMode "normal"; ... # reads key with a timeout of 5 seconds without echo ... alarm $timeout; ... # if the Perl syntax error message string exists and is not ...
    (comp.unix.shell)
  • Re: Cursor moving in one position
    ... On Mon, 9 Feb 2004, Ricardo Pichler wrote: ... I tested the following on RedHat Linux 9.0 using Perl 5.8.0. ... The alarm() function only has resolution to about 1 ... This means you can cancel your "spinner" using ...
    (perl.beginners)
  • Re: alarm() under W2003
    ... there is no hook into a command line prompt for standard input. ... An alarm is triggered but Perl does nothing with this, ... To work around this lack of effective programming by Perl porters, ...
    (comp.lang.perl.misc)