I'm completely stumped here, so I figured I'd ask to see if there's something 
I've missed in my reading.

I have a script running under apache2(2.0.47), mod_perl (1.99_09), Registry. 
It uses a small class to handle certain parts of the application for me, and 
I'm depending on the DESTROY function of the class to do certain cleanup 
after the script completes.

so the script has something like:

use app::utility_class;
my $var = new app::utility_class;
.... do stuff...

and the instance cleans up when it goes out of scope as the script exits.

This works, *except* for the very first run in a particular child, in which 
case the instance does not appear to be cleaned up at all (the DESTROY 
function is never called).

Tested with just one to confirm that's what was happening - it fails the first 
time after a restart, but works on all subsequent runs. If I explicitly undef 
it, the cleanup works every time. Eg:

use app::utility_class;
my $var = new app::utility_class;
.... do stuff...
undef $var;

If I wrap the script in a block, it also works. Eg:

use app::utility_class;
{
  my $var = new app::utility_class;
  .... do stuff...
}


Is there any way to work out what, if anything, is holding onto the reference 
to the app:utility_class instance? (It's not a circular reference as far as I 
can tell - if I reduce the class to just an empty blessed instance the same 
thing happens).

Have I missed something obvious?

Thanks.

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to