Log::Parallel::Durations - parse duration specifications
use Log::Parallel::Durations; my $job = { frequency => 'daily', timespan => '30 days', }; my $jd = Time::JulianDay::julian_day(2008, 10, 22); my $jd_from_limit = Time::JulianDay::julian_day(2008, 8, 22); my $jd_to_limit = Time::JulianDay::julian_day(2008, 12, 14); ($timespec, @jd_range) = frequency_and_span($job, $jd, $jd_from_limit, $jd_to_limit);
This is a helper module for the process_logs. It parses duration and frequency specifications.
It understands frequencies:
daily every 3 days every week each month on the 13th on the 1st each month on the 1st of each month every Tuesday on the 3rd Wednesday of each month
It understands durations:
3 days 1 quarter 2 years
The API meets the needs of process_logs. Given a start time ($jd_from_limit) and an end time ($jd_to_limit) and a particular day ($jd) and a structure that specifies the duration and frequency ($job), it will return undef unless the particular day ($jd) happens to meet the specification. Most jobs are expected to run daily so most of the time this is efficient.
$jd_from_limit
$jd_to_limit
$jd
$job
All dates are in Julian Days. Use Time::JulianDay.
See the code for more details.
This package may be used and redistributed under the terms of either the Artistic 2.0 or LGPL 2.1 license.
To install Log::Parallel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Parallel
CPAN shell
perl -MCPAN -e shell install Log::Parallel
For more information on module installation, please visit the detailed CPAN module installation guide.