From: Ray Z. <rz...@co...> - 2004-04-30 13:20:51
|
Chris, I temporarily modified SPOPS::DESTROY and added a DESTROY method to Log::Log4perl::Logger to see when the $log was getting destroyed. I verified that the SPOPS objects which were defined either as lexicals or package variables in the "main" namespace of my script were getting destroyed after $log UNLESS I specifically undef them before the script terminates. Other SPOPS objects used in subroutines were destroyed beforehand as expected. BTW, there are a bunch of Log::Log4perl::Logger objects, I assume one for each package that calls get_logger(). I would have thought that a lexical in a class would not be destroyed until after all objects of that class were destroyed. Not knowing how it works, maybe this isn't even possible. I don't suppose this is a bug in perl? I wonder what happens if you make $log a package variable? Ray On Apr 30, 2004, at 9:06 AM, Chris Winters wrote: > On Apr 29, 2004, at 3:18 PM, Ray Zimmerman wrote: >> I have a script that uses SPOPS-0.83 that's giving me the follow >> error when it exits ... >> >> (in cleanup) Can't call method "is_debug" on an undefined >> value at /usr/local/perl-5.8.2/lib/site_perl/5.8.2/SPOPS.pm line 179 >> during global destruction > > Gah! This is the second time the DESTROY method has screwed me in > recent months -- the other is in Apache::Session. It has to do with > the order in which objects are destroyed -- the $log is a lexical > reference to a singleton in Log4perl, and apparently that singleton > gets destroyed before all the SPOPS objects. > > I'll just change this to first see if the $log variable is defined. > > Thanks for the report, > > Chris > > -- > Chris Winters > Creating enterprise-capable snack systems since 1988 > |