line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
754
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
3
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Amon2::Plugin::DBI; |
6
|
1
|
|
|
1
|
|
638
|
use Amon2::DBI; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
86
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub init { |
9
|
1
|
|
|
1
|
0
|
17
|
my ($class, $context_class, $config) = @_; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
7
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
191
|
|
12
|
1
|
|
|
|
|
4
|
*{"$context_class\::dbh"} = \&_dbh; |
|
1
|
|
|
|
|
12
|
|
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _dbh { |
16
|
5
|
|
|
5
|
|
5011
|
my ($self) = @_; |
17
|
|
|
|
|
|
|
|
18
|
5
|
100
|
|
|
|
24
|
if ( !defined $self->{dbh} ) { |
19
|
2
|
50
|
|
|
|
13
|
my $conf = $self->config->{'DBI'} |
20
|
|
|
|
|
|
|
or die "missing configuration for 'DBI'"; |
21
|
2
|
|
|
|
|
32
|
$self->{dbh} = Amon2::DBI->connect(@$conf); |
22
|
|
|
|
|
|
|
} |
23
|
5
|
|
|
|
|
36
|
return $self->{dbh}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|