in reply to Re^2: DBI returning error on selectrow_hashref
in thread DBI returning error on selectrow_hashref

Your example is good for some uses, but won't prevent the kind of error the OP shows, in fact it will generate a second error of the same kind. A disconnected $dbh is still a $dbh object, his error showed there was no $dbh so doing $dbh->{Active} would generate the same error.
  • Comment on Re^3: DBI returning error on selectrow_hashref