http://www.perlmonks.org?node_id=759669


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,