> -----Original Message----- > From: Garrett, Philip (MAN-Corporate) > Sent: Saturday, April 22, 2006 10:51 PM > To: datetime@perl.org > Subject: RE: from_epoch for DateTime::LazyInit? > > > -----Original Message----- > > From: Garrett, Philip (MAN-Corporate) > > Sent: Saturday, April 22, 2006 6:56 PM > > To: datetime@perl.org > > Subject: RE: from_epoch for DateTime::LazyInit? > > > > > -----Original Message----- > > > From: Rick Measham [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, April 05, 2006 8:16 PM > > > To: Garrett, Philip (MAN-Corporate) > > > Cc: datetime@perl.org > > > Subject: Re: from_epoch for DateTime::LazyInit? > > > > > > Garrett, Philip (MAN-Corporate) wrote: > > > > Are there any plans to add a from_epoch constructor for > > > > DateTime::LazyInit? The module looks really useful for me, but > > > > since I create almost all my DateTime objects from epoch times, I > > > > can't use it. > > > > > > No plans at all .. but if you provide a patch that looks like it > > > will fit within the goals of LI, I'll have a look. > > > > Wanna give this a try? I added support for all the other constructors > > as well.
I also had trouble with the lazyinit module not supporting overloaded operators, e.g. $dt1 > $dt2. To fix, I added this to the main LazyInit package. Using the method names as strings didn't work -- I guess overload doesn't like AUTOLOAD. use overload ( 'fallback' => 1, '<=>' => sub { shift->_compare_overload(@_) }, 'cmp' => sub { shift->_compare_overload(@_) }, '""' => sub { shift->_stringify(@_) }, '-' => sub { shift->_subtract_overload(@_) }, '+' => sub { shift->_add_overload(@_) }, ); Philip