Subject: | Add helper method "get_decoded" for headers. |
Hi, love the module for its ability to parse messages without pulling everything into RAM. Great design.
However, I have to complain about the MIME::Head decode/unfold situation.
It appears the old practice was to ->decode and then ->unfold. Then you deprecated ->decode. But, now it requires multiple lines of code to extract each attribute value, which is highly annoying.
Could you please add a "get_decoded" method which both decodes the value into UTF-8 and un-folds it, and does this right as the value is being read without affecting the internal representation?
After reading your source code a bit, I came up with this utility method (but maybe you know a more correct way to write it according to RFCs or whatnot)
sub MIME::Head::get_decoded {
my $value= shift->get(@_);
$value= decode_mimewords($value);
# Copied from Mail::Header, since there's no standalone utility function that I can find for this!
$value =~ s/\r?\n\s+/ /sog;
$value;
}