From: Matt S Trout Date: Wed, 23 Jul 2008 20:09:26 +0000 (+0000) Subject: fix cycle, reformat to 80 cols X-Git-Tag: v0.08240~399 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dceeddc7fed4011e79c6f79f47b16742fc3f043e;p=dbsrgits%2FDBIx-Class.git fix cycle, reformat to 80 cols --- diff --git a/lib/DBIx/Class/InflateColumn/DateTime.pm b/lib/DBIx/Class/InflateColumn/DateTime.pm index e1c5de7..d2597ac 100644 --- a/lib/DBIx/Class/InflateColumn/DateTime.pm +++ b/lib/DBIx/Class/InflateColumn/DateTime.pm @@ -78,6 +78,8 @@ sub register_column { $timezone = $info->{extra}{timezone}; } + my $undef_if_invalid = $info->{datetime_undef_if_invalid}; + if ($type eq 'datetime' || $type eq 'date') { my ($parse, $format) = ("parse_${type}", "format_${type}"); $self->inflate_column( @@ -86,7 +88,8 @@ sub register_column { inflate => sub { my ($value, $obj) = @_; my $dt = eval { $obj->_datetime_parser->$parse($value); }; - die "Error while inflating ${value} for ${column} on ${self}: $@" if $@ and not $info->{datetime_undef_if_invalid}; + die "Error while inflating ${value} for ${column} on ${self}: $@" + if $@ and not $undef_if_invalid; $dt->set_time_zone($timezone) if $timezone; return $dt; },