AnyEvent-Cron

 view release on metacpan or  search on metacpan

lib/AnyEvent/Cron.pm  view on Meta::CPAN

    handles => {
        add_job => 'push'
    },
    is => 'rw', 
    isa => 'ArrayRef' ,
    default => sub {  [ ] }

    ;


has timers => ( is => 'rw', isa => 'ArrayRef' , default => sub { [ ] } );

use Scalar::Util qw(refaddr);

sub add {
    my $self = shift;
    my ( $timespec, $cb , %args ) = @_;

    # try to create with crontab format
    try {
        my $cron_event = DateTime::Event::Cron->new($timespec);

lib/AnyEvent/Cron.pm  view on Meta::CPAN

            elsif( $time->{second} ) {
                $next->add( minutes => 1 );
            }
            else {
                die 'unknown spec';
            }
        }
    }

    $job->{next}{ $next_epoch } = 1;
    $job->{watchers}{$next_epoch} = AnyEvent->timer(
        after    => $delay,
        cb       => sub {
            $self->{_cv}->begin;
            delete $job->{watchers}{$next_epoch};

            $self->_schedule($job) unless $job->{once};

            if ( $job->{single} && $job->{running}++ ) {
                print STDERR "Skipping job '$name' - still running\n"
                    if $debug;



( run in 1.212 second using v1.01-cache-2.11-cpan-49f99fa48dc )