Dave Rolsky wrote:
So what input would use DateTime->new instead? Or are you saying that of my examples, only "Yesterday" has to be special cased.? In which case _I_ would prefer that the new() was smart enough to try and locate additional help in parsing, rather than requiring the programmer to decide whether to call new() or parse().my $dt1 = new DateTime "Yesterday";No, these would have to be either:my $dt = DateTime->parse( "Yesterday" ); or my $dt = DateTime::Parse::Extended->datetime( "Yesterday" );
Why not have the ->new() call handle the basic ISO date format (and a few others) internally and then backtrack to increasingly obscure parsing methods if the previous level of parsing fails. For example, have DateTime::Parse contain an array of possible parsing methods which each are tried in turn. This way, if you never need Date::Manip, it is never loaded, but it is there if you do need it without your having to explicitely ask for it.
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-5747