On Thu, 16 Jan 2003, David Wheeler wrote:

> > Your first option is not on the table.  The options on the table are:
> >
> >   use DateTime;
> >   use DateTime::Parse::MySQL;
> >   my $dt = DateTime->from_mysql_datetime( $mysql_dt );
> >   print $dt->to_mysql_string();
> >
> > or
> >
> >   use DateTime;
> >   use DateTime::Parse::MySQL;
> >   my $dt = DateTime::Parse::MySQL->new_datetime( $mysql_dt );
> >   print DateTime::Parse::MySQL->mysql_datetime( $dt );
> >
> > Frankly, I think the first one is a lot easier to use and makes more
> > sense.  It's the decorator pattern without the dispatching overhead!
>
> Trying to catch up here a bit. It seems to me that the first option
> could just be a pass-through to the second.

I think #1 is off the table.  A few people liked it (including me), but
several were quite vehemently opposed to it.

I'll probably just go with the very straightforward API of:

 make a parsing object
 tell it to parse string X and return a DateTime

 make a formatting object
 tell it to format a DateTime object in a specific format

This isn't particularly clever, nor is it super-convenient.  But all the
clever and convenient suggestions seem to arouse more dislike from some
people, so it's easier to agree on the tried and true.  It might not be
ideal for anyone, but at least people who look at the modules will not be
turned off by an API they consider to abnormal ;)


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to