Dave Rolsky wrote:
> 
> On Mon, 30 Jun 2003, Ben Bennett wrote:
> 
> > The nits:
> >  1) The following doesn't work because add_duration() doesn't return
> >     the object, but rather falls through and returns the number of
> >      nanoseconds in the final object:
> >  --
> >   my $dur = DateTime::Duration->new(months => 3)->add(hours => -3);
> >  --
> 
> This should be fixed so as to be consistent with DateTime.pm.
> 
> >  2) Having a way to construct this directly would be nice being able
> >     to make a duration that you can not directly construct seems odd.
> 
> Well, maybe.  Right now the constructor is really simple, which is good.
> More functionality is nice, but so is simplicity.

use DateTime;
my $dt = DateTime->now;
my $dur = sub { $_[0]->add( months => 3 )->subtract( hours => 3 ) };
print $dur->($dt)->datetime;

- Flavio S. Glock

Reply via email to