On Tue, 14 Jan 2003, Jonathan Scott Duff wrote: > I was thinking that a sort of DBI/DBD dichotomy could be applied to > DateTimes but along multiple dimensions. Something like this: > > my $dt = DateTime( > parser => DateTime::Parser::MySQL, > formatter => DateTime::Formats::strftime, > week_starts_at => DateTime::Weekdays::Sunday, > );
Just like I refuse to offer a way to switch between 0 and 1 indexed values for methods, I am not going to offer a way to set the first day of the week to Sunday. However, just like we have month and month_0, I would be fine with day_of_week and day_of_week_Sunday_is_first (modulo a better name). In fact, in implementing the strftime code I already implemented the %w specifier, which returns 0-6 (Sun-Sat), so we need the functionality anyway. The other syntax you propose isn't that bad, but how does it scale when you want to have multiple parsers and formatters A) as defaults; and B) per object? And how do you actually do parsing/formatting once the classes/objects are known by the DateTime object at hand? > Hey, I know! Let's fork and take the TimeDate namespace to make a > superficially similar but completely different set of date/time > routines. <ducking and running> ;-) * 5 tamucc.edu, huh? Lesse. That's Corpus Christi, TX. Yep, got the phone # and address. <arnold-voice>You can run but I vill find you, jah.</arnold-voice> -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/
