This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow syslog() to use numeric constants in addition to strings for
authorJim Schneider <jschneid@netilla.com>
Fri, 5 Mar 2004 14:03:10 +0000 (09:03 -0500)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sat, 6 Mar 2004 21:09:10 +0000 (21:09 +0000)
facility names and priorities.

Subject: Patch for Sys::Syslog
Message-Id: <200403051403.10674.jschneid@netilla.com>

p4raw-id: //depot/perl@22451

ext/Sys/Syslog/Syslog.pm

index 13598e7..244157f 100644 (file)
@@ -7,7 +7,7 @@ use Carp;
 @ISA = qw(Exporter DynaLoader);
 @EXPORT = qw(openlog closelog setlogmask syslog);
 @EXPORT_OK = qw(setlogsock);
 @ISA = qw(Exporter DynaLoader);
 @EXPORT = qw(openlog closelog setlogmask syslog);
 @EXPORT_OK = qw(setlogsock);
-$VERSION = '0.04';
+$VERSION = '0.05';
 
 # it would be nice to try stream/unix first, since that will be
 # most efficient. However streams are dodgy - see _syslog_send_stream
 
 # it would be nice to try stream/unix first, since that will be
 # most efficient. However streams are dodgy - see _syslog_send_stream
@@ -394,6 +394,7 @@ sub _syslog_send_socket {
 
 sub xlate {
     local($name) = @_;
 
 sub xlate {
     local($name) = @_;
+    return $name+0 if $name =~ /^\s*\d+\s*$/;
     $name = uc $name;
     $name = "LOG_$name" unless $name =~ /^LOG_/;
     $name = "Sys::Syslog::$name";
     $name = uc $name;
     $name = "LOG_$name" unless $name =~ /^LOG_/;
     $name = "Sys::Syslog::$name";