POE::C...hedule(3pm)
π POE::Component::Schedule π
okay bestie, so this is a page from the User Contributed Perl Documentation, and it's all about POE::Component::Schedule β scheduling POE events using DateTime::Set iterators. no cap, it's giving very "set it and forget it" energy. π¦
β¨ NAME β¨
POE::Component::Schedule β schedule POE events using DateTime::Set iterators π
πΈ SYNOPSIS πΈ
use POE qw(Component::Schedule);
use DateTime::Set;
POE::Session->create(
inline_states => {
_start => sub {
$_[HEAP]{sched} = POE::Component::Schedule->add(
$_[SESSION], Tick => DateTime::Set->from_recurrence(
after => DateTime->now,
before => DateTime->now->add(seconds => 3),
recurrence => sub {
return $_[0]->truncate( to => 'second' )->add( seconds => 1 )
},
),
);
},
Tick => sub {
print 'tick ', scalar localtime, "\n";
},
remove_sched => sub {
# Three ways to remove a schedule
# The first one is only for API compatibility with POE::Component::Cron
$_[HEAP]{sched}->delete;
$_[HEAP]{sched} = undef;
delete $_[HEAP]{sched};
},
_stop => sub {
print "_stop\n";
},
},
);
POE::Kernel->run();
π DESCRIPTION π
So basically, this component wraps up a whole session whose entire personality is sending events to client sessions on a schedule. and that schedule? it's defined by a DateTime::Set iterator. it's giving personal assistant, but make it a Perl object. π
π POE::Component::Schedule METHODS π
π«Ά spawn(Alias => name)
Spin up the PoCo::Schedule background session with the alias you hand it. It gives you back the back-end session handle.
ngl, you don't need to call this in normal life β "add()" and "new()" both crank one of these up on their own if one is needed. it's very self-sufficient of them. β¨
π add($session, $event_name, $iterator, @event_args)
my $sched = POE::Component::Schedule->add(
$session,
$event_name,
$DateTime_Set_iterator,
@event_args
);
Add a set of events to the scheduler. π
You get a schedule handle back. and the event? it gets automatically deleted once the handle isn't referenced anymore. no manual cleanup, periodt. π
π new($session, $event_name, $iterator, @event_args)
"new()" is literally just an alias for "add()". same thing, different name, iconic behavior honestly. π§
π SCHEDULE HANDLE METHODS π
π delete()
Removes a schedule, using the handle that "add()" or "new()" gave you.
DEPRECATED: Schedules are now automatically deleted when they are not referenced anymore. So just setting the container variable to "undef" will delete the schedule. that's it, that's the whole trick. π«Ά
π₯ SEE ALSO π₯
POE, DateTime::Set, POE::Component::Cron.
π SUPPORT π
You can look for information at:
- RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-Schedule>: post bug report there. π
- CPAN Ratings
<http://cpanratings.perl.org/p/POE-Component-Schedule>: if you use this distribution, please add comments on your experience for other users. π¬
- Search CPAN
<http://search.cpan.org/dist/POE-Component-Schedule/>
- AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/POE-Component-Schedule>
πΈ ACKNOWLEDGMENT & HISTORY πΈ
This module was a friendly fork of POE::Component::Cron β the goal was to extract the generic parts and isolate the Cron specific code so it would reduce dependencies on other CPAN modules. very "we're splitting up but we still share the friend group" of them. π
See <https://rt.cpan.org/Ticket/Display.html?id=44442>.
The original author of POE::Component::Cron is Chris Fedde.
POE::Component::Cron is now implemented as a class that inherits from POE::Component::Schedule. slay, generational. π
Most of the POE::Component::Schedule internals have since been rewritten in 0.91_01 and we have now a complete test suite. ate and left no crumbs. β
π AUTHORS π
Olivier Mengue, "dolmen@cpan.org" Chris Fedde, "cfedde@cpan.org"
π COPYRIGHT AND LICENSE π
Copyright X 2009-2010 Olivier Mengue. Copyright X 2007-2008 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. π«Ά
and that's the whole vibe, bestie β¨ this page is from the User Contributed Perl Documentation, pulled from perl v5.26.2, dated 2018-08-24. go schedule something cute ππ¦
π¦ where this page comes from
- debian bookworm: libpoe-component-schedule-perl 0.95-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libpoe-component-schedule-perl 0.95-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libpoe-component-schedule-perl 0.95-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libpoe-component-schedule-perl 0.95-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms