bigpresh / Dancer-Plugin-Database

Dancer::Plugin::Database - easy database support for Dancer applications
http://search.cpan.org/dist/Dancer-Plugin-Database
37 stars 36 forks source link

Change settings from within application #3

Closed alanhaggai closed 13 years ago

alanhaggai commented 13 years ago

Hi David,

This patch lets a Dancer application override settings defined in the configuration file.

Please apply it if you find it useful.

Thank you.

Regards, Alan Haggai Alavi.

bigpresh commented 13 years ago

Thanks Alan, looks useful - I'll pull these in soon and write up some documentation.

From looking at the code, it seems you could pass it a hashref of settings if you want to, for instance:

my $dbh = database(
    { driver => 'SQLite', database => 'foo.sqlite' }
);

?

Sounds like something that could potentially be useful for some :) (I assume you're making use of D::P::Database in a way which that feature is useful for you? :) )

bigpresh commented 13 years ago

Will also need to rock up some tests to exercise this new feature :)

alanhaggai commented 13 years ago

Thanks for the reply, David. :-)

Yes, a hashref can be passed to set configuration during runtime. I added this feature so that I could connect to databases which were selected at runtime. We need tests and documentation. :-)