[Dancer-users] Dancer::Plugin::Database 1.60 adds an on-connect hook

David Precious davidp at preshweb.co.uk
Fri Dec 30 00:37:49 CET 2011


Hi all,

Just in case it's of use to you in your apps, Dancer::Plugin::Database
1.60 adds a 'database_connected' hook position, to allow you to define
code that should be executed every time a database connection is
established (receiving the new handle as a parameter, so you can use
it).

Example:

    hook database_connected => sub {
        my $dbh = shift;
        $dbh->sqlite_create_function( 'now', 0, sub { return time } );
    };

This feature was requested by Mario Domgoergen, so if it's useful to
you, thank him :)

Cheers

Dave P

-- 
David Precious ("bigpresh") <davidp at preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github


More information about the Dancer-users mailing list