X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fsyslog.pl;h=f0dbb1c96a2078a8d4401eb084b6c9cf723ffb2d;hb=f4b6e4b3030d41298059a7177b55b86f24360e10;hp=29c3a1cc9afa326ce5f3fadced32d0ccbf915005;hpb=4a6b6a6c94b931c21d2ab5c7599e2a15ac99171f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/syslog.pl b/lib/syslog.pl index 29c3a1c..f0dbb1c 100644 --- a/lib/syslog.pl +++ b/lib/syslog.pl @@ -29,15 +29,17 @@ 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 {