| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Plack::App::ServiceStatus::DBI; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Check DBI connection |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.913'; # VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
236106
|
use 5.018; |
|
|
1
|
|
|
|
|
5
|
|
|
8
|
1
|
|
|
1
|
|
8
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
38
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
259
|
|
|
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 $dbh = $args->[0]; |
|
16
|
0
|
|
0
|
|
|
|
my $query = $args->[1] || 'select 1'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $sth = $dbh->prepare($query); |
|
19
|
0
|
|
|
|
|
|
$sth->execute; |
|
20
|
0
|
|
|
|
|
|
my $ok = $sth->fetchrow_array; |
|
21
|
0
|
0
|
|
|
|
|
return 'ok' if $ok == 1; |
|
22
|
0
|
|
|
|
|
|
return 'nok', "got: $ok"; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |