Reading the latest source, it appears that in certain circumstances, Sys::Syslog::connection_ok() might return what you want.
Otherwise, there is a $connected variable in the package. If that means what I think it does, a patch to add a subroutine that allows one to read its contents would probably be a nice addition. I'm sure Sébastien Aperghis-Tramoni would consider it for inclusion in a future release; he's been taking good care of the module recently.
An alternative would be to add your own scaffolding:
BEGIN { my $is_open = 0; sub check_openlog { if (not $is_open) { openlog(...) and ++$is_open; } } sub is_open { return $is_open; } }
Then you can call check_openlog() anywhere in the code path, and your wrapper will do the right thing: only the first call that calls openlog() and succeeds will have any effect. All other calls will have no effect. (Reminds me of a certain biological process, come to think of it).
• another intruder with the mooring in the heart of the Perl
In reply to Re: Is syslog already open?
by grinder
in thread Is syslog already open?
by pileofrogs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |