diff options
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | ext/Sys/Syslog/Syslog.pm | 2 | ||||
-rwxr-xr-x | t/lib/syslog.t | 23 |
3 files changed, 25 insertions, 1 deletions
@@ -1298,6 +1298,7 @@ t/lib/socket.t See if Socket works t/lib/soundex.t See if Soundex works t/lib/symbol.t See if Symbol works t/lib/syslfs.t See if large files work for sysio +t/lib/syslog.t See if Sys::Syslog works t/lib/textfill.t See if Text::Wrap::fill works t/lib/texttabs.t See if Text::Tabs works t/lib/textwrap.t See if Text::Wrap::wrap works diff --git a/ext/Sys/Syslog/Syslog.pm b/ext/Sys/Syslog/Syslog.pm index 2a91354e87..d109a9d8a6 100644 --- a/ext/Sys/Syslog/Syslog.pm +++ b/ext/Sys/Syslog/Syslog.pm @@ -274,7 +274,7 @@ sub connect { socket(SYSLOG,AF_INET,SOCK_DGRAM,$udp) || croak "socket: $!"; connect(SYSLOG,$that) || croak "connect: $!"; } else { - my $syslog = &_PATH_LOG || croak "_PATH_LOG not found in syslog.ph"; + my $syslog = _PATH_LOG() || croak "_PATH_LOG not found in syslog.ph"; my $that = sockaddr_un($syslog) || croak "Can't locate $syslog"; socket(SYSLOG,AF_UNIX,SOCK_STREAM,0) || croak "socket: $!"; if (!connect(SYSLOG,$that)) { diff --git a/t/lib/syslog.t b/t/lib/syslog.t new file mode 100755 index 0000000000..2ed887ac54 --- /dev/null +++ b/t/lib/syslog.t @@ -0,0 +1,23 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + unshift @INC, '../lib'; + require Config; import Config; + if ($Config{'extensions'} !~ /\bSyslog\b/) { + print "1..0 # Skip: Sys::Syslog was not built\n"; + exit 0; + } +} + +use Sys::Syslog qw(:DEFAULT setlogsock); + +print "1..6\n"; + +print defined(eval { setlogsock('unix') }) ? "ok 1\n" : "not ok 1\n"; +print defined(eval { openlog('perl', 'ndelay', 'local0') }) ? "ok 2\n" : "not ok 2\n"; +print defined(eval { syslog('info', 'test') }) ? "ok 3\n" : "not ok 3\n"; + +print defined(eval { setlogsock('inet') }) ? "ok 4\n" : "not ok 4\n"; +print defined(eval { openlog('perl', 'ndelay', 'local0') }) ? "ok 5\n" : "not ok 5\n"; +print defined(eval { syslog('info', 'test') }) ? "ok 6\n" : "not ok 6\n"; |