Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: how to sleep-awake on perl script?

by edatawiz (Novice)
on Apr 23, 2009 at 21:14 UTC ( #759669=note: print w/replies, xml ) Need Help??

in reply to how to sleep-awake on perl script?

Usually I do this by having my code into a loop, check for an event and terminate the loop if wanted to. Maybe someone has better way. I am looking forward to a reply too ! This should work through SSH too !
$flag=1; while($flag) { $sleep=checkEvent(); if(not $sleep) { --- do events $flag=0; } else { #whatever time you want to delay before checking again ! sleep(2); } }

Replies are listed 'Best First'.
Re^2: how to sleep-awake on perl script?
by Anonymous Monk on Apr 24, 2009 at 00:44 UTC
    Hi-Thanks for the reply. what is checkEvent()? How do I catch a cntrl z (to stop the process any time I want). and then later continue anyway.
      checkEvent is an example. You can have your interrupt code or procedure to capture keystroke instead. Follow these links
        Hi All, I achieved what I wanted to do by using screen command.It works great even working thru SSH Thanks for the replies though,

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2022-08-18 13:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found