Subject: | context flattened in Mail::Audit::get() |
Mail::Internet::get() is context-sensitive (returning multiple instances of the specified header when called in list context), but Mail::Audit::get() squashes any list context down to scalar context before passing the request to Mail::Internet. The attached patch replaces Mail::Audit::get and fixes the problem in my testing.
This glitch hurt the received() method, and broke the MAPS plugin, among possible other ill effects.
I sent the patch to Simon last week, based on the request for bugs and comments in his oft-republished TPJ article; took me a while to notice the updated direction to use rt.cpan.org in the current source.
791,802c791
< sub get { if (wantarray()) {
< my @strings = $_[0]->head->get($_[1]);
< foreach my $string (@strings) {
< chomp($string=(defined $string && length $string) ? $string : "");
< }
< @strings;
< } else {
< my $string = $_[0]->head->get($_[1]);
< chomp($string=(defined $string && length $string) ? $string : "");
< $string;
< }
< }
---
> sub get { my $string = $_[0]->head->get($_[1]); chomp($string=(defined $string && length $string) ? $string : ""); $string; }