Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Help to infinite loop

by dwhite20899 (Friar)
on Jan 10, 2009 at 23:19 UTC ( [id://735447]=note: print w/replies, xml ) Need Help??


in reply to Help to infinite loop

You don't say what platform you're on, so I can't give you too specific help, but maybe you should look at the alarm function. http://perldoc.perl.org/functions/alarm.html

instead of sleeping, and calling a sub to stop the loop, write the loop like this (pseudocode):

while (!alarmed) { yourWorkHere(); alarm("you have 60 sec. to press a key to stop this loop"); if (keyPressed) { alarmed=1; } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2026-01-20 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (124 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.