Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: how to use angle operator with timeout?

by BrowserUk (Pope)
on Feb 04, 2013 at 01:37 UTC ( #1016885=note: print w/ replies, xml ) Need Help??


in reply to Re^3: how to use angle operator with timeout?
in thread how to use angle operator with timeout?

I know that they do not work on win32, and why.

My question was: can signals -- alarm generated or otherwise -- interrupt blocking IO on *nix in under the auspices of safe-signals?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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.


Comment on Re^4: how to use angle operator with timeout?
Re^5: how to use angle operator with timeout?
by Anonymous Monk on Feb 04, 2013 at 02:39 UTC
      you should use

      That'll be tobyink and/or the OP that need to do that. Or maybe not? (Damn! It is hard to get a straight answer around here :()


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      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.
Re^5: how to use angle operator with timeout?
by tmharish (Friar) on Feb 04, 2013 at 09:12 UTC

    This works on *nix:

    use strict ; use warnings ; my $timeout_in = 5 ; eval { local $SIG{ALRM} = sub { die "timed_out\n" }; alarm($timeout_in); while(<>) { alarm($timeout_in); my $in = $_ ; chomp( $in ) ; print $in . "\n" ; last if( $in eq 'exit' ); } alarm(0) ; }; if ($@) { die( "Hey ... whats with the slow typing ??\n" ); }

      Really? Actual tested code on which flavour of *nix & Perl please?

      Because that seems to contradict anonymonk's reading of the docs?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      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.

        OS:

        Linux MYCOMPNAME_REMOVED 3.5.0-23-generic #35-Ubuntu SMP Thu Jan 24 13 +:15:40 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

        Perl:

        Summary of my perl5 (revision 5 version 14 subversion 2) configuration +: Platform: osname=linux, osvers=3.2.0-23-generic, archname=x86_64-linux-gnu-t +hread-multi uname='linux komainu 3.2.0-23-generic #36-ubuntu smp tue apr 10 20 +:39:51 utc 2012 x86_64 x86_64 x86_64 gnulinux '

        I should add that I use this on production servers on multiple flavors of Ubuntu and have been using this ( Not completely sure here ) since Perl 5.08 or so - definitely works on 5.10 as we have that on some servers.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1016885]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2015-07-04 18:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls