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

The db code won't be interruptible* (a good thing), but the LWP stuff will be. No idea what "abstract the site page information" means, much less how it's implemented, so I don't know about that.

* — That means the signal handler will be called when the db code returns if the signal was sent when the db code was executing.

Replies are listed 'Best First'.
Re^3: Perl Alarm Not Working
by BrowserUk (Patriarch) on Dec 19, 2010 at 21:57 UTC
    the LWP stuff will be [interuptable]

    You sure?

    When I run the following two one liners, 'here' is printed after 30 seconds--when the server times out--not after 10 as it would be if the alarm had interupted the socket read.

    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

    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.
      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". ;-)

        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.