in reply to DBI and Modules

I think the answer is in the error message itself. You need to issue an explicit disconnect before your program exits. This is probably coming out of the database driver, since the quick skimming of DBI examples I've done doesn't explicitely seem to require a disconnect, but does urge it.

With a perl object such as you have here, this can be guaranteed with a DESTROY method:

=pod =item DESTROY Called when the last reference to the object goes away. =cut sub DESTROY { my($self) = @_ ; if( $self->{_dbh } ) { # check in case it was deallocated somewhere else $self->{_dbh}->disconnect() ; } }