I have a pretty straightforward subclass of DBI. Things work fine
until I try to destroy the object. I have my own DESTROY routine which
does some internal cleanup before calling the SUPER::DESTROY method.
This routine makes use of private_* entries. The problem is that those
entries don't seem to exist. I get:
(in cleanup) Can't call method "EXISTS" on an undefined value at
/modules/subclass/DB.pm line 197 during global destruction.
I'm basically checking for the existence of a private_* value. The
object itself is defined, but it appears that whatever underlying
mechanism that is used for storing the private_* variables (my guess
would be a TIEd hash, given DBI's tendency to use them) has already
been DESTROYed. Of course, at this point my program bails out, and my
actual DESTROY code doesn't get called.
Having run a trace, it looks as though the socket is closed before my
DESTROY routine is called. My DESTROY routine actually takes care of
the disconnect, so the socket closing before that indicates that DBI
cleanup is already taking place before my code is called.
Does any of this make sense to anyone?
Here's the DESTROY code:
sub DESTROY {
my ( $this ) = @_;
# it'll die here, with the error given above
return unless $this && exists $this->{'private_PK_DB_AREA'};
$counts{$this->{'private_PK_DB_AREA'}} = 1;
$keepopen{$this->{'private_PK_DB_AREA'}} = 0;
$this->disconnect();
$this->SUPER::DESTROY();
}
* Philip Molter
* DataFoundry.net
* http://www.datafoundry.net/
* [EMAIL PROTECTED]