Sets the socket type to be used for the next call to
C<openlog()> or C<syslog()>.
-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
+C<_PATH_LOG> in F<syslog.ph>. If F<syslog.ph> fails to define
+C<_PATH_LOG>, C<setlogsock> returns C<undef>; otherwise a true value is
+returned. A value of 'inet' will connect to an INET socket returned by
+getservbyname(). Any other value croaks.
The default is for the INET socket to be used.
sub setlogsock {
local($setsock) = shift;
if (lc($setsock) eq 'unix') {
+ if (defined &_PATH_LOG) {
+ $sock_unix = 1;
+ } else {
+ return;
+ }
$sock_unix = 1;
} elsif (lc($setsock) eq 'inet') {
undef($sock_unix);
} else {
croak "Invalid argument passed to setlogsock; must be 'unix' or 'inet'";
}
+ return 1;
}
sub syslog {