Weirdness with Perl callbacks

Jeremy jeremy at
Sat Nov 27 20:22:33 UTC 1999

Recently I installed INN on my workstation, mostly to test Cleanfeed.
In testing, I've found something strange with the callbacks.

I've implemented persistent, saved-to-disk EMP histories that can
survive a server restart.  So, when the filter starts up, and when it's
unthrottled, if persistence is wanted and there is data on the disk,
I load it up.  Then, I do this:

    if ($SERVER eq 'inn' and defined($INN::{syslog})) {
        INN::syslog('N', 'Restored EMP database.');

At startup time, this results in:

Nov 27 15:09:34 innd: SERVER perl loading
 /usr/local/news/bin/filter/ failed: Undefined subroutine
 &INN::syslog called at /usr/local/news/bin/filter/ line 2120.

Now, first of all, I'm checking the symbol table first to see if the
syslog callback is there.  (I check the symbol table because checking if
the subroutine is defined never succeeds.)  So if it's not defined, my
check should fail, I would think.

Second, this *only* happens at startup time.  Any attempt to use the
callbacks during startup kills the filter.  However, if I leave the code
untouched, and just do

  ctlinnd reload filter.perl meow
  ctlinnd perl y

...then everything works.  The callbacks are suddenly defined and usable.

So, it looks like something is being done after something else, that should
probably be done earlier.  I can work around this by not using any of the
callbacks during startup (I have a flag for that, I'm not using the file at all).  But that doesn't seem like the Right Answer.
But, if I do that, the callbacks become defined and usable as of the first
time filter_art() is called (or probably earlier, but that's the first I
see of them).


More information about the inn-workers mailing list