NAME

EV::Cron - Add crontab watcher into EV.

VERSION

Version 0.01

SYNOPSIS

use 5.010;
use EV;
use EV::Cron;

my @watchers;

push @watchers, EV::cron     '*  * * * *', sub { say                           'Every minute.'; };
push @watchers, EV::cron     '5  0 * * *', sub { say 'Five minutes after midnight, every day.'; };
push @watchers, EV::cron_ns '15 14 1 * *', sub { say  'At 2:15pm on the first of every month.'; };

EV::run;

DESCRIPTION

This module extends EV by adding an easy way to specify event schedules using a crontab line format.

METHODS

EV::cron($cronspec, $callback)

Calls the callback when the event schedules using a crontab line format occurs.

Parameters

$cronspec - SCALAR - The string in crontab line format crontab(5).

$callback - CODEREF - The callback.

Return value

The newly created watcher.

EV::cron_ns($cronspec, $callback)

The cron_ns variant doesn't start (activate) the newly created watcher.

SEE ALSO

EV

AUTHOR

Loïc TROCHET <losyme@gmail.com>

Repository available at https://github.com/losyme/EV-Cron.

COPYRIGHT AND LICENSE

Copyright (c) 2012 by Loïc TROCHET.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

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