From 848ca32ce8363c6d7b6f9aecaccb2cdac9abb8e1 Mon Sep 17 00:00:00 2001 From: Chris 'BinGOs' Williams Date: Sun, 26 May 2013 14:52:24 +0100 Subject: [PATCH] Update Sys-Syslog to CPAN version 0.33 [DELTA] 0.33 -- 2013.05.24 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#82531: Invalid usage of POSIX::_exit (Alexander Berger). [OPTIM] No longer inherit from Exporter. [OPTIM] Load Fcntl only when necessary. [DOC] Add links to other logging modules. [DOC] CPAN-RT#80398: Typo spotted by alfirth@gmail.com [DOC] Typo spotted by David Steinbrunner. [TEST] CPAN-RT#79683: Added delays in t/facilities-routing.t --- Porting/Maintainers.pl | 2 +- cpan/Sys-Syslog/Changes | 9 +++++++++ cpan/Sys-Syslog/Syslog.pm | 32 ++++++++++++++++++++++---------- cpan/Sys-Syslog/t/facilities-routing.t | 5 ++++- cpan/Sys-Syslog/win32/compile.pl | 8 ++++++++ 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 367a327..0ad284c 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1597,7 +1597,7 @@ use File::Glob qw(:case); 'Sys::Syslog' => { 'MAINTAINER' => 'saper', - 'DISTRIBUTION' => 'SAPER/Sys-Syslog-0.32.tar.gz', + 'DISTRIBUTION' => 'SAPER/Sys-Syslog-0.33.tar.gz', 'FILES' => q[cpan/Sys-Syslog], 'EXCLUDED' => [ qr{^eg/}, diff --git a/cpan/Sys-Syslog/Changes b/cpan/Sys-Syslog/Changes index a30b490..c928430 100644 --- a/cpan/Sys-Syslog/Changes +++ b/cpan/Sys-Syslog/Changes @@ -1,5 +1,14 @@ Revision history for Sys-Syslog +0.33 -- 2013.05.24 -- Sebastien Aperghis-Tramoni (SAPER) + [BUGFIX] CPAN-RT#82531: Invalid usage of POSIX::_exit (Alexander Berger). + [OPTIM] No longer inherit from Exporter. + [OPTIM] Load Fcntl only when necessary. + [DOC] Add links to other logging modules. + [DOC] CPAN-RT#80398: Typo spotted by alfirth@gmail.com + [DOC] Typo spotted by David Steinbrunner. + [TEST] CPAN-RT#79683: Added delays in t/facilities-routing.t + 0.32 -- 2012.09.14 -- Sebastien Aperghis-Tramoni (SAPER) [BUGFIX] CPAN-RT#69040: Don't modify @_ in syslog(). [BUGFIX] Restore compatibility with Perl 5.6.0. diff --git a/cpan/Sys-Syslog/Syslog.pm b/cpan/Sys-Syslog/Syslog.pm index deae4f3..25164af 100644 --- a/cpan/Sys-Syslog/Syslog.pm +++ b/cpan/Sys-Syslog/Syslog.pm @@ -3,8 +3,7 @@ use strict; use warnings; use warnings::register; use Carp; -use Exporter (); -use Fcntl qw< O_WRONLY >; +use Exporter qw< import >; use File::Basename; use POSIX qw< strftime setlocale LC_TIME >; use Socket qw< :all >; @@ -12,8 +11,7 @@ require 5.005; { no strict 'vars'; - $VERSION = '0.32'; - @ISA = qw< Exporter >; + $VERSION = '0.33'; %EXPORT_TAGS = ( standard => [qw(openlog syslog closelog setlogmask)], @@ -519,11 +517,11 @@ sub _syslog_send_console { } else { if (open(CONS, ">/dev/console")) { my $ret = print CONS $buf . "\r"; # XXX: should this be \x0A ? - POSIX::_exit $ret if defined $pid; + POSIX::_exit($ret) if defined $pid; close CONS; } - POSIX::_exit if defined $pid; + POSIX::_exit(0) if defined $pid; } } @@ -723,15 +721,21 @@ sub connect_stream { # might want syslog_path to be variable based on syslog.h (if only # it were in there!) $syslog_path = '/dev/conslog' unless defined $syslog_path; + if (!-w $syslog_path) { push @$errs, "stream $syslog_path is not writable"; return 0; } - if (!sysopen(SYSLOG, $syslog_path, O_WRONLY, 0400)) { + + require Fcntl; + + if (!sysopen(SYSLOG, $syslog_path, Fcntl::O_WRONLY(), 0400)) { push @$errs, "stream can't open $syslog_path: $!"; return 0; } + $syslog_send = \&_syslog_send_stream; + return 1; } @@ -900,7 +904,7 @@ Sys::Syslog - Perl interface to the UNIX syslog(3) calls =head1 VERSION -This is the documentation of version 0.32 +This is the documentation of version 0.33 =head1 SYNOPSIS @@ -1009,7 +1013,7 @@ process, so this option has no effect on Linux.) =item * C - Write the message to standard error output as well to the -system log (added in C 0.22). +system log (added in C 0.22). =item * @@ -1253,7 +1257,7 @@ Now that the "native" mechanism is supported by C and selected by default, the use of the C function is discouraged because other mechanisms are less portable across operating systems. Authors of modules and programs that use this function, especially its cargo-cult form -C, are advised to remove any occurence of it unless they +C, are advised to remove any occurrence of it unless they specifically want to use a given mechanism (like TCP or UDP to connect to a remote host). @@ -1557,6 +1561,14 @@ Perl and C versions. =head1 SEE ALSO +=head2 Other modules + +L - Perl implementation of the Log4j API + +L - Dispatches messages to one or more outputs + +L - Report a problem, with exceptions and language support + =head2 Manual Pages L diff --git a/cpan/Sys-Syslog/t/facilities-routing.t b/cpan/Sys-Syslog/t/facilities-routing.t index ce0a5b1..54be99f 100644 --- a/cpan/Sys-Syslog/t/facilities-routing.t +++ b/cpan/Sys-Syslog/t/facilities-routing.t @@ -60,12 +60,13 @@ if ($child_pid) { POE::Kernel->run; # check if some messages are missing - my @miss = grep { $received{$_} < 2 } keys %received; + my @miss = sort grep { $received{$_} < 2 } keys %received; diag "@miss" if @miss; } else { # child: send messages to the syslog server sleep 2; + my $delay = .01; setlogsock({ host => $host, type => $proto, port => $port }); # first way, set the facility each time with openlog() @@ -75,6 +76,7 @@ else { for my $level (@levels) { eval { syslog($level => "<$facility\:$level>") } or warn "error: syslog($level => '<$facility\:$level>'): $@"; + select undef, undef, undef, $delay; } } @@ -86,6 +88,7 @@ else { for my $level (@levels) { eval { syslog("$facility.$level" => "<$facility\:$level>") } or warn "error: syslog('$facility.$level' => '<$facility\:$level>'): $@"; + select undef, undef, undef, $delay; } } diff --git a/cpan/Sys-Syslog/win32/compile.pl b/cpan/Sys-Syslog/win32/compile.pl index 3c38691..3a8cf4f 100644 --- a/cpan/Sys-Syslog/win32/compile.pl +++ b/cpan/Sys-Syslog/win32/compile.pl @@ -259,6 +259,14 @@ event log. It is not expected to be directly used by any module other than C therefore it's API may change at any time and no warranty is made with regards to backward compatibility. You Have Been Warned. +In order to execute this script and compile the Win32 support files, you +need some helper programs: mc.exe, rc.exe and link.exe + +mc.exe and rc.exe can be downloaded from +http://www.microsoft.com/en-us/download/details.aspx?id=11310 + +link.exe is usually shipped with Visual Studio. + =head1 SEE ALSO L -- 2.7.4