The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

POE::Component::Cron - Schedule POE Events using a cron spec

SYNOPSIS

use POE::Component::Cron;

$s1 = POE::Session->create(
    inline_states => {
        _start => sub {
           $_[KERNEL]->delay( _die_, 120 );
        }

        Tick => sub {
           print 'tick ', scalar localtime, "\n";
        },
    }
);

# crontab schedule the easy wa
$sched =
  POE::Component::Cron->from_cron( '* * * * *' => $s2->ID => 'Tick' );

# delete some schedule of events
$sched->delete();

DESCRIPTION

This component extends POE::Component::Schedule by adding an easy way t specify event schedules using a simple cron spec.

METHODS

from_cron

Add a schedule using a simple syntax for plain old cron spec.

POE::Component::Cron-> from_cron('*/5 */2 * * 1' => session => event);

Accepts the cron syntax as defined by DateTime::Event::Cron which is pretty the same as that used by common linux cron.

SEE ALSO

POE, POE::Component::Schedule perl, DateTime::Set, DateTime::Event::Cron.

AUTHOR

Chris Fedde, <cfedde@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2008 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.