Dancer::Plugin::Database 0.90 released

I recently extended Dancer::Plugin::Database to add a few more handy features.

Now, instead of returning a straight DBI connection handle (a DBI::db object), it returns a Dancer::Plugin::Database::Handle object, which is a subclass of DBI::db, but adding new quick_insert, quick_update and quick_delete methods, allowing you to do, for instance,:

# in your Dancer app:
database->quick_insert($tablename, \%data);

# Updating a record where id = 42:
database->quick_update($tablename, { id => 42 }, { foo => 'New value' });

So, let's say you want to handle a POST request containing a name of someone to add to your Christmas gifts list. It could be as simple as:

post '/add' => sub {
    database->quick_insert('xmas_list', { name => params->{name} });
    redirect '/';
};

This has been out as 0.12_01 for a few days, and the test reports look good. I've made real-world usage of it, too, and it's performed correctly.

I've also fixed test failures on Windows systems with this release.

I've bumped version from 0.12 to 0.90 as the precursor to hitting 1.0 soon. I personally don't care too much for version numbers, but I want to indicate that Dancer::Plugin::Database is considered stable and ready for production use.

1 Comment

Great! Thanks for that very handy plugin David.

Leave a comment

About David Precious

user-pic Professional Perl developer, Dancer core team member, beer drinker. See http://www.preshweb.co.uk/about for more :)