Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by tmharish (Friar)
on Feb 04, 2013 at 09:12 UTC ( [id://1016914]=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re^6: how to use angle operator with timeout?
by BrowserUk (Patriarch) on Feb 04, 2013 at 09:38 UTC

    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.

        A clear and definitive answer. Thank you. :)


        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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found