package Biblesearch; our $VERSION = '0.01'; use Mojo::Base 'Mojolicious'; use DBIx::Custom; has 'dbi'; sub startup { my $self = shift; # DBI my $db_file = $self->home->rel_file('db/bible.db'); my $dbi = DBIx::Custom->connect( dsn => "dbi:SQLite:dbname=$db_file", option => {sqlite_unicode => 1}, connector => 1 ); $self->dbi($dbi); # Models my $models = [ { table => 'book', primary_key => 'id' }, { table => 'section', primary_key => [qw/book_id chapter section/] } ]; $dbi->create_model($_) for @$models; # Route my $r = $self->routes; $r->get('/')->to(template => 'index'); $r->get('/test')->to(template => 'test'); } 1;