From: Alexandr Ciornii Date: Mon, 21 Nov 2011 10:59:25 +0000 (+0200) Subject: remove warning in case of datetime column without inflate_datetime X-Git-Tag: 0.08~1^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9a584d4c0b27017ab3716bfe451a884ebe437933;p=dbsrgits%2FDBIx-Class-DateTime-Epoch.git remove warning in case of datetime column without inflate_datetime --- diff --git a/lib/DBIx/Class/DateTime/Epoch.pm b/lib/DBIx/Class/DateTime/Epoch.pm index ec857f8..b87af88 100644 --- a/lib/DBIx/Class/DateTime/Epoch.pm +++ b/lib/DBIx/Class/DateTime/Epoch.pm @@ -39,7 +39,7 @@ sub add_columns { sub _inflate_to_datetime { my( $self, $value, $info, @rest ) = @_; return $self->next::method( $value, $info, @rest ) - unless $info->{ data_type } =~ m{int}i || $info->{ inflate_datetime } eq 'epoch'; + unless $info->{ data_type } =~ m{int}i || (exists $info->{ inflate_datetime } && $info->{ inflate_datetime } eq 'epoch'); return DateTime->from_epoch( epoch => $value ); } @@ -47,7 +47,7 @@ sub _inflate_to_datetime { sub _deflate_from_datetime { my( $self, $value, $info, @rest ) = @_; return $self->next::method( $value, $info, @rest ) - unless $info->{ data_type } =~ m{int}i || $info->{ inflate_datetime } eq 'epoch'; + unless $info->{ data_type } =~ m{int}i || (exists $info->{ inflate_datetime } && $info->{ inflate_datetime } eq 'epoch'); return $value->epoch; }