Subject: | Parsing more broken dates from mail clients |
Date: | Thu, 11 Jul 2013 20:32:36 +0100 |
To: | bug-Mail-Box [...] rt.cpan.org |
From: | Andrew Beverley <andy [...] andybev.com> |
Another case of broken mail clients. This time I have found some that
incorrectly put periods between time elements instead of colons. For
example: "Date: Tue, 9 Jul 2013 08.41.36 +0200". This is currently
parsed as "02 Saturday 00:00 LMT". This patch provides a workaround and
fixes that behaviour. It is patched against the previously updated file.
--- Date-new.pm 2013-07-04 22:46:10.000000000 +0100
+++ /usr/local/share/perl/5.10.1/Mail/Message/Field/Date.pm 2013-07-11
20:27:49.000000000 +0100
@@ -31,8 +31,8 @@
\s+ ( [A-Z][a-z][a-z] ) \s+ # month
( 19[0-9][0-9] | 2[0-9]{3} ) \s+ # year
( [0-1]?[0-9] | 2[0-3] ) \s* # hour
- \: ( [0-5][0-9] ) \s* # minute
- (?: \: ( [0-5][0-9] ) )? \s+ # second
+ [\:\.] ( [0-5][0-9] ) \s* # minute
+ (?: [\:\.] ( [0-5][0-9] ) )? \s+ # second
( [+-][0-9]{4} | [A-Z]+ )? # zone
\s* /x
or return undef;