develooper Front page | perl.datetime | Postings from January 2003

API question

Thread Next
John Peacock
January 14, 2003 06:58
API question
Message ID:
Are these going to be permissible initialization calls with the proposed API?

     my $dt1 = new DateTime "Yesterday";
     my $dt2 = new DateTime "2002/01/04";
     my $dt3 = new DateTime "1-4-2002"; # same as last, i.e U.S. parsing
     my $dt4 = new DateTime localtime();
     my $dt4 = new DateTime "11:30pm";

The reason I ask is that a lot of the example init's seem to assume the 
date/time has already been parsed into it's constituents.  I would like to have 
those too, but for most purposes, the module should DWIM.

I would propose that DateTime itself should have no parsing itself, rather it 
should always call DateTime::Parse, which would itself be a set of replaceable 
routines with various possible backends, e.g DateTime::Parse::MySQL.  The 
default implementation should handle most/all of the above without any other module.


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-5747

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About