+1 on Time::Piece.  I like the more verbose example Gerald gave:

$date3    = $date+{years=>1,months=>2,days=>3};

I think it will would be easy for new users to understand what is going on and
maintainers to now what took place.

The $date3    = $date+[1,2,3]; version is *sweet*, but seems more cool then
handy or does this start that old war on the speed advantage of an array over a
hash?

Aaron Johnson

Gerald Richter wrote:

> > >   $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.
> >
>
> ok, I see
>
> > 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.
> >
>
> I agree to you for the stringification, but I find something like
>
>     $date3    = $date+[1,2,3];   # $date plus 1 year, 2 months, 3 days
>
> really handy and maybe
>
>     $date3    = $date+{years=>1,months=>2,days=>3};   # $date plus 1 year, 2
> months, 3 days
>
> this is as verbose as the string version, but doesn't have the disadvantages
> of it. I guess both wouldn't be hard to add to Time::Piece.
>
> One point from my point of view that is speaking for Time::Piece is, that
> Matt is very active (not only) on the p5ee list, so we could expect that he
> will adapt Time::Piece for p5ee as far as it is needed.
>
> +1 for Time::Piece
>
> Gerald
>
> -------------------------------------------------------------
> Gerald Richter    ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
>
> Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
> E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925131
> WWW:        http://www.ecos.de      Fax:      +49 6133 925152
> -------------------------------------------------------------

Reply via email to