This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Another small patch for Sys::Syslog
authorSébastien Aperghis-Tramoni <sebastien@aperghis.net>
Mon, 5 Nov 2007 08:48:53 +0000 (09:48 +0100)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 5 Nov 2007 10:19:31 +0000 (10:19 +0000)
Message-Id: <A5B536D9-E81C-48FC-9584-45E59ED7B6FB@free.fr>

p4raw-id: //depot/perl@32222

ext/Sys/Syslog/Changes
ext/Sys/Syslog/Syslog.pm

index 2ad5956..061bf9b 100644 (file)
@@ -1,6 +1,8 @@
 Revision history for Sys-Syslog
 
 0.22 -- 2007.11.xx -- Sebastien Aperghis-Tramoni (SAPER)
+        [BUGFIX] CPAN-RT#29875: Added workaround SpamAssassin overzealous
+        logging features.
         [FEATURE] Added support for PERROR option.
         [FEATURE] Support for SYSLOG on z/OS, thanks to Chun Bing Ge.
         [CODE] Prevent $@ from being visible outside the module, in trying 
index 2a86283..3aa26a3 100644 (file)
@@ -105,16 +105,21 @@ if ($^O =~ /^(freebsd|linux)$/) {
     @connectMethods = grep { $_ ne 'udp' } @connectMethods;
 }
 
-# use EventLog on Win32
-my $is_Win32 = $^O =~ /Win32/i;
+EVENTLOG: {
+    # use EventLog on Win32
+    my $is_Win32 = $^O =~ /Win32/i;
 
-if (eval "use Sys::Syslog::Win32; 1") {
-    unshift @connectMethods, 'eventlog';
-} elsif ($is_Win32) {
-    warn $@;
-}
+    # some applications are trying to be too smart
+    # yes I'm speaking of YOU, SpamAssassin, grr..
+    local($SIG{__DIE__}, $SIG{__WARN__}, $@);
 
-$@ = "";
+    if (eval "use Sys::Syslog::Win32; 1") {
+        unshift @connectMethods, 'eventlog';
+    }
+    elsif ($is_Win32) {
+        warn $@;
+    }
+}
 
 my @defaultMethods = @connectMethods;
 my @fallbackMethods = ();