Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: CountDownTimer for my perl program,

by vinoth.ree (Parson)
on Feb 22, 2013 at 07:21 UTC ( #1020089=note: print w/ replies, xml ) Need Help??


in reply to CountDownTimer for my perl program,

tmharish ++

Here is the exact code to timeout for 25 minutes.

use strict; use warnings; use utf8; eval { local %SIG; $SIG{ALRM}= sub{ die "timeout reached, after 25 minutes!\n"; }; alarm 25*60; # 25 minutes. while(1) { sleep(1); print "Hello Perl\n"; } alarm 0; }; alarm 0; if($@) { print "Error: $@\n"; } exit(0);


Comment on Re: CountDownTimer for my perl program,
Download Code
Re^2: CountDownTimer for my perl program,
by MidLifeXis (Prior) on Feb 22, 2013 at 13:52 UTC

    See the warning about using sleep and alarm being used in tandem.

    --MidLifeXis

Re^2: CountDownTimer for my perl program,
by vinoth.ree (Parson) on Feb 25, 2013 at 04:46 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2014-07-14 07:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (256 votes), past polls