From 3d4c268afd481cc8e6d07f5f68f25636ec393969 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Sun, 21 Nov 2010 19:52:46 -0500 Subject: [PATCH] Corrected COUNT_ONLY behavior. --- remove-spam-high-confidence-maildir.plx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/remove-spam-high-confidence-maildir.plx b/remove-spam-high-confidence-maildir.plx index fdb20a8..d3e61e8 100644 --- a/remove-spam-high-confidence-maildir.plx +++ b/remove-spam-high-confidence-maildir.plx @@ -71,7 +71,7 @@ MAIL: foreach my $dir (@msgDirs) { if ($dspamVal{Confidence} >= $DSPAM_CONF_MIN and $dspamVal{Probability} >= $DSPAM_PROB_MIN) { $countDeleted++; - if (defined $COUNT_ONLY and $COUNT_ONLY) { + unless (defined $COUNT_ONLY and $COUNT_ONLY) { warn "unable to unlink $fullFileName: $!" unless unlink("$fullFileName") == 1; } @@ -83,10 +83,10 @@ MAIL: foreach my $dir (@msgDirs) { my $percent = ($countDeleted / $total) * 100.00; -print sprintf("%2f", $percent), " ($countDeleted/$total) ", - (defined $COUNT_ONLY and $COUNT_ONLY ? " would be deleted.\n" : - sprintf("were deleted.\nThis leaves %d in the folder.\n", - $total - $countDeleted)); +print sprintf("%.2f", $percent), "% ($countDeleted/$total) ", + (defined $COUNT_ONLY and $COUNT_ONLY ? + sprintf("were deleted.\nThis leaves %d in the folder.\n", + $total - $countDeleted) : " would be deleted.\n"); ############################################################################### # # Local variables: