Mojolicious::Plugin::Database - "proper" handling of DBI based connections in Mojolicious
version 1.07
Provides "sane" handling of DBI connections so problems with pre-forking (Hypnotoad, etc.) will not occur.
use Mojolicious::Plugin::Database; sub startup { my $self = shift; $self->plugin('database', { dsn => 'dbi:Pg:dbname=foo', username => 'myusername', password => 'mypassword', options => { 'pg_enable_utf8' => 1, AutoCommit => 0 }, helper => 'db', }); }
The only required option is the 'dsn' one, which should contain a valid DBI dsn to connect to your database of choice.
A helper is created with a name you specified (or 'db' by default) that can be used to get the active DBI connection.
Ben van Staveren, <madcat at cpan.org>
<madcat at cpan.org>
Please report any bugs or feature requests to through the web interface at https://github.com/benvanstaveren/mojolicious-plugin-database/issues. If you want to contribute changes or otherwise involve yourself in development, feel free to fork the Git repository from https://github.com/benvanstaveren/mojolicious-plugin-database/.
You can find documentation for this module with the perldoc command.
perldoc Mojolicious::Plugin::Database
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Mojolicious-Plugin-Database
CPAN Ratings
http://cpanratings.perl.org/d/Mojolicious-Plugin-Database
Search CPAN
http://search.cpan.org/dist/Mojolicious-Plugin-Database/
Based on a small example by sri and his request if someone could please write a plugin for this stuff.
alabamapaul (github) for fixing the tests to work on Windows
Copyright 2011, 2012 Ben van Staveren.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Mojolicious::Plugin::Database, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Database
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Database
For more information on module installation, please visit the detailed CPAN module installation guide.