DateTime::Event::Cron 0.07
Sponsored Links
DateTime::Event::Cron 0.07 Ranking & Summary
File size:
0.010 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
6483
Date added:
2007-05-16
Publisher:
Matthew P. Sisk
Publisher URL:
http://search.cpan.org/~s
DateTime::Event::Cron 0.07 description
DateTime::Event::Cron is a DateTime extension for generating recurrence sets from crontab lines and files.
SYNOPSIS
use DateTime::Event::Cron;
# DateTime::Set construction from crontab line
$crontab = */3 15 1-10 3,4,5 */2;
$set = DateTime::Event::Cron->from_cron($crontab);
$iter = $set->iterator(after => DateTime->now);
while (1) {
my $next = $iter->next;
my $now = DateTime->now;
sleep(($next->subtract_datetime_absolute($now))->seconds);
# do stuff...
}
# List of DateTime::Set objects from crontab file
@sets = DateTime::Event::Cron->from_crontab(file => /etc/crontab);
$now = DateTime->now;
print "Now: ", $now->datetime, "n";
foreach (@sets) {
my $next = $_->next($now);
print $next->datetime, "n";
}
# DateTime::Set parameters
$crontab = * * * * *;
$now = DateTime->now;
%set_parms = ( after => $now );
$set = DateTime::Event::Cron->from_cron(cron => $crontab, %set_parms);
$dt = $set->next;
print "Now: ", $now->datetime, " and next: ", $dt->datetime, "n";
# Spans for DateTime::Set
$crontab = * * * * *;
$now = DateTime->now;
$now2 = $now->clone;
$span = DateTime::Span->from_datetimes(
start => $now->add(minutes => 1),
end => $now2->add(hours => 1),
);
%parms = (cron => $crontab, span => $span);
$set = DateTime::Event::Cron->from_cron(%parms);
# ...do things with the DateTime::Set
# Every RTFCT relative to 12am Jan 1st this year
$crontab = 7-10 6,12-15 10-28/2 */3 3,4,5;
$date = DateTime->now->truncate(to => year);
$set = DateTime::Event::Cron->from_cron(cron => $crontab, after => $date);
# Rather than generating DateTime::Set objects, next/prev
# calculations can be made directly:
# Every day at 10am, 2pm, and 6pm. Reference date
# defaults to DateTime->now.
$crontab = 10,14,18 * * * *;
$dtc = DateTime::Event::Cron->new_from_cron(cron => $crontab);
$next_datetime = $dtc->next;
$last_datetime = $dtc->previous;
...
# List of DateTime::Event::Cron objects from
# crontab file
@dtc = DateTime::Event::Cron->new_from_crontab(file => /etc/crontab);
# Full cron lines with user, such as from /etc/crontab
# or files in /etc/cron.d, are supported and auto-detected:
$crontab = * * * * * gump /bin/date;
$dtc = DateTime::Event::Cron->new(cron => $crontab);
# Auto-detection of users is disabled if you explicitly
# enable/disable via the user_mode parameter:
$dtc = DateTime::Event::Cron->new(cron => $crontab, user_mode => 1);
my $user = $dtc->user;
my $command = $dtc->command;
# Unparsed original cron entry
my $original = $dtc->original;
SYNOPSIS
use DateTime::Event::Cron;
# DateTime::Set construction from crontab line
$crontab = */3 15 1-10 3,4,5 */2;
$set = DateTime::Event::Cron->from_cron($crontab);
$iter = $set->iterator(after => DateTime->now);
while (1) {
my $next = $iter->next;
my $now = DateTime->now;
sleep(($next->subtract_datetime_absolute($now))->seconds);
# do stuff...
}
# List of DateTime::Set objects from crontab file
@sets = DateTime::Event::Cron->from_crontab(file => /etc/crontab);
$now = DateTime->now;
print "Now: ", $now->datetime, "n";
foreach (@sets) {
my $next = $_->next($now);
print $next->datetime, "n";
}
# DateTime::Set parameters
$crontab = * * * * *;
$now = DateTime->now;
%set_parms = ( after => $now );
$set = DateTime::Event::Cron->from_cron(cron => $crontab, %set_parms);
$dt = $set->next;
print "Now: ", $now->datetime, " and next: ", $dt->datetime, "n";
# Spans for DateTime::Set
$crontab = * * * * *;
$now = DateTime->now;
$now2 = $now->clone;
$span = DateTime::Span->from_datetimes(
start => $now->add(minutes => 1),
end => $now2->add(hours => 1),
);
%parms = (cron => $crontab, span => $span);
$set = DateTime::Event::Cron->from_cron(%parms);
# ...do things with the DateTime::Set
# Every RTFCT relative to 12am Jan 1st this year
$crontab = 7-10 6,12-15 10-28/2 */3 3,4,5;
$date = DateTime->now->truncate(to => year);
$set = DateTime::Event::Cron->from_cron(cron => $crontab, after => $date);
# Rather than generating DateTime::Set objects, next/prev
# calculations can be made directly:
# Every day at 10am, 2pm, and 6pm. Reference date
# defaults to DateTime->now.
$crontab = 10,14,18 * * * *;
$dtc = DateTime::Event::Cron->new_from_cron(cron => $crontab);
$next_datetime = $dtc->next;
$last_datetime = $dtc->previous;
...
# List of DateTime::Event::Cron objects from
# crontab file
@dtc = DateTime::Event::Cron->new_from_crontab(file => /etc/crontab);
# Full cron lines with user, such as from /etc/crontab
# or files in /etc/cron.d, are supported and auto-detected:
$crontab = * * * * * gump /bin/date;
$dtc = DateTime::Event::Cron->new(cron => $crontab);
# Auto-detection of users is disabled if you explicitly
# enable/disable via the user_mode parameter:
$dtc = DateTime::Event::Cron->new(cron => $crontab, user_mode => 1);
my $user = $dtc->user;
my $command = $dtc->command;
# Unparsed original cron entry
my $original = $dtc->original;
DateTime::Event::Cron 0.07 Screenshot
Sponsored Links
DateTime::Event::Cron 0.07 Keywords
DateTime
Cron 0.07
DateTimeEventCron
Crontab
Cron
sets
lines
user
generating
DateTime::Event::Cron 0.07
Libraries
Programming
Bookmark DateTime::Event::Cron 0.07
DateTime::Event::Cron 0.07 Copyright
WareSeeker periodically updates pricing and software information of DateTime::Event::Cron 0.07 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of DateTime::Event::Cron 0.07 Edition. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
DateTime::Event::Cron 0.07 Related Software
Rose::DateTime::Util Perl module contains some simple DateTime wrapper functions.
Rose::DateTime is a Perl module with DateTime helper functions and objects.
DateTime::Format::Builder is a Perl module to create datetime parser classes and objects.
Virtual Cron is a PHP library that can check whether it is time to run a periodical task.
DateTime::Event::Sunrise is a Perl DateTime extension for computing the sunrise/sunset on a given day.
DateTime::Cron::Simple is a Perl module that can parse a cron entry and check against current time.
incron is an "inotify cron" system. It works like the regular cron but is driven by filesystem events instead of time periods.
GNU mcron (Mellors cron) is a 100% compatible replacement for Vixie cron.
My Software
You have not saved any software. Click "Save" next to each software to save it to your software basket
Related Information
Sponsored Links
TOP POPULAR DOWNLOAD