[Dbix-class] Using DBIx::Class::InflateColumn

Michele Beltrame mb at italpro.net
Tue May 29 18:37:23 GMT 2007


Hello!

>> __PACKAGE__->inflate_column('creation_time', {
>>         inflate => sub { DateTime::Format::MySQL->parse_datetime(shift); },
>>         deflate => sub { DateTime::Format::MySQL->format_datetime(shift); },
>>     });
> 
> InflateColumn::DateTime is your friend. There isn't a good reason to
> roll your own inflators/deflators for datetime fields.

Unless you need to convert UTC <-> custom_timezone maybe.

Michele.

-- 
Michele Beltrame
http://www.varlogarthas.net/
ICQ 76660101 - MSN mb at italpro.net
Privacy: http://www.italpro.net/em.html




More information about the Dbix-class mailing list