Skip Menu |

This queue is for tickets about the DateTime-Set CPAN distribution.

Report information
The Basics
Id: 2386
Status: resolved
Priority: 0/
Queue: DateTime-Set

People
Owner: Nobody in particular
Requestors: sisk [...] mojotoad.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.00_20
Fixed in: 0.00_20



Subject: DateTime::Set recurrences broken
It seems that the recurrence generator is being called twice on every iteration. Witness the following code: --- #!/usr/bin/perl -w use DateTime; use DateTime::Set; $dts = DateTime::Set->from_recurrence( next => sub { $_[0]->add(minutes => 1) }, span => DateTime::Span->new(start => DateTime->now), ); print "\n"; print "ITER:\n"; $iter = $dts->iterator; my $count = 1; while ( ($dt = $iter->next) && $count <= 4) { print "$count: ", $dt->iso8601, "\n"; ++$count; }; --- Produces: ITER: 1: 2003-04-13T22:05:43 2: 2003-04-13T22:07:42 3: 2003-04-13T22:09:41 4: 2003-04-13T22:11:40 --- Notice how we're only getting every other minute. Also, why are the seconds drifting down? Thanks, Matt
From: sisk [...] mojotoad.com
Hmmm, apparently this is a feature, not a bug. I have a more fundamental understanding of how things work now, though there is room for improvement in the docs and possibly even a 'raw recurrence' callback where all the logic is handed to the source program. This can be closed. Thanks, Matt