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.
[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.
# 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 '
);
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;
require 5.005;
{ no strict 'vars';
- $VERSION = '0.25';
+ $VERSION = '0.26';
@ISA = qw(Exporter);
%EXPORT_TAGS = (
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;
@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;
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;
}
#
sub silent_eval (&) {
local($SIG{__DIE__}, $SIG{__WARN__}, $@);
- return eval $_[0]
+ return eval { $_[0]->() }
}
sub can_load {
=head1 VERSION
-Version 0.25
+Version 0.26
=head1 SYNOPSIS