Amon2-DBI
view release on metacpan or search on metacpan
dynamic_config => 0,
configure_requires => {
'Module::Build' => 0.38,
},
name => 'Amon2-DBI',
module_name => 'Amon2::DBI',
allow_pureperl => 0,
script_files => [glob('script/*'), glob('bin/*')],
c_source => [qw()],
PL_files => {},
test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
recursive_test_files => 1,
);
if (-d 'share') {
$args{share_dir} = 'share';
t/02_integrate.t view on Meta::CPAN
package MyApp::Web;
use Amon2::Web;
our @ISA = qw/MyApp Amon2::Web/;
sub dispatch {
my $c = shift;
$c->create_response(200, [], [$c->dbh->ping ? 'OK' : 'NG']);
}
}
subtest 'global context' => sub {
my $app = MyApp->new();
isa_ok $app->dbh(), 'Amon2::DBI::db';
ok $app->dbh->ping();
is $app->dbh(), $app->dbh(), 'cached';
};
subtest 'web context' => sub {
my $app = MyApp::Web->to_app();
my $res = $app->(+{});
is $res->[0], 200;
( run in 0.490 second using v1.01-cache-2.11-cpan-49f99fa48dc )