Subject: | Remove last newline from $entity->head->get('Subject') |
When getting any header of a message with:
my $header_subject = $entity->head->get('Subject');
$header_subject has the last newline in it. That is not very practical
because you must always chomp it. It is even incongruent because if it
is a multiline field the middle newlines are correctly removed.
Subject: | MailHeader_unfold_lastnewline_remove_fix.diff |
--- Mail/Header.pm
+++ Mail/Header.pm
@@ -383,7 +383,7 @@
$list = $me->{'mail_hdr_hash'}{$tag};
foreach $ln (@$list)
{
- $$ln =~ s/\r?\n\s+/ /sog
+ $$ln =~ s/\r?\n\s*/ /sog
if defined $ln && defined $$ln;
}
}
@@ -393,7 +393,7 @@
{
foreach $ln (@$list)
{
- $$ln =~ s/\r?\n\s+/ /sog
+ $$ln =~ s/\r?\n\s*/ /sog
if defined $ln && defined $$ln;
}
}