Mojolicious::Plugin::DBIC - Mojolicious ♥ DBIx::Class
version 0.001
use Mojolicious::Lite; plugin DBIC => { schema => { 'Local::Schema' => 'dbi:SQLite::memory:' }, }; get '/model', { controller => 'DBIC', action => 'list', resultset => 'Model', template => 'model/list.html.ep', }; app->start; __DATA__ @@ model/list.html.ep % for my $row ( $resultset->all ) { <p><%= $row->id %></p> % }
This plugin makes working with DBIx::Class easier in Mojolicious.
Configure your schema in multiple ways:
# Just DSN plugin DBIC => { schema => { 'MySchema' => 'DSN', }, }; # Arguments to connect() plugin DBIC => { schema => { 'MySchema' => [ 'DSN', 'user', 'password', { RaiseError => 1 } ], }, }; # Connected schema object my $schema = MySchema->connect( ... ); plugin DBIC => { schema => $schema, };
This plugin can also be configured from the application configuration file:
# myapp.conf { dbic => { schema => { 'MySchema' => 'dbi:SQLite:data.db', }, }, } # myapp.pl use Mojolicious::Lite; plugin 'Config'; plugin 'DBIC';
This plugin contains a controller to reduce the code needed for simple database operations. See Mojolicious::Plugin::DBIC::Controller::DBIC.
Mojolicious, DBIx::Class, Yancy
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2018 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '♥'. Assuming UTF-8
To install Mojolicious::Plugin::DBIC, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::DBIC
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::DBIC
For more information on module installation, please visit the detailed CPAN module installation guide.