This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(Replaced by #7440.)
[perl5.git] / t / lib / syslog.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6     require Config; import Config;
7     if ($Config{'extensions'} !~ /\bSyslog\b/) {
8         print "1..0 # Skip: Sys::Syslog was not built\n";
9         exit 0;
10     }
11 }
12
13 use Sys::Syslog qw(:DEFAULT setlogsock);
14
15 print "1..6\n";
16
17 if (Sys::Syslog::_PATH_LOG() and -e Sys::Syslog::_PATH_LOG()) {
18     print defined(eval { setlogsock('unix') }) ? "ok 1\n" : "not ok 1\n";
19     print defined(eval { openlog('perl', 'ndelay', 'local0') }) ? "ok 2\n" : "not ok 2\n";
20     print defined(eval { syslog('info', 'test') }) ? "ok 3\n" : "not ok 3\n";
21 }
22 else {
23     for (1..3) { print "ok $_ # skipping, _PATH_LOG unavailable\n" }
24 }
25
26 print defined(eval { setlogsock('inet') }) ? "ok 4\n" : "not ok 4\n";
27 print defined(eval { openlog('perl', 'ndelay', 'local0') }) ? "ok 5\n" : "not ok 5\n";
28 print defined(eval { syslog('info', 'test') }) ? "ok 6\n" : "not ok 6\n";