Subject: | Ambiguous Mail::Audit::Killdups::killdups |
(Operating environment: Mail-Audit-2.1 with stock Perl 5.8.0 on RHL8.)
I experienced a strong behavior when the message-id ring file is not readable and with the following code :
use Mail::Audit qw(KillDups);
$Mail::Audit::KillDups::dupfile = "/some/unreadable/file";
my $mail = Mail::Audit->new(noexit => 1);
if($mail->killdups) {
# do some other logging
exit 1;
}
Looking into Mail/Audit/Killdups.pm, I see that it should return 0 when the message IS NOT a duplicate, 1 when an error occured and it should call Mail::Audit->ignore is the mail is a duplicate. That's looks fine, but...
1) I didn't know it should returns 1 on error,
2) If noexit is set, Mail::Audit->ignore will return, and what happens when it does: killdups() returns 1, as an error:
[from Mail/Audit/KillDups.pm:]
if ($_ eq $mid) {
_log(1, "Duplicate, ignoring");
$self->ignore;
return 1; # Just in case.
}
So I beg for letting killdups() return 1 ONLY on duplicate and either die or returns 0 on error...