perlthirst has asked for the wisdom of the Perl Monks concerning the following question:
I have used Event module, to do a particular task for every n seconds.
my sample code is
use Event; $WatchObj = Event->timer('after' => 1, 'repeat' => 1, 'parked' => 1, 'cb' => sub { print "printing from with in sub routine \n"; } ); ## since used parked =1 , so called start explicitly. $WatchObj->start(); while (1) { }
For the above code, it should print "printing from with in the sub routine" for every 1 secs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Event Driven - timer
by almut (Canon) on Dec 15, 2008 at 10:49 UTC | |
|
Re: Event Driven - timer
by zentara (Cardinal) on Dec 15, 2008 at 15:30 UTC | |
|
Re: Event Driven - timer
by ig (Vicar) on Dec 15, 2008 at 15:10 UTC |