NAME

AnyEvent::Cron - The great new AnyEvent::Cron!

VERSION

Version 0.01

SYNOPSIS

my $cron = AnyEvent::Cron->new( 
        verbose => 1,
        debug => 1,
        after => 1,
        interval => 1,
        ignore_floating => 1
);

# 00:00 (hour:minute)
$cron->add("00:00" => sub { warn "zero"; })
    ->add( DateTime->now => sub { warn "datetime now" } )
    ->run();

my $cv = AnyEvent->condvar;
$cv->recv;

Or:

$cron->add({  
    type => 'interval',
    second => 0 ,
    triggered => 0,
    callback => sub { 
        warn "SECOND INTERVAL TRIGGERD";
    },
},{  
    type => 'interval',
    hour => DateTime->now->hour , 
    minute =>  DateTime->now->minute ,
    callback => sub { 
        warn "HOUR+MINUTE INTERVAL TRIGGERD";
    },
},{  
    type => 'interval',
    hour => DateTime->now->hour ,
    callback => sub { 
        warn "HOUR INTERVAL TRIGGERD";
    },
},{  
    type => 'interval',
    minute => DateTime->now->minute ,
    callback => sub { 
        warn "MINUTE INTERVAL TRIGGERD";
    },
},{
    type => 'datetime' ,
    callback => sub { warn "DATETIME TRIGGED"  },
    datetime => (sub { 
            # my $dt = DateTime->now->add_duration( DateTime::Duration->new( minutes => 0 ) );
            my $dt = DateTime->now;
            # $dt->set_second(0);
            # $dt->set_nanosecond(0);
            warn "Next trigger: ", $dt;
            return $dt; })->()
})->run();

METHODS

add( @events )

add( "12:36" => sub { } )

add( DateTime->now => sub { } )

create_interval_event

$cron->create_interval_event({
    hour => $hour,
    minute => $minute,
    callback => $cb,
});

create_datatime_event

AUTHOR

Cornelius, <cornelius.howl_at_gmail.com>

BUGS

Please report any bugs or feature requests to bug-anyevent-cron at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-Cron. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc AnyEvent::Cron

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2010 Cornelius.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.