summaryrefslogtreecommitdiff
path: root/ext/Sys
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-06-20 22:01:16 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-06-20 22:01:16 +0000
commit8edeb3adf78562499e1eeea00d9ecf5f58e8de2d (patch)
tree747dbcc89e36f9bdca8fd1a386b56e323f916cff /ext/Sys
parent9badc3612459020624c762b543ab7dd82718f170 (diff)
downloadperl-8edeb3adf78562499e1eeea00d9ecf5f58e8de2d.tar.gz
Upgrade to Sys::Syslog 0.16
p4raw-id: //depot/perl@28410
Diffstat (limited to 'ext/Sys')
-rw-r--r--ext/Sys/Syslog/Changes23
-rw-r--r--ext/Sys/Syslog/Syslog.pm28
-rwxr-xr-xext/Sys/Syslog/t/syslog.t1
3 files changed, 33 insertions, 19 deletions
diff --git a/ext/Sys/Syslog/Changes b/ext/Sys/Syslog/Changes
index ce33e1901d..abc07dfb63 100644
--- a/ext/Sys/Syslog/Changes
+++ b/ext/Sys/Syslog/Changes
@@ -1,7 +1,18 @@
Revision history for Sys-Syslog
+0.16 -- 2006.06.20 -- Sebastien Aperghis-Tramoni (SAPER)
+ [BUGFIX] Perl-RT#20557: Save errno before trying to connect.
+ [FEATURE] Perl-RT#35406: Applied the patch proposed by Keisuke Hirata
+ for a more lax handling of "stream" or "unix" path.
+ [FEATURE] Now try the "native" mechanism first.
+ [TESTS] Silence warnings generated by t/syslog.t in Perl 5.8.8 and
+ later.
+ [DOC] Added documentation about the "native" mechanism.
+ [DOC] Now indicates whether tickets are from CPAN or Perl RT.
+
+
0.15 -- 2006.06.10 -- Sebastien Aperghis-Tramoni (SAPER)
- [FEATURE] RT#17316: Added a "nofatal" option to openlog().
+ [FEATURE] CPAN-RT#17316: Added a "nofatal" option to openlog().
[FEATURE] Sys::Syslog warnings can now be controled by the warnings
category of the same name.
[FEATURE] Added support for using the native C syslog(3) functions.
@@ -10,13 +21,13 @@ Revision history for Sys-Syslog
parentheses.
0.14 -- 2006.05.25 -- Sebastien Aperghis-Tramoni (SAPER)
- [BUGFIX] RT#19259, RT#17518: Now allowing all levels and facilities.
+ [BUGFIX] CPAN-RT#19259, #17518: Now allowing all levels and facilities.
[CODE] Removed useless "&".
[CODE] Improved readability by adding empty lines and reworking the
code here and there.
[CODE] Added new macros from Mac OS X.
[TESTS] Added more tests in order to increase coverage.
- [DOC] RT#19085: Corrected errors in the documentation for setlogmask().
+ [DOC] CPAN-RT#19085: Corrected errors in the documentation for setlogmask().
[DOC] Added several links to online manual pages, RFCs and articles.
[DOC] Corrected minor things in Changes.
@@ -29,9 +40,9 @@ Revision history for Sys-Syslog
use INADDR_LOOPBACK.
[CODE] Merged blead@26772: $host needs to stay in case the user sets it.
[CODE] Merged blead@26773: check that $syslog_path is a socket.
- [TESTS] RT#16980 (Alan Burlison): Sys::Syslog blows up rather
+ [TESTS] CPAN-RT#16980 (Alan Burlison): Sys::Syslog blows up rather
spectacularly on Solaris. Corrected by previous patches.
- [TESTS] RT#16974: Failed test in t/podspell. This test is now skipped.
+ [TESTS] CPAN-RT#16974: Failed test in t/podspell. This test is now skipped.
0.12 -- 2006.01.07 -- Sebastien Aperghis-Tramoni (SAPER)
[DOC] Added a link to an article about Sys::Syslog.
@@ -48,7 +59,7 @@ Revision history for Sys-Syslog
[FEATURE] Support for three Exporter tags.
[FEATURE] XSLoader is now optional.
[CODE] No longer "use"s Sys::Hostname as it was "require"d where needed.
- [CODE] RT#16604: Use local timestamp.
+ [CODE] CPAN-RT#16604: Use local timestamp.
[DIST] Merged blead@26343: Fix realclean target.
[DOC] Improved documentation.
[TESTS] Added more tests to t/syslog.t in order to increase code coverage.
diff --git a/ext/Sys/Syslog/Syslog.pm b/ext/Sys/Syslog/Syslog.pm
index fe75005b5d..a5bad2e4cb 100644
--- a/ext/Sys/Syslog/Syslog.pm
+++ b/ext/Sys/Syslog/Syslog.pm
@@ -8,7 +8,7 @@ require 5.006;
require Exporter;
{ no strict 'vars';
- $VERSION = '0.15';
+ $VERSION = '0.16';
@ISA = qw(Exporter);
%EXPORT_TAGS = (
@@ -73,7 +73,7 @@ my %options = (
# it would be nice to try stream/unix first, since that will be
# most efficient. However streams are dodgy - see _syslog_send_stream
-my @connectMethods = ( 'tcp', 'udp', 'unix', 'stream', 'console' );
+my @connectMethods = qw(native tcp udp unix stream console);
if ($^O =~ /^(freebsd|linux)$/) {
@connectMethods = grep { $_ ne 'udp' } @connectMethods;
}
@@ -156,8 +156,8 @@ sub setlogsock {
}
} elsif (lc $setsock eq 'unix') {
- if (length _PATH_LOG() && !defined $syslog_path) {
- $syslog_path = _PATH_LOG();
+ if (length _PATH_LOG() || (defined $syslog_path && -w $syslog_path)) {
+ $syslog_path = _PATH_LOG() unless defined $syslog_path;
@connectMethods = ( 'unix' );
} else {
warnings::warnif 'unix passed to setlogsock, but path not available';
@@ -203,18 +203,19 @@ sub syslog {
my (@words, $num, $numpri, $numfac, $sum);
my $failed = undef;
my $fail_time = undef;
+ my $error = $!;
my $facility = $facility; # may need to change temporarily.
croak "syslog: expecting argument \$priority" unless defined $priority;
croak "syslog: expecting argument \$format" unless defined $mask;
- @words = split(/\W+/, $priority, 2);# Allow "level" or "level|facility".
+ @words = split(/\W+/, $priority, 2); # Allow "level" or "level|facility".
undef $numpri;
undef $numfac;
foreach (@words) {
- $num = xlate($_); # Translate word to number.
+ $num = xlate($_); # Translate word to number.
if ($num < 0) {
croak "syslog: invalid level/facility: $_"
}
@@ -240,11 +241,10 @@ sub syslog {
connect_log() unless $connected;
if ($mask =~ /%m/) {
- my $err = $!;
# escape percent signs if sprintf will be called
- $err =~ s/%/%%/g if @_;
+ $error =~ s/%/%%/g if @_;
# replace %m with $err, if preceded by an even number of percent signs
- $mask =~ s/(?<!%)((?:%%)*)%m/$1$err/g;
+ $mask =~ s/(?<!%)((?:%%)*)%m/$1$error/g;
}
$mask .= "\n" unless $mask =~ /\n$/;
@@ -503,7 +503,7 @@ sub connect_stream {
my ($errs) = @_;
# might want syslog_path to be variable based on syslog.h (if only
# it were in there!)
- $syslog_path = '/dev/conslog';
+ $syslog_path = '/dev/conslog' unless defined $syslog_path;
if (!-w $syslog_path) {
push @$errs, "stream $syslog_path is not writable";
return 0;
@@ -518,7 +518,7 @@ sub connect_stream {
sub connect_unix {
my ($errs) = @_;
- if (length _PATH_LOG()) {
+ if (not defined $syslog_path and length _PATH_LOG()) {
$syslog_path = _PATH_LOG();
} else {
push @$errs, "_PATH_LOG not available in syslog.h";
@@ -619,7 +619,7 @@ Sys::Syslog - Perl interface to the UNIX syslog(3) calls
=head1 VERSION
-Version 0.15
+Version 0.16
=head1 SYNOPSIS
@@ -810,9 +810,11 @@ C<undef> on failure.
A value of C<"unix"> will connect to the UNIX domain socket (in some
systems a character special device) returned by the C<_PATH_LOG> macro
(if your system defines it), or F</dev/log> or F</dev/conslog>,
-whatever is writable. A value of 'stream' will connect to the stream
+whatever is writable. A value of C<"stream"> will connect to the stream
indicated by the pathname provided as the optional second parameter.
(For example Solaris and IRIX require C<"stream"> instead of C<"unix">.)
+A value of C<"native"> will use the native C functions from your C<syslog(3)>
+library.
A value of C<"inet"> will connect to an INET socket (either C<tcp> or C<udp>,
tried in that order) returned by C<getservbyname()>. C<"tcp"> and C<"udp">
can also be given as values. The value C<"console"> will send messages
diff --git a/ext/Sys/Syslog/t/syslog.t b/ext/Sys/Syslog/t/syslog.t
index 030a0ebc66..76353e9bdc 100755
--- a/ext/Sys/Syslog/t/syslog.t
+++ b/ext/Sys/Syslog/t/syslog.t
@@ -14,6 +14,7 @@ use Test::More;
# we enable all Perl warnings, but we don't "use warnings 'all'" because
# we want to disable the warnings generated by Sys::Syslog
+no warnings;
use warnings qw(closure deprecated exiting glob io misc numeric once overflow
pack portable recursion redefine regexp severe signal substr
syntax taint uninitialized unpack untie utf8 void);