in reply to DBI issue

Its likely your connect() is failing. You should be checking the status of your connect like so:
# Some possibilities my $dbh = DBI->connect(..., {RaiseError=>1}); or my $dbh = DBI->connect(...) or die $DBI::errstr; or my $dbh = eval { DBI->connect(..., {RaiseError}=>1) }; redirect_to_some_friendly_page_that_says_our_database_is_down($@) if $ +@;