This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix Sys::Syslog breakage on domain sockets (from Tom Hughes)
authorGurusamy Sarathy <gsar@cpan.org>
Thu, 27 Apr 2000 17:50:56 +0000 (17:50 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Thu, 27 Apr 2000 17:50:56 +0000 (17:50 +0000)
p4raw-id: //depot/perl@5969

MANIFEST
ext/Sys/Syslog/Syslog.pm
t/lib/syslog.t [new file with mode: 0755]

index c347581..70932d8 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -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
index 2a91354..d109a9d 100644 (file)
@@ -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 (executable)
index 0000000..2ed887a
--- /dev/null
@@ -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";