Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Simple CPAN distribution.

Report information
The Basics
Id: 86926
Status: resolved
Priority: 0/
Queue: Email-Simple

People
Owner: Nobody in particular
Requestors: rfg [...] tristatelogic.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Email::MIME->new($message) destroys header formatting
Date: Sun, 14 Jul 2013 13:27:44 -0700
To: bug-Email-Simple [...] rt.cpan.org
From: "Ronald F. Guilmette" <rfg [...] tristatelogic.com>
I'm trying to use the Email::MIME parser to parse a message from which I will then edit out certain headers, and then reconstruct the original message... hopefully verbatim... minus the header(s) I have removed. It is the "verbatim" reconstruction of the message that is the problem. That isn't working because when I use: Email::MIME->new($message) to parse the original message text, the parser is doing two quite annoying (and as far as I can tell quite unnecessary) things, specifically: 1) Within the body text of each header line, leading whitspace within the body of the header line is being unnecessarily removed. 2) Within the body text of each header line, line continuations (i.e. <CR><LF><WS>) are being unnecessarily removed. The above two factors make it impossible to reconstruct, verbatim, a message from its component parts once it has been parsed by Email::MIME. I can understand how and why it might be inconvenient, within the code of Email::MIME, to preserve the exact original formatting... including leading whitspace and line continuations... but it sure would be helpful if you guys could implement it anyway.
Is all this still the case on the most recent Email::MIME and Email::Simple? Note these changes from Email::Simple recently: 2.201 2013-04-16 no changes 2.200_01 2013-04-09 preserve the original header layout unless changed The problem you describe, or one very much like it, was causing me grief a few months ago, and the above releases addressed it for me. If you see the same behavior with those versions, or were already using them, please let me know. I hope to be spending a bit of time on the Email::* bug queues in the next few weeks.
Subject: Re: [rt.cpan.org #86926] Email::MIME->new($message) destroys header formatting
Date: Sun, 14 Jul 2013 14:47:18 -0700
To: bug-Email-Simple [...] rt.cpan.org
From: "Ronald F. Guilmette" <rfg [...] tristatelogic.com>
In message <rt-4.0.13-2092-1373836689-1939.86926-6-0@rt.cpan.org>, you wrote: Show quoted text
><URL: https://rt.cpan.org/Ticket/Display.html?id=86926 > > >Is all this still the case on the most recent Email::MIME and Email::Simple? > >Note these changes from Email::Simple recently: > >2.201 2013-04-16 > no changes > >2.200_01 2013-04-09 > preserve the original header layout unless changed
Humm... I guess that it is time for me to refresh my entire Perl install. It appears that my intalled Simple.pm file has a creation date on it of April 16, but the folks who maintain the FreeBSD ports are always a bit behind, so I'll try to fetch & test the newer version. Show quoted text
>The problem you describe, or one very much like it, was causing me grief a few > months ago, and the above releases addressed it for me.
Great! Show quoted text
>If you see the same behavior with those versions, or were already using them, >please let me know. I hope to be spending a bit of time on the Email::* bug q >ueues in the next few weeks.
OK. Thanks much. The documentation bugs, for me at least, were _really_ annoying, because they forced me into a guessing game. (I apologize if I came on too strong when reporting those.) Anyway, I now know that the header_pairs method just returns one big long array in which the even numbered elements are the header names and the odd numbered ones are the header "bodies". My opinion... which is probably worth what you paid for it... is that it would be a Good Thing to have a slightly different version of that method, but one that would return an array of references to a bunch of little arrays, each of which would contain only two elements, i.e. [0] and [1], where the [0] element would be the header name and the corresponding [1] element would be the header body" value. I think that this would make traversing the headers set (and pulling out what you want) easier in many cases, e.g.: my @headers = $email->header_nv_pairs; foreach my $hdr (@headers) { print (@{$hdr}[0], ":", @{$hdr}[1], "\n"); # Reconstruct! } Oh! And one more little item about documentation... Given a set of headers with multiple "Received:" lines in the set, what will be the effect of this? $header->header_set('Received' => @values); Are *all* of the Received: lines changed in that case?? And also, oh, by the way, is the above operation performed case-sensitively or case-insensitively? The documentation doesn't say.
Subject: Re: [rt.cpan.org #86926] Email::MIME->new($message) destroys header formatting
Date: Sun, 14 Jul 2013 19:08:39 -0400
To: "Ronald F. Guilmette via RT" <bug-Email-Simple [...] rt.cpan.org>
From: Ricardo Signes <rjbs [...] cpan.org>
Pardon my terse reply, I'm just popping in briefly. * "Ronald F. Guilmette via RT" <bug-Email-Simple@rt.cpan.org> [2013-07-14T17:47:32] Show quoted text
> my @headers = $email->header_nv_pairs; > foreach my $hdr (@headers) { > print (@{$hdr}[0], ":", @{$hdr}[1], "\n"); # Reconstruct! > }
my @headers = $email->header_nv_pairs; while (my ($n, $v) = splice @headers, 0, 2) { print "$n: $v\n"; } So, I'm not all that inspired to add more API. I'll try to deal with everything else when I get back to Email-*. (q.v., http://rjbs.manxome.org/rubric/entry/1996 ) -- rjbs
Download signature.asc
application/pgp-signature 490b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #86926] Email::MIME->new($message) destroys header formatting
Date: Sun, 14 Jul 2013 16:50:20 -0700
To: bug-Email-Simple [...] rt.cpan.org
From: "Ronald F. Guilmette" <rfg [...] tristatelogic.com>
In message <rt-4.0.13-2902-1373843335-1292.86926-6-0@rt.cpan.org>, "Ricardo Signes via RT" <bug-Email-Simple@rt.cpan.org> wrote: Show quoted text
>So, I'm not all that inspired to add more API.
OK. I understand. I think it is a Good Idea, but I admit that there is a tradeoff (involving API bloat) that has to be evaluated.