summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSébastien Aperghis-Tramoni <sebastien@aperghis.net>2008-06-16 03:57:33 +0200
committerCraig A. Berry <craigberry@mac.com>2008-06-16 03:16:40 +0000
commit2605937c604c47b61b8be58089fd235d341e6f50 (patch)
tree407f29733540357f67ed8e72a0c5135a81c31d19 /ext
parent803e1be1305f7c1b058f40840ab0d19e2d92a3d3 (diff)
downloadperl-2605937c604c47b61b8be58089fd235d341e6f50.tar.gz
Fwd: CPAN Upload: S/SA/SAPER/Sys-Syslog-0.26.tar.gz
Message-Id: <A9FDE5F5-5285-454C-AE15-3EBF6AEBDFC8@free.fr> p4raw-id: //depot/perl@34058
Diffstat (limited to 'ext')
-rw-r--r--ext/Sys/Syslog/Changes6
-rw-r--r--ext/Sys/Syslog/Makefile.PL3
-rw-r--r--ext/Sys/Syslog/Syslog.pm32
3 files changed, 34 insertions, 7 deletions
diff --git a/ext/Sys/Syslog/Changes b/ext/Sys/Syslog/Changes
index 3696fa4692..e8bc66e9cb 100644
--- a/ext/Sys/Syslog/Changes
+++ b/ext/Sys/Syslog/Changes
@@ -1,5 +1,10 @@
Revision history for Sys-Syslog
+0.26 -- 2008.06.16 -- Sebastien Aperghis-Tramoni (SAPER)
+ [BUGFIX] Make Sys::Syslog works with Perl 5.10.0 (because of
+ ExtUtils::Constant::ProxySubs).
+ [CODE] setlogsock() is now a little more strict about its arguments.
+
0.25 -- 2008.05.17 -- Sebastien Aperghis-Tramoni (SAPER)
[BUGFIX] CPAN-RT#34691: Fixed an incorrect call to sysopen() which
prevented Sys::Syslog from working on some Solaris systems.
@@ -7,6 +12,7 @@ Revision history for Sys-Syslog
[BUGFIX] CPAN-RT#34753: Fixed a slowness introduced in v0.19 (which
was to work around OSX syslog own slowness). Thanks to Alex Efros.
[BUGFIX] CPAN-RT#35952: Fixed a bug with the "nofatal" option.
+ [BUGFIX] CPAN-RT#35189: Fixed a bug in xlate().
[BUGFIX] Fixed build on Win32, thanks to Adam Kennedy.
[FEATURE] setlogsock() now interprets the second argument as the
hostname for network mechanisms.
diff --git a/ext/Sys/Syslog/Makefile.PL b/ext/Sys/Syslog/Makefile.PL
index 508dfe78ff..880282d949 100644
--- a/ext/Sys/Syslog/Makefile.PL
+++ b/ext/Sys/Syslog/Makefile.PL
@@ -99,6 +99,7 @@ WriteMakefile(
# build/test prereqs
'Test::More' => 0,
},
+ PL_FILES => {},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Sys-Syslog-*' },
realclean => { FILES => 'lib const-c.inc const-xs.inc macros.all '
@@ -178,9 +179,9 @@ if(eval {require ExtUtils::Constant; 1}) {
);
ExtUtils::Constant::WriteConstants(
- ($] > 5.009002 ? (PROXYSUBS => 1) : ()),
NAME => 'Sys::Syslog',
NAMES => [ @levels, @facilities, @options, @others_macros ],
+ ($] > 5.009002 ? (PROXYSUBS => 1) : ()),
);
my @names = map { ref $_ ? $_->{name} : $_ } @levels, @facilities, @options;
diff --git a/ext/Sys/Syslog/Syslog.pm b/ext/Sys/Syslog/Syslog.pm
index 898e36bbb9..771ae69bcd 100644
--- a/ext/Sys/Syslog/Syslog.pm
+++ b/ext/Sys/Syslog/Syslog.pm
@@ -11,7 +11,7 @@ use Socket ':all';
require 5.005;
{ no strict 'vars';
- $VERSION = '0.25';
+ $VERSION = '0.26';
@ISA = qw(Exporter);
%EXPORT_TAGS = (
@@ -190,6 +190,13 @@ sub setlogmask {
sub setlogsock {
my ($setsock, $setpath, $settime) = @_;
+ # check arguments
+ my $diag_invalid_arg
+ = "Invalid argument passed to setlogsock; must be 'stream', 'pipe', "
+ . "'unix', 'native', 'eventlog', 'tcp', 'udp' or 'inet'";
+ croak $diag_invalid_arg unless defined $setsock;
+ croak "Invalid number of arguments" unless @_ >= 1 and @_ <= 3;
+
$syslog_path = $setpath if defined $setpath;
$sock_timeout = $settime if defined $settime;
@@ -289,8 +296,7 @@ sub setlogsock {
@connectMethods = qw(console);
} else {
- croak "Invalid argument passed to setlogsock; must be 'stream', 'pipe', ",
- "'unix', 'native', 'eventlog', 'tcp', 'udp' or 'inet'"
+ croak $diag_invalid_arg
}
return 1;
@@ -494,8 +500,22 @@ sub xlate {
return $name+0 if $name =~ /^\s*\d+\s*$/;
$name = uc $name;
$name = "LOG_$name" unless $name =~ /^LOG_/;
+
+ # ExtUtils::Constant 0.20 introduced a new way to implement
+ # constants, called ProxySubs. When it was used to generate
+ # the C code, the constant() function no longer returns the
+ # correct value. Therefore, we first try a direct call to
+ # constant(), and if the value is an error we try to call the
+ # constant by its full name.
my $value = constant($name);
- $value = -1 if $value =~ /not a valid/;
+
+ if (index($value, "not a valid") >= 0) {
+ $name = "Sys::Syslog::$name";
+ $value = eval { no strict "refs"; &$name };
+ $value = $@ unless defined $value;
+ }
+
+ $value = -1 if index($value, "not a valid") >= 0;
return defined $value ? $value : -1;
}
@@ -790,7 +810,7 @@ sub disconnect_log {
#
sub silent_eval (&) {
local($SIG{__DIE__}, $SIG{__WARN__}, $@);
- return eval $_[0]
+ return eval { $_[0]->() }
}
sub can_load {
@@ -809,7 +829,7 @@ Sys::Syslog - Perl interface to the UNIX syslog(3) calls
=head1 VERSION
-Version 0.25
+Version 0.26
=head1 SYNOPSIS