DateTim...:Simple(3)
πΈ NAME πΈ
DateTime::Cron::Simple β Parse a cron entry and check against current time
This is the DateTim...:Simple(3) page, filed under User Contributed Perl Documentation β and bestie, it is exactly what it says on the tin. π
β¨ SYNOPSIS β¨
use DateTime::Cron::Simple;
$c = DateTime::Cron::Simple->new($cron);
$boolean = $c->validate_time;
$c->new_cron($cron);
π DESCRIPTION π
okay so this module is a quick and dirty way to figure out whether a cron time format is valid for the current date and time. Lowkey useful, highkey chaotic. π
A cron entry follows the cron format from crontab(5). No cap.
The validate_time function uses the current date and time for comparison, but it will also accept a valid DateTime object as a parameter. Slay. π«Ά
π FUNCTIONS π
π¦ new π¦
$c = DateTime::Cron::Simple->new('0-59/2 10,12 * * 5');
Creates a cron entry. That's it, that's the vibe. β¨
π¦ new_cron π¦
$c->new_cron($cron);
Updates the cron entry to the given argument. Fresh cron, same object. π«
π¦ validate_time π¦
$boolean = $c->validate_time;
$boolean = $c->validate_time($dt);
Validates a datetime against the cron entry. If the argument is omitted, it validates against the current time (DateTime->now). Iconic behavior, honestly. β°
π¦ _parse_cron_field π¦
$data = $c->_parse_cron_field($field, $min, $max)
The internal little parser helper doing its thing behind the scenes. Main character energy, but private. π
π EXAMPLE π
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) { ... }
π₯ SEE ALSO π₯
DateTime::Event::Cron
It is very likely that this module will soon be deprecated. It was created without coordination with the developers of DateTime modules, which may be reached via
http://datetime.perl.org/
datetime@perl.org (the mailing list)
This module would better belong to the DateTime::Event namespace or else have its functionality incorporated into DateTime::Event::Cron. This release is transitional, while the right way to do it is being studied. So likeβ¦ it's giving βwe're working on it.β πβ¨
π AUTHORS/MAINTAINERS π
The original author of this module is
Brendan Fagan <suburbanantihero (at) yahoo (dot) com>.
At version 0.3, a full rewrite was done to set it free from license issues. The current maintainer is
Adriano Ferreira <ferreira (at) cpan (dot) org>.
Comments, bug reports, patches and flames are still appreciated. fr fr, send the flames. π₯π
π COPYRIGHT AND LICENSE π
Brendan Fagan holds the copyright from 2002 to 2006 over versions 0.1 and 0.2 of the distribution.
Copyright (C) 2006 by A. R. Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay that's the whole page, bestie β the footer says perl v5.42.0, dated 2025-12-14, and the page is DateTim...:Simple(3). Byeee! πβ¨π
π¦ where this page comes from
- arch rolling: perl-datetime-cron-simple 0.3-4 Β· GPL AND PerlArtistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms