You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by do...@apache.org on 2006/12/11 20:41:58 UTC

svn commit: r485839 - /spamassassin/branches/3.1/lib/Mail/SpamAssassin/Util.pm

Author: dos
Date: Mon Dec 11 11:41:58 2006
New Revision: 485839

URL: http://svn.apache.org/viewvc?view=rev&rev=485839
Log:
bug 5052: silence buggy crap from Text::Wrap

Modified:
    spamassassin/branches/3.1/lib/Mail/SpamAssassin/Util.pm

Modified: spamassassin/branches/3.1/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.1/lib/Mail/SpamAssassin/Util.pm?view=diff&rev=485839&r1=485838&r2=485839
==============================================================================
--- spamassassin/branches/3.1/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/branches/3.1/lib/Mail/SpamAssassin/Util.pm Mon Dec 11 11:41:58 2006
@@ -513,7 +513,16 @@
   # There's a die() in there which "shouldn't happen", but better be
   # paranoid.  We'll return the unwrapped string if anything went wrong.
   my $text = $_[0] || "";
+
+  # Text::Wrap produces spurious warnings:
+  # [23409] warn: (?:(?<=[\s,]))* matches null string many times in regex; marked by <-- HERE in m/\G(?:(?<=[\s,]))* <-- HERE \Z/ at /usr/local/perl594/lib/5.9.4/Text/Wrap.pm line 46.
+  # trap and ignore them.  Why do so many of the core modules do this
+  # kind of crap? :(  use a $SIG{__WARN__} to trap it.
+
   eval {
+    local $SIG{__WARN__} = sub {
+      ($_[0] =~ /matches null string many times/) or CORE::warn(@_);
+    };
     $text = Text::Wrap::wrap($_[2] || "", $_[1] || "", $text);
   };
   return $text;