X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fsyslog.pl;h=f0dbb1c96a2078a8d4401eb084b6c9cf723ffb2d;hb=9badc3612459020624c762b543ab7dd82718f170;hp=2034e0aa4862dc512623856ec786cbc4bb10adae;hpb=cb1a09d0194fed9b905df7b04a4bc031d354609d;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/syslog.pl b/lib/syslog.pl index 2034e0a..f0dbb1c 100644 --- a/lib/syslog.pl +++ b/lib/syslog.pl @@ -29,17 +29,19 @@ package syslog; +use warnings::register; + $host = 'localhost' unless $host; # set $syslog'host to change -if ($] >= 5) { - warn "You should 'use Sys::Socket' instead; continuing" # if $^W +if ($] >= 5 && warnings::enabled()) { + warnings::warn("You should 'use Sys::Syslog' instead; continuing"); } require 'syslog.ph'; - eval 'require Socket' || -eval { require "socket.ph" } || - require "sys/socket.ph"; + eval 'use Socket; 1' || + eval { require "socket.ph" } || + require "sys/socket.ph"; $maskpri = &LOG_UPTO(&LOG_DEBUG); @@ -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 {