Improvement of end-of-line processing of multi-part in

Hello.

Thank you for the other day.

I have an email in other bugs this time.

The Email-MIME-1.925, and when the following conditions

* $email->{mycrlf} is LF.
* there is a quoted-printable part in the multipart

There seems to be a bug that failed to process new line at the end, is not = get clean.

I wrote a test and patch.

For illustration purposes, I wrote a simple script.
I then paste the results.

I would appreciate your support if it is good.

Cheers,
Tomohiro Hosaka

<pre>
#!/usr/bin/env perl

use Modern::Perl;
use Email::MIME;
use Data::Hexdumper qw(hexdump);

my $qp_part = Email::MIME->create(
    attributes => {
        encoding => "quoted-printable",
        charset  => "US-ASCII",
    },
    body_str => 'Hello World!',
);

{
    say '-> CRLF, correct case';
    my $email = Email::MIME->new("Subject: CRLF\x0d\x0a");
    say hexdump( data => $email->{mycrlf}, suppress_warnings => 1 );
    $email->parts_add([$qp_part]);
    say hexdump( data => ($email->parts)[1]->body_raw, suppress_warnings => 1 );
    say( ($email->parts)[1]->body_str );
}

say "";

{
    say '-> LF, broken case';
    my $email = Email::MIME->new("Subject: LF\x0a");
    say hexdump( data => $email->{mycrlf}, suppress_warnings => 1 );
    $email->parts_add([$qp_part]);
    say hexdump( data => ($email->parts)[1]->body_raw, suppress_warnings => 1 );
    say( ($email->parts)[1]->body_str );
}
</pre>

<pre>
fvm bokutin % pwd
/home/bokutin/git/Email-MIME
fvm bokutin % perl qp_bug.pl
-> CRLF, correct case
  0x0000 : 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................

  0x0000 : 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 3D 0D 0A 00 : Hello.World!=...

Hello World!

-> LF, broken case
  0x0000 : 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................

  0x0000 : 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 3D 0D 00 00 : Hello.World!=...

Hello World!=
fvm bokutin % perl -I lib qp_bug.pl
-> CRLF, correct case
  0x0000 : 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................

  0x0000 : 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 3D 0D 0A 00 : Hello.World!=...

Hello World!

-> LF, broken case
  0x0000 : 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : ................

  0x0000 : 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 3D 0D 0A 00 : Hello.World!=...

Hello World!
</pre>