Unable to set handle class to DBI::db #37

Open
Wu-Wu opened this Issue Dec 30, 2012 · 0 comments

Comments

Projects
None yet
1 participant

Wu-Wu commented Dec 30, 2012

If pointed to use handle_class: 'DBI::db', the plugin tries to require DBI/db.pm module and Dancer raises an exeption because DBI::db package located inside DBI.pm module.

At the moment I dont know how to handle this. May be a hashref of classes and its packages to load will be used. E.g.

$special = {
  'DBI::db' => 'DBI.pm',
  'DBD::Proxy::db' => 'DBD/Proxy.pm',
  ...
};

if (exists $special->{$handle_class}) {
  $package = $special->{$handle_class};
}
else {
  $package = $handle_class;
  $package =~ s{::}{/}g;
  $package .= '.pm';
}

require $package;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment