Loading ...
Sorry, an error occurred while loading the content.

Alarm signals in Perl/NT

Expand Messages
  • shawn.poulson@sap.com
    Hello all, I m using Activestate Perl 5.005 in a Win2k server system. I m trying to implement some simple network functions using socket/connect/etc. I want
    Message 1 of 2 , Apr 2 12:21 PM
    • 0 Attachment
      Hello all,

      I'm using Activestate Perl 5.005 in a Win2k server system. I'm
      trying to implement some simple network functions using
      socket/connect/etc. I want to set timeouts for sending/receiving
      data. Examples I've found show it to work as such:

      eval {
      local $SIG{ALRM} = sub { die "timeout!\n"; };
      alarm(3); # 3 second timeout
      ... send/recv code ...
      alarm(0);
      };
      print $@; # print any error msgs from eval

      My problem is that I keep getting the following error that points to
      the alarm(3) line:
      The Unsupported function alarm function is unimplemented at
      D:\code\perl\FTP\a.pl line 68.

      I've been fiddling with this code for some time now and I cannot get
      around this error! Is this a Unix-only technique? If so, what is an
      NT compatible method?

      Any help would be appreciated. Thanks.
    • Damien Carbery
      Like the error says, alarm() is not implemented in ActiveState s port. Their Quirks page says: There are several functions that are unimplemented in the
      Message 2 of 2 , Apr 2 1:19 PM
      • 0 Attachment
        Like the error says, alarm() is not implemented in ActiveState's port.
        Their "Quirks" page says:
        "There are several functions that are unimplemented in the ActivePerl
        system. Here is a complete list of unimplemented functions:"
        alarm() is listed.

        I don't know an equivalent Win32 method.

        --- In perl-beginner@y..., shawn.poulson@s... wrote:
        > Hello all,
        >
        > I'm using Activestate Perl 5.005 in a Win2k server system. I'm
        > trying to implement some simple network functions using
        > socket/connect/etc. I want to set timeouts for sending/receiving
        > data. Examples I've found show it to work as such:
        >
        > eval {
        > local $SIG{ALRM} = sub { die "timeout!\n"; };
        > alarm(3); # 3 second timeout
        > ... send/recv code ...
        > alarm(0);
        > };
        > print $@; # print any error msgs from eval
        >
        > My problem is that I keep getting the following error that points to
        > the alarm(3) line:
        > The Unsupported function alarm function is unimplemented at
        > D:\code\perl\FTP\a.pl line 68.
        >
        > I've been fiddling with this code for some time now and I cannot get
        > around this error! Is this a Unix-only technique? If so, what is
        an
        > NT compatible method?
        >
        > Any help would be appreciated. Thanks.
      Your message has been successfully submitted and would be delivered to recipients shortly.