Subject: | Fix for "NotADate" value |
The check for "\s?at\s?" isn't sufficient. \bat\b might work a bit better but there is still no guarantee that having an "\bat\b" will match the second expression.
Returning if $pre isn't defined is enough to silence the warnings. Perhaps it's better to scrap the first return and keep the new one instead?
make; perl -Iblib/lib -e '
use DateTime::Format::Flexible;
my $dt = DateTime::Format::Flexible->parse_datetime("Not A Date");
';
Use of uninitialized value $pre in substitution (s///) at blib/lib/DateTime/Format/Flexible/lang/en.pm line 112.
Use of uninitialized value $pre in concatenation (.) or string at blib/lib/DateTime/Format/Flexible/lang/en.pm line 116.
Use of uninitialized value $time in concatenation (.) or string at blib/lib/DateTime/Format/Flexible/lang/en.pm line 116.
Subject: | NotADate.patch |
*** DateTime-Format-Flexible-0.29/lib/DateTime/Format/Flexible/lang/en.pm 2017-03-07 13:12:00.000000000 -0500
--- DateTime-Format-Flexible-0.29-new2/lib/DateTime/Format/Flexible/lang/en.pm 2018-02-25 23:41:46.966246291 -0500
***************
*** 107,112 ****
--- 107,113 ----
return $date if ( not $date =~ m{\s?at\s?}mx );
my ( $pre, $time, $post ) = $date =~ m{\A(.+)\s?at\s?([\d\.:]+)(.+)?\z}mx;
+ return $date if (not $pre);
# if there is an 'at' string, we want to remove any time that was set on the date by default
# 20050612T12:13:14 <-- T12:13:14
$pre =~ s{T[^\s]+}{};