[Dancer-users] Dancer::Plugin:Database with multiple connections - request for testers

David Precious davidp at preshweb.co.uk
Wed Sep 15 00:18:23 CEST 2010

Hi all,

I've just released a new version of Dancer::Plugin::Database incorporating an 
excellent new feature contributed by Igor Bujna - the ability to handle 
multiple connections.

You can now define multiple connections in your config file, for example:

          driver: 'SQLite'
          database: 'foo.sqlite'
          driver: 'SQLite'
          database: 'bar.sqlite'

You can then pass the name of the connection you want to the database() 
keyword - for instance:

  my $dbh_foo = database('foo');
  # or use it directly:
  my $sth = database('foo')->prepare('...');

Configuration details declared the existing way will be used if you don't 
supply a name to database().

I've just released this to CPAN as a developer release 0.08_01, or you can 
pull from the repo on Github.

Assuming all seems OK, I plan to get it released as version 0.09 some time 
later this week.

I also plan to write some good tests for it, but I'm not sure the best way to 
go about testing it to be honest - any thoughts would be appreciated.

I could use DBD::Mock or Test::MockDBI to mock up the database interactions so 
I'm just testing the way the plugin works, but I'd ideally need to test it as 
it would be used from a Dancer app, which is the bit I'm not sure about.


Dave P

David Precious <davidp at preshweb.co.uk>
http://blog.preshweb.co.uk/    www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/identica    www.lyricsbadger.co.uk

  "Programming is like sex. One mistake and you have to support 
  it for the rest of your life". (Michael Sinz)

More information about the Dancer-users mailing list