Dave Rolsky wrote: > use DateTime; > use DateTime::Parse::MySQL; > my $dt = DateTime::Parse::MySQL->new_datetime( $mysql_dt ); > print DateTime::Parse::MySQL->mysql_datetime( $dt ); > > I can also imagine some other scheme, where parse/format modules register > the formats they can handle with DateTime.pm. > > But I'm very strongly opposed to something that just passes random strings > into new() and then loads the module on demand. > I guess that is the part that I don't understand. If you have the ability to add new parsing methodology to a list, you can just as easily subtract. So, if you want to use only the basic parsing and throw an error if you get a non-standard date format: use DateTime ( parse => basic); # class-wide default my $date1 = DateTime->new($dtstring); # better be ISO CCYYMMDD my $sqldate = DateTime->new($sqlstr, parse => MySQL); # object override etc. This is a much more friendly interface for the average programmer. John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4720 Boston Way Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5747Thread Previous | Thread Next