Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

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 http://www.perlmonks.org/?node_id=534650 http://systhread.net/texts/200009pi.php
      Vishy
        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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-06-25 19:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (83 votes). Check out past polls.

    Notices?