Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mail-Audit CPAN distribution.

Report information
The Basics
Id: 371
Status: resolved
Priority: 0/
Queue: Mail-Audit

People
Owner: Nobody in particular
Requestors: chris [...] sixlegs.com
ndi-cpan [...] bumppo.net
Cc:
AdminCc:

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



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; }
From: bowen [...] dwelle.org
I ran across this too, and I think the fix is even simpler: < # don't mess with it, just pass it on < # from MIME:Head (ISA Mail::Header) < sub get { $_[0]->head->get($_[1]); } --- Show quoted text
> sub get { my $string = $_[0]->head->get($_[1]); chomp
($string=(defined $string && length $string) ? $string : ""); $string; } This applies the same methodolgy as the other pass-along methods (replace, delete, etc). [guest - Mon Mar 18 16:30:07 2002]: Show quoted text
> 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.
Date: Wed, 8 May 2002 03:32:38 -0700
From: Chris Nokleberg <chris [...] sixlegs.com>
To: simon [...] simon-cozens.org
Subject: Mail::Audit bug?
Hi Simon, Hope it's ok to mail you directly, please forward my mail to the appropriate list, etc., otherwise. I'm using Mail::Audit 2.1 along with Mail::SpamAssassin 2.20. In Mail/Audit.pm there is the following method. sub get { my $string = $_[0]->head->get($_[1]); chomp($string=(defined $string && length $string) ? $string : ""); $string; } The problem is that Spam::Assassin::PerMsgStatus calls this method in list context, which Audit.pm get() does not expect. The end result is that all headers appear to be defined, and so some rules like REPLY_TO_EMPTY get triggered when they shouldn't. I was able to fix the problem by adding the following statement to the beginning of the method: return $_[0]->head->get($_[1]) if wantarray; Actually, the whole chomping business seems a little suspect to me. You'd know better than anyone but it seems like the chomp should go in the calling library that expects it (if there is one), and ->get should just become a proxy for ->head->get. Or is it Mail::SpamAssassin that should change? Thanks, Chris