On 9/29/06, Dave Rolsky <[EMAIL PROTECTED]> wrote:
On Fri, 29 Sep 2006, José Parrella wrote:
> I'm the one that made the original complaint about DT::Cron::Simple
> representing the Venezuelan Patents Office. I've finished writing an
> API-compatible module, named DT::Cron::Parser [1]. I reduced the number
> of lines of code and contemplated the ability to parse word entries for
> the day of the week and month of the year fields, as in crontab(5).
I agree. But at this time, I worked with the concerns of Adam Kennedy:
fill out the space left by a distribution others use. We need right
now the same API, the same namespace, a code with an explicit license
(CPAN-compatible). And that's what I worked at today. The result will
be visible (after some pause) in CPAN via the URL:
http://search.cpan.org/CPAN/authors/id/F/FE/FERREIRA/exp/DateTime-Simple-Cron-0.3-RC.tar.gz
As I said before, that's really not a good namespace. The author of
DT::Cron::Simple just stuck it there without consulting this list, much to
my annoyance.
I undestand how much this state of things was unsatisfactory for you.
If I may become the maintainer of the module, I will deprecate it as
soon as possible.
Either this belongs under DT::Event or outside of DT
(Cron::Parser::DateTime?).
But what we _really_ need to know is what DT::Cron::Simple did that
DT::Event::Cron does not do!
Is there a need for two modules, or can DT::Event::Cron be
patched/fixed/improved somehow?
I don't think DT::Cron::Simple is irreconciliable with
DT::Event::Cron. To be true, the API of DT::Cron::Simple is
deceptively simple.
use DateTime::Cron::Simple;
my $c = DateTime::Cron::Simple->new($cron);
print "ok" if $c->validate_time($dt); # $dt is a DateTime
object or DateTime->now by default
There is also "$c->new_cron($cron)" to change the cron entry
represented by the object, but it doesn't add anything really worthy.
The main point is the 'validate_time' method. What does it do? Verify
that a date matches the specification given by the cron entry. Just
this.
'2009-09-01T00:00:00' matches '* * * * *'
'2009-09-01T00:00:00' matches '0 * * * *'
'2009-09-01T00:01:00' does not matches '0 * * * *'
'2009-09-01T00:00:00' matches '* 0-2 1,10,20 * *'
At a first glance, it seems DateTime::Event objects don't do this. But
a method like
match_datetime
may be introduced with this semantic. You tell me if it makes sense.
Best regards,
Adriano Ferreira.