You shouldn't be using
CGI::Application::Plugin::DBH outside of CGI applications, use
DBI itself (or an ORM like
DBIx::Class). Are you using CGI::Application? Are you calling dbh_config() in setup() or cgiapp_init()? If you are calling it in a run-mode then it won't be persisted into the run mode where you call dbh().