Subject: | Bug in header parsing in Email::Simple |
Date: | Sun, 01 Apr 2007 14:52:29 -0700 |
To: | bug-Email-Simple [...] rt.cpan.org |
From: | PF <kernel [...] pkts.ca> |
Hello!
I'm using Email::Simple and exploring the features. Today I was reading
the headers of email messages, and found that the first line of the
headers, the "From emailaddress date" line, is mangled. This happens
because the header-splitting algorithm splits all header lines on the
first colon (':'). This results in splitting like this:
my @header=$email->header_pairs;
$header[0]="From user@address.com Sun Apr 1 13";
$header[1]="49:01 2007";
It's not the world's most important header, which is probably why this
hasn't been discovered before.
Thanks for a very useful program!
---
Be sure to include at least the following information:
* Distribution name and version (For example,
"DBIx-SearchBuilder-0.46")
perl-Email-Simple-1.998-1.noarch.rpm
* Perl version (Find this by running the command perl -v)
perl v5.8.5
* Operating System vendor and version (Find this by running the
command uname -a)
Fedora Core 3
Other things that are often helpful:
* Details about your operating environment that might be related
to the issue being described
The sample program is being given an email message as standard input.
* Exact cut and pasted error or warning messages
No error message
* The shortest, clearest code you can manage to write which
reproduces the bug described.
---
#!/usr/bin/perl -w
use strict;
use Email::Simple;
{ local ($/); $msg=<>; }
my $email=Email::Simple->new($msg);
my @headers=$email->header_pairs;
for (my $x=0;$x<@headers;$x+=2) {
print $headers[$x]." -- ".$headers[$x+1]."\n";
}
---
* A patch against the latest released version of this distribution
which fixes this bug.
Sorry.
--
PF <kernel@pkts.ca>