On Thu, 15 Nov 2001, Gerald Richter wrote:
> > >
> > > This is what my conclusion is from the discussion.
> > > Use the following modules for dates and times
> > >
> > > Class::Date
> > > Date::Parse
> > > Date::Format
> >
> > Can anyone explain what these 3 modules gain me over the 1 module
> > Time::Piece?
> >
>
> Without haveing used one of those all, just by reading the docs, I would say
> what's missing in Time::Piece is the nice operator overloading of + and -
> e.g.
>
>
> $date2 = $date+'3Y 2D'; # 3 Years and 2 days
$date2 = $date + (3 * ONE_YEAR) + (2 * ONE_DAY);
> $date3 = $date+[1,2,3]; # $date plus 1 year, 2 months, 3 days
> $date4 = $date+'3-1-5' # $date plus 3 years, 1 months, 5 days
Similar for these.
Yes, it's more verbose. Not much I can say about that. I could potentially
add some sort of strptime functionality to Time::Seconds so you could
parse '3Y 2D', and '3-1-5'.
> Of course that could be done with Time::Piece, but you have to create to
> objects.
Not true, as you see. I'm not convinced of the value of all this
overloading of stringification. It seems like very dangerous syntactic
sugar to me. And it's almost certainly not internationalised.
--
<Matt/>
/|| ** Founder and CTO ** ** http://axkit.com/ **
//|| ** AxKit.com Ltd ** ** XML Application Serving **
// || ** http://axkit.org ** ** XSLT, XPathScript, XSP **
// \\| // ** mod_perl news and resources: http://take23.org **
\\//
//\\
// \\