This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Further perlio doc tweaks.
[perl5.git] / lib / syslog.pl
index 29c3a1c..f0dbb1c 100644 (file)
 
 package syslog;
 
+use warnings::register;
+
 $host = 'localhost' unless $host;      # set $syslog'host to change
 
-if ($] >= 5) {
-    warn "You should 'use Sys::Syslog' instead; continuing" # if $^W
+if ($] >= 5 && warnings::enabled()) {
+    warnings::warn("You should 'use Sys::Syslog' instead; continuing");
 } 
 
 require 'syslog.ph';
 
- eval 'use Socket'                     ||
+ eval 'use Socket; 1'                  ||
      eval { require "socket.ph" }      ||
      require "sys/socket.ph";
 
@@ -140,10 +142,10 @@ sub main'syslog {
 
 sub xlate {
     local($name) = @_;
-    $name =~ y/a-z/A-Z/;
+    $name = uc $name;
     $name = "LOG_$name" unless $name =~ /^LOG_/;
     $name = "syslog'$name";
-    eval(&$name) || -1;
+    defined &$name ? &$name : -1;
 }
 
 sub connect {