in reply to Re: Re: a scheduler
in thread a scheduler

Have you considered using POE ? If you have Time::HiRes installed, POE::Kernel will use it for timed events. And your code will be much shorter, with more elegant structure, and thus easier to maintain.

Here is a simple scheduler example:

use POE; $DELAY = 0.5; # every half a second sub do_something { my $kernel = $_[KERNEL]; print "Hello boy..\n"; $kernel->delay('wake_up!', $DELAY); } POE::Session->new( _start => sub { my $kernel = $_[KERNEL]; $kernel->delay('wake_up!', $DELAY); print "Session is started..\n"; }, _stop => sub { print "Session is stopped.\n"; }, 'wake_up!' => \&do_something, ); $poe_kernel->run;

Replies are listed 'Best First'.
Re: Re: Re: Re: a scheduler
by fredalbrecht (Novice) on Sep 18, 2002 at 15:59 UTC
    I have not yet come across POE. Will do some reading. I'm never sure what happens after/inside run (where do I run my normal code that is not related to the POE code ... newbie warning!) Will do some reading...<sigh>