Take me over?
NAME
POE::Component::Schedule - Schedule POE events using DateTime::Set iterators
SYNOPSIS
use POE qw(Component::Schedule);
use DateTime::Set;
$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_";
},
},
);
# crontab DateTime set the hard way
$sched1 = POE::Component::Schedule->add(
$s1 => Tick => DateTime::Set->from_recurrence(
after => DateTime->now,
recurrence => sub {
return $_[0]->truncate( to => 'second' )->add( seconds => 2 )
},
),
);
# delete some schedule of events
$sched1->delete();
DESCRIPTION
This component encapsulates a session that sends events to client sessions on a schedule as defined by a DateTime::Set iterator. The implementation is straight forward if a little limited.
METHODS
spawn
No need to call this in normal use, add() and new() all crank one of these up if it is needed. Start up a PoCo::Schedule. Returns a handle that can then be added to.
add
Add a set of events to the schedule. the session and event name are passed to POE without even checking to see if they are valid and so have the same warnings as ->post() itself.
$schedule->add(
$session,
$event_name,
$DateTime_Set_iterator,
@event_args
);
new
new is an alias for add
delete
Removes a schedule using the handle returned from ->add or ->new
SEE ALSO
POE, DateTime::Set, POE::Component::Cron.
BUGS
You can look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-Schedule
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGMENT
This module is a friendly fork of POE::Component::Cron to extract the generic parts and isolate the Cron specific code in order to reduce dependencies on other CPAN modules.
The orignal author of POE::Component::Cron is Chris Fedde.
See https://rt.cpan.org/Ticket/Display.html?id=44442
AUTHOR
Olivier Mengué, dolmen@cpan.org
Chris Fedde, cfedde@cpan.org
COPYRIGHT AND LICENSE
Copyright © 2007-2008 Chris Fedde Copyright © 2009 Olivier Mengué
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.