=item *
If you want to use multiple patterns, e.g. C<bsd_glob "a* b*">, you should
-probably throw them in a set as in C<glob "{a*,b*}">. This is because
-the argument to glob isn't subjected to parsing by the C shell. Remember
-that you can use a backslash to escape things.
+probably throw them in a set as in C<bsd_glob "{a*,b*}">. This is because
+the argument to bsd_glob() isn't subjected to parsing by the C shell.
+Remember that you can use a backslash to escape things.
=item *
C<openlog()> or C<syslog()> and returns TRUE on success,
undef on failure.
-A value of 'unix' will connect to the UNIX domain socket returned by
-C<_PATH_LOG> in F<syslog.ph>. A value of 'inet' will connect to an
-INET socket returned by getservbyname(). Any other value croaks.
+A value of 'unix' will connect to the UNIX domain socket returned by the
+C<_PATH_LOG> macro (if you system defines it) in F<syslog.h>. A value of
+'inet' will connect to an INET socket returned by getservbyname(). If
+C<_PATH_LOG> is unavailable or if getservbyname() fails, returns undef. Any
+other value croaks.
The default is for the INET socket to be used.
=head1 AUTHOR
-Tom Christiansen E<lt>F<tchrist@perl.com>E<gt> and Larry Wall E<lt>F<larry@wall.org>E<gt>.
-UNIX domain sockets added by Sean Robinson E<lt>F<robinson_s@sc.maricopa.edu>E<gt>
-with support from Tim Bunce <Tim.Bunce@ig.co.uk> and the perl5-porters mailing list.
-Dependency on F<syslog.ph> replaced with XS code bu Tom Hughes E<lt>F<tom@compton.nu>E<gt>.
+Tom Christiansen E<lt>F<tchrist@perl.com>E<gt> and Larry Wall
+E<lt>F<larry@wall.org>E<gt>.
+
+UNIX domain sockets added by Sean Robinson
+E<lt>F<robinson_s@sc.maricopa.edu>E<gt> with support from Tim Bunce
+E<lt>F<Tim.Bunce@ig.co.uk>E<gt> and the perl5-porters mailing list.
+
+Dependency on F<syslog.ph> replaced with XS code by Tom Hughes
+E<lt>F<tom@compton.nu>E<gt>.
=cut
local($setsock) = shift;
&disconnect if $connected;
if (lc($setsock) eq 'unix') {
- if (defined &_PATH_LOG) {
+ if (length _PATH_LOG()) {
$sock_type = 1;
} else {
return undef;
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();
+ length($syslog) || croak "_PATH_LOG unavailable in syslog.h";
my $that = sockaddr_un($syslog) || croak "Can't locate $syslog";
socket(SYSLOG,AF_UNIX,SOCK_STREAM,0) || croak "socket: $!";
if (!connect(SYSLOG,$that)) {
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";
+if (Sys::Syslog::_PATH_LOG()) {
+ 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";
+}
+else {
+ for (1..3) { print "ok $_ # skipping, _PATH_LOG unavailable\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";