Subject: | ugh, datetimeparsing |
I've been chasing this bug for many months. Maybe even a year. It's
pretty subtle. I include a copy of Net-IMAP-Server in Net-IMAP-Simple for
testing and very occasionally (and I now know only on single digit dates
like today) the t/22 copy test would fail. WHY WHY WHY?
The reason is in Net::IMAP::Server::Message::internaldate(). Specifically,
use DateTime::Format::Strptime;
my $x = DateTime::Format::Strptime->new(pattern => "%e-%b-%Y %T
%z");
$x->parse_datetime("5-Jun-2010 08:25:12 -0400"); # fine
$x->parse_datetime(" 5-Jun-2010 08:25:12 -0400"); # not fine
and a couple lines above the parse_datetime() is this:
$self->{internaldate} = $value->strftime("%e-%b-%Y %T %z");
... which leads with a space on single digit days. This causes $value to be
undef and ->truncate to propagate a fail upwards.
-Paul
--
If riding in an airplane is flying, then riding in a boat is swimming.
114 jumps, 47.2 minutes of freefall, 90.4 freefall miles.