NAME
POE::Component::Cron - Schedule POE Events using a cron spec
SYNOPSIS
use POE::Component::Cron;
use DateTime::Event::Crontab;
use DateTime::Event::Random;
$s1 = POE::Session->create(
inline_states => {
_start => sub {
$_[KERNEL]->delay( _die_, 120 );
}
Tick => sub {
print 'tick ', scalar localtime, "\n";
},
Tock => sub {
print 'tock ', scalar localtime, "\n";
}
_die_ => sub {
print "_die_";
}
}
);
$cron = POE::Component::Cron->spawn();
# crontab DateTime set
$cron->add(
$s1 => Tick => DateTime::Event::Cron->from_cron('* * * * *')->iterator(
span => DateTime::Span->from_datetimes(
start => DateTime->now,
end => DateTime::Infinite::Future->new
)
),
);
# random stream of events
$cron->add(
$s2 => Tock => DateTime::Event::Random->(
seconds => 5,
start => DateTime->now,
)->iterator
);
DESCRIPTION
This compoment encapsulates a session that sends events to client sessions on a schedule as defined by a DateTime::Set iterator. The implementation is streight forward if a little limited. As of this writing there is no mechinism for deleting schedules once they have been added.
METHODS
spawn
Start up a poco::cron.
add
Add another schedule of events to the.
SEE ALSO
POE, perl, DateTime::Event::Cron.
AUTHOR
Chris Fedde, <cfedde@littleton.co.us>
COPYRIGHT AND LICENSE
Copyright (C) 2004 by Chris Fedde
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.