Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, everybody! In one very very very big perl script (about 10k lines), I have an error after subroutine Sys::Syslog::closelog: "... close_xs is not a valid Sys::Syslog macro ..." I tried reproduce the error in test scripts, I logged all possible debug info from this script, but didn't get any result. All test scripts works fine, without any errors. All debug info says that this very big scripts works fine too (excluding Sys::Syslog::closelog). Can anybody help?
  • Comment on close_xs is not a valid Sys::Syslog macro

Replies are listed 'Best First'.
Re: close_xs is not a valid Sys::Syslog macro (UtS,L)
by tye (Sage) on Feb 03, 2009 at 16:28 UTC

    A quick glance at the source for Sys::Syslog shows that somebody needs to call closelog_xs() not close_xs().

    Perhaps your Syslog.pm file is from a different version than your Syslog dynamic library (.so or .dll file)? Or perhaps you didn't install the dynamic library and the module brokenly doesn't notice?

    The Changes file notes "[BUGFIX] CPAN-RT#21516: disconnect_log() now correctly calls closelog_xs()" at release 0.19 so perhaps you just need to upgrade.

    - tye        

      But, all test scripts work without errors in same system.
        I bet your test scripts do not define SIG{__DIE__}, and your production script does. I just a SIG{__DIE__} handler to an old script, and suddenly I started getting the close_xs error. I added "return if $^S;" to the top of my handler, and the issue went away. At least with Syslog.pm version 0.18, the close_xs call is made within an eval.
Re: close_xs is not a valid Sys::Syslog macro
by roboticus (Chancellor) on Feb 03, 2009 at 16:23 UTC

    Perhaps you could run your program in debugger mode and set a breakpoint in the routine that prints the error message? (I'm assuming the error comes from somewhere in the insides of error or warning, but I've never done any spelunking there, so I have no hints for you there....)

    ...roboticus