in reply to Re^3: Perl Alarm Not Working
in thread Perl Alarm Not Working

C:\test>start /b perl -MIO::Socket -E"$s=IO::Socket::INET->new(Listen=>1,LocalPort=>12345);$c=$s->accept; +sleep 30" C:\test>perl -MIO::Socket -E"$s=IO::Socket::INET->new('localhost:12345');eval{alarm 10;<$s>};pri +nt'here'" here

Windows has no signals. Not even SIGALRM. Perl emulates them, and the emulation is far from perfection. (It's actually pretty good, given that ugly Windows API.)

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^5: Perl Alarm Not Working
by BrowserUk (Patriarch) on Dec 19, 2010 at 22:36 UTC

    You're telling me non-useful information I already know. alarm does interupt non-io operations on windows:

    C:\test>perl -E"$c=0;eval{ alarm 10; ++$c while 1; alarm 0;}" Terminating on signal SIGALRM(14)

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      You're telling me non-useful information I already know.

      No, apparently you don't.

      $ perl -MIO::Socket -E'$s=IO::Socket::INET->new(Listen=>1,LocalPort=>1 +2345);$c=$s->accept; sleep 30' & [1] 3863 $ perl -MIO::Socket -E'$s=IO::Socket::INET->new("localhost:12345");eva +l{alarm 10;<$s>};print"here"' Alarm clock

      alarm does interupt non-io operations on windows:

      No, just some. The coverage isn't complete.

        $ ... & is not

        non-io operations on windows:
        No, just some. The coverage isn't complete.

        Did I say all non-io operations?

        So, your demonstration demonstrates nothing useful or relevant, and is certainly not intended to help the OP.

        So whatever point you attempted to make, you failed.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.