database("foo") fails the second time it is called
msouth opened this issue · 1 comments
msouth commented
dancer -a Acme::Test::Dancer::Plugin::Database
And then make the config.yml and the .pm file look like this:
https://gist.github.com/msouth/6158618
I put this debugging in Dancer/Plugin/Database.pm:
register database => sub {
Carp::cluck( "settings was already". Dumper( $settings ) ) if $settings; use Data::Dumper; use Carp;
_load_db_settings() unless $settings;
my ($dbh, $cfg) = Dancer::Plugin::Database::Core::database( arg => $_[0],
logger => \&_logger,
hook_exec => \&_execute_hook,
settings => $settings );
Carp::cluck( "settings was ". Dumper( $settings ). ' and is about to be '. Dumper( $cfg ) ) ; use Data::Dumper; use Carp;
$settings = $cfg;
return $dbh;
};
I think it's an error to put that $cfg into the $settings, because later it will be looking for the ->{connections} key and not find it. Something along those lines.