You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2011/07/01 14:44:07 UTC
svn commit: r1141919 -
/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
Author: mmartinec
Date: Fri Jul 1 12:44:07 2011
New Revision: 1141919
URL: http://svn.apache.org/viewvc?rev=1141919&view=rev
Log:
avoid perl warnings if score happens to be undef, report it as 0; do not treat string as a boolean
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?rev=1141919&r1=1141918&r2=1141919&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Fri Jul 1 12:44:07 2011
@@ -426,8 +426,8 @@ sub _get_autolearn_points {
}
}
- # ignore tests with 0 score in this scoreset
- next if ($scores->{$test} == 0);
+ # ignore tests with 0 score (or undefined) in this scoreset
+ next if !$scores->{$test};
# Go ahead and add points to the proper locations
if (!$self->{conf}->maybe_header_only ($test)) {
@@ -1356,13 +1356,12 @@ sub _get_tag {
my $arg = (shift || ",");
my $line = '';
foreach my $test (sort @{$self->{test_names_hit}}) {
- if (!$line) {
- $line .= $test . "=" . $self->{conf}->{scores}->{$test};
- } else {
- $line .= $arg . $test . "=" . $self->{conf}->{scores}->{$test};
- }
+ my $score = $self->{conf}->{scores}->{$test};
+ $score = '0' if !defined $score;
+ $line .= $arg if $line ne '';
+ $line .= $test . "=" . $score;
}
- $line ? $line : 'none';
+ $line ne '' ? $line : 'none';
},
PREVIEW => sub { $self->get_content_preview() },