From: Kevin G. <ke...@go...> - 2003-06-03 15:18:22
|
> sub DESTROY { > my ($self) = @_; > my ($logger) = Log::Log4perl->get_logger("BE"); > $logger->info("Entering DESTROY method for " . __PACKAGE__ . "\n"); > } > > However, when my script ends, I get the following error message as the > DESTROY method of my object gets called: > > (in cleanup) Can't call method "log" on an undefined value at > (eval 271) line 42 during global destruction. > Since I'm keeping a reference to the Log::Log4perl object inside my > object, If that's what you're doing, then use the reference instead of asking the in-the-process-of-being-garbage-collected log4perl structs for one. Try it like this: sub DESTROY { my ($self) = @_; my ($logger) = $self->{_logger}; #using exising reference $logger->info("Entering DESTROY method for " . __PACKAGE__ . "\n"); } -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |