Subject: | New version throws error on bad date |
Date: | Wed, 9 Dec 2015 21:48:59 +0000 |
To: | "bug-datetime-format-strptime [...] rt.cpan.org" <bug-datetime-format-strptime [...] rt.cpan.org> |
From: | Michael Dorman <mdorman [...] nvidia.com> |
Hey, Dave,
Using 1.56, if I run:
use strict;
use warnings;
use DateTime;
use DateTime::Format::Strptime;
my $parser = DateTime::Format::Strptime->new ( pattern => '%a %b %d %T %Y',
time_zone => DateTime->now->time_zone
) or die "Couldn't parse pattern";
my $datetime = $parser->parse_datetime( 'Wed Feb 29 12:02:28 2013' );
I end up with an undefined result---which is unsurprising since it's a nonsensical date. If I run it with 1.61, I get:
Can't call method "day_of_week_0" on an undefined value at /home/utils/perl5/perlbrew/perls/5.22.0-007/lib/site_perl/5.22.0/DateTime/Format/Strptime.pm line 760.
That seems a little...punitive.
Mike.
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------