It just works here. This is my test case - tested with DateTime 0.32
and DateTime::Set 0.25 (latest cpan versions):
use DateTime::Set;
use strict;
my $months = DateTime::Set->from_recurrence(
# span => $dt_span_this_year, # optional span
recurrence => sub {
return $_[0]->truncate( to => 'month' )->add( months => 1 )
},
);
my $dt = DateTime->now;
print $months->next( $dt );
- Flavio S. Glock
2006/8/1, lee via RT <bug-DateTime-Set@rt.cpan.org>:
Show quoted text>
> Tue Aug 01 08:14:21 2006: Request 20789 was acted upon.
> Transaction: Ticket created by LGODDARD
> Queue: DateTime-Set
> Subject: from_recurrence
> Broken in: 0.25
> Severity: Critical
> Owner: Nobody
> Requestors: LGODDARD@cpan.org
> Status: new
> Ticket <URL:
http://rt.cpan.org/Ticket/Display.html?id=20789 >
>
>
> The DateTime::Set POD gives the following example:
>
> $months = DateTime::Set->from_recurrence(
> span => $dt_span_this_year, # optional span
> recurrence => sub {
> return $_[0]->truncate( to => 'month' )->add( months =>
> 1 )
> },
> );
>
> Without the "optional span", I get: Can't call method "truncate" on an
> undefined value ...
>
>