DateTime::Cron::Simple - Parse a cron entry and check against current time
use DateTime::Cron::Simple; $c = DateTime::Cron::Simple->new($cron); $boolean = $c->validate_time; $c->new_cron($cron);
This module is a quick and dirty way to determine if a cron time format is valid for the current date and time.
A cron entry follows the cron format from crontab(5).
The validate_time function uses the current date and time for comparison, but will also accept a valid DateTime object as a parameter.
use DateTime::Cron::Simple; $c = DateTime::Cron::Simple->new('0-59/2 10,12 * * 5'); if($c->validate_time) { ... } $c->new_cron('* * 1 * 0'); if($c->validate_time) { ... }
Please see the CHANGES file in the module distribution.
- currently does not handle ! and > or < in cron entries - better code implementation
Brendan Fagan <suburbanantihero (at) yahoo (dot) com>. Comments, bug reports, patches and flames are appreciated.
Copyright (c) 2004 - Brendan Fagan
To install DateTime::Cron::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DateTime::Cron::Simple
CPAN shell
perl -MCPAN -e shell install DateTime::Cron::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.