package Database; use strict; use warnings; # with or without use Apache::DBI; the result is the same # i also load Apache::DBI in the startup.pl file... use DBI; use DBD::mysql; our (@EXPORT, $dbh); use base qw/Exporter/; @EXPORT = qw($dbh); #BEGIN { print "Content-Type: text/html\n\n"; print "\nopening db connection!\n"; $dbh = DBI->connect('DBI:mysql:dbname', 'user', 'pwd'); #} END { $dbh->disconnect; print "\nshutting down db-conn!\n"; #should not happen... } 1;