> Why does the DateTime::Set class need to 
get both dates back?  I think that's what 
is confusing me. 
  
> Another option: the callback receives a 
start date and an end date parameters, and 
it returns the list of the dates that are 
in that time span. This looks much simpler, 
and it solves the problem. 
 
An example - implementation of a yearly 
recurrence: 
 
$dts = DateTime::Set->new( 
  callback => sub { 
    my ($dt_start, $dt_end) = @_; 
    my @result; 
    $dt_start->truncate( to => 'year' ); 
    do { 
        push @result, $dt_start->clone; 
        $dt_start->add( year => 1 ); 
    } until $dt_start > $dt_end; 
    return @result; 
  } 
); 
 

Reply via email to