File Coverage

blib/lib/Plack/App/ServiceStatus/DBIC.pm
Criterion Covered Total %
statement 8 17 47.0
branch 0 4 0.0
condition 0 2 0.0
subroutine 3 4 75.0
pod 0 1 0.0
total 11 28 39.2


line stmt bran cond sub pod time code
1             package Plack::App::ServiceStatus::DBIC;
2              
3             # ABSTRACT: Check DBIC connection
4              
5             our $VERSION = '0.913'; # VERSION
6              
7 1     1   269959 use 5.018;
  1         3  
8 1     1   4 use strict;
  1         2  
  1         22  
9 1     1   18 use warnings;
  1         2  
  1         178  
10              
11             sub check {
12 0     0 0   my ( $class, $args ) = @_;
13 0 0         $args = [$args] unless ref($args) eq 'ARRAY';
14              
15 0           my $dbic = $args->[0];
16 0   0       my $query = $args->[1] || 'select 1';
17 0           my $sth = $dbic->storage->dbh->prepare($query);
18 0           $sth->execute;
19 0           my $ok = $sth->fetchrow_array;
20 0 0         return 'ok' if $ok == 1;
21 0           return 'nok', "got: $ok";
22             }
23              
24             1;
25              
26             __END__