in reply to Weird perl behavior regarding unloading class modules

This isn't a direct answer to your problem.
What I would suggest is that you separate the database
connection into another package. That way in the constructor
for the current class, you would call a method in your new
DB package. It would check to see if there is already a
connection to the database for the calling package type.
If not it would create one and return it.

This way the DB class would have its own DESTROY method
which would only get called whenever the *last* instance of the
package that called it is destroyed.

Just a thought.

"Against one that is insane, insane measures are often best."
  • Comment on Re: Weird perl behavior regarding unloading class modules