From: Matt S Trout Date: Fri, 16 Jun 2006 23:02:57 +0000 (+0000) Subject: probably added date support X-Git-Tag: v0.07002~75^2~107 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c209c4fd7348bf4e5d730d3e79f345d25628ae55;p=dbsrgits%2FDBIx-Class.git probably added date support --- diff --git a/lib/DBIx/Class/InflateColumn/DateTime.pm b/lib/DBIx/Class/InflateColumn/DateTime.pm index 969e50e..6ae4d42 100644 --- a/lib/DBIx/Class/InflateColumn/DateTime.pm +++ b/lib/DBIx/Class/InflateColumn/DateTime.pm @@ -48,17 +48,20 @@ directly called by end users. sub register_column { my ($self, $column, $info, @rest) = @_; $self->next::method($column, $info, @rest); - if (defined($info->{data_type}) && $info->{data_type} =~ /^datetime$/i) { + return unless defined($info->{data_type}); + my $type = lc($info->{data_type}); + if ($type eq 'datetime' || $type eq 'date') { + my ($parse, $format) = ("parse_${type}", "format_${type}"); $self->inflate_column( $column => { inflate => sub { my ($value, $obj) = @_; - $obj->_datetime_parser->parse_datetime($value); + $obj->_datetime_parser->$parse($value); }, deflate => sub { my ($value, $obj) = @_; - $obj->_datetime_parser->format_datetime($value); + $obj->_datetime_parser->$format($value); }, } );