X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FInflateColumn%2FDateTime.pm;h=0e2d0588634104fa5d5e5b8872a1bef1313936e7;hb=a036182226af9edc62ef393cebca797030f44a9a;hp=1b72ac64b72b83cbedc425b96bffc2290336b9c7;hpb=70c288086248e5a4008490df22a56632341f2473;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/InflateColumn/DateTime.pm b/lib/DBIx/Class/InflateColumn/DateTime.pm index 1b72ac6..0e2d058 100644 --- a/lib/DBIx/Class/InflateColumn/DateTime.pm +++ b/lib/DBIx/Class/InflateColumn/DateTime.pm @@ -169,13 +169,10 @@ sub register_column { inflate => sub { my ($value, $obj) = @_; - my $dt = try - { $obj->_inflate_to_datetime( $value, $infcopy ) } - catch { - $self->throw_exception ("Error while inflating ${value} for ${column} on ${self}: $_") - unless $infcopy->{datetime_undef_if_invalid}; - undef; # rv - }; + # propagate for error reporting + $infcopy->{__dbic_colname} = $column; + + my $dt = $obj->_inflate_to_datetime( $value, $infcopy ); return (defined $dt) ? $obj->_post_inflate_datetime( $dt, $infcopy ) @@ -198,8 +195,16 @@ sub _flate_or_fallback my $parser = $self->_datetime_parser; my $preferred_method = sprintf($method_fmt, $info->{ _ic_dt_method }); - my $method = $parser->can($preferred_method) ? $preferred_method : sprintf($method_fmt, 'datetime'); - return $parser->$method($value); + my $method = $parser->can($preferred_method) || sprintf($method_fmt, 'datetime'); + + return try { + $parser->$method($value); + } + catch { + $self->throw_exception ("Error while inflating ${value} for $info->{__dbic_colname} on ${self}: $_") + unless $info->{datetime_undef_if_invalid}; + undef; # rv + }; } sub _inflate_to_datetime { @@ -300,7 +305,7 @@ use the old way you'll see a warning - please fix your code then! can be found in the documentation for L. =item Further discussion of problems inherent to the Floating timezone: - L + L and L<< $dt->set_time_zone|DateTime/"Set" Methods >> =back