I am not sure, but I think the problem you have is that Apache::DBI ignores any disconnect() calls on database handles, and doesn't actually disconnect.

----- Original Message ----- From: "Jordan McLain" <[EMAIL PROTECTED]>
To: <modperl@perl.apache.org>
Sent: Tuesday, October 10, 2006 10:57 PM
Subject: DESTROY


I have written a handler that calls a constructor to a module that I
have written.  I do not believe that the subsequent destructor is
being called unless I explicitly call it.  Is this a feature of
mod_perl?  I would think that every time an instance of the module is
created, it would be destroyed properly when using mod_perl.

The reason I am doing this, is that I am testing to see if I want to
continue using Apache::DBI.  I have 4 databases that need to be
connected to, and I end up having alot of MySQL threads hanging out if
I use Apache::DBI.  The problem comes in that I have all disconnects
in the DESTROY method for the module(all of my database interaction is
abstracted using an OO module) and I end up having no difference
between Apache::DBI and using only DBI (threads stay persistent)
unless I call destroy explicitly from the handler ( $db->DESTROY ).

sub DESTROY {
       my $self = shift;

       $self->dbh->disconnect() if defined $self->dbh;
}

Reply via email to