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

Eduard Giménez egimenez at capside.com
Tue May 29 17:29:38 GMT 2007


 
Hi,

I'm trying to use DBIx::Class::InflateColumn to inflate some date columns,
so I put that on the model (it's a Catalyst App attacking a MySQL DB).

__PACKAGE__->inflate_column('creation_time', {
        inflate => sub { DateTime::Format::MySQL->parse_datetime(shift); },
        deflate => sub { DateTime::Format::MySQL->format_datetime(shift); },
    });

It works well, but I have to access to this column using
get_inflated_column("creation_time"). I would like to get the inflated
result for each request, so doing simply a get_column("creation_time") would
be enough.

I couldn't find a way to do that, so now I'm trying to overload the
inflate_result method, so it will parse each row and each column inflating
the desired ones. 

Do you think it is the correct way? Am I reinventing the wheel?

TIA!

Eduard Giménez
CAPSiDE 
Systems Engineer
egimenez at capside.com




More information about the Dbix-class mailing list