Re: DateTime used with Class::DBI
Matthew McGillis wrote: I have taken a look at the DateTime-Format-MySQL and it can produce the formats required however with out being able to get the format through a call as described above it will never work with Class::DBI. Here's what I use in a similar situation...in the base class for my DB, the one that inherits directly from Class::DBI, I have the following: --- sub _register_dates { my $class = shift; $class = ref $class if ref $class; foreach my $column (@_) { $class-has_a( $column = 'DateTime', inflate = \_date_inflate, deflate = \_date_deflate, ) } $class; } sub _date_inflate { DateTime::Format::MySQL-parse_datetime (shift) } sub _date_deflate { DateTime::Format::MySQL-format_datetime(shift) } Then, in any table-specific classes involving MySQL datetime fields, I register the datetime columns thusly: __PACKAGE__-_register_dates(qw(date_col1 date_col2 date_col3)); Seems to work well so far. Cheers, Matt
Re: DT::Wrapper API/semantics
On Friday, August 8, 2003, at 10:21 PM, Joshua Hoblitt wrote: This is the 'decorator infrastructure' that I've been whining for. It's kind of a melting pot for 'add-ons' or 'plug-ins'. The idea is to throw DT, DT::Cache, DT::Foo, DT::Validator, etc. into the 'pot' and end up with a factory that creates object with features from all of the input classes. I'm with you, except that I wonder if DT::Cache won't be weighed down by the overhead of the decorator chaining implementation. Dave's post was somewhat scary... :) -John
Re: DateTime Performance
A solution that is more or less equivalent, is to change the DefaultLocale routine. [...] Probably this changes the behaviour if the default locale is aliased. But IMHO, that's probably for the better. Yeah, that was my concern: add_aliases() and friends in DateTime::Locale would have to reach back into DateTime and blank the cached locale, which seemed evil to me. But I was just thinking of preserving the existing behavior. If this is not a constraint, then I'm all for the alternative you suggested. Ack - lets not go around fiddling with caches in other namespaces. The caching mechanism should be _internal_ to DateTime::Locale. -J --