line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Terse::Plugin::DBI; |
2
|
1
|
|
|
1
|
|
69199
|
use 5.006; use strict; use warnings; |
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
4
|
1
|
|
|
1
|
|
7
|
use base 'Terse::Plugin'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
588
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
108669
|
use DBI; |
|
1
|
|
|
|
|
17736
|
|
|
1
|
|
|
|
|
211
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub connect { |
9
|
0
|
|
|
0
|
0
|
|
my ($self, $t) = @_; |
10
|
0
|
|
|
|
|
|
my ($dsn, $user, $password) = $self->connect_info($t); |
11
|
0
|
0
|
|
|
|
|
if (!$dsn) { |
12
|
0
|
|
|
|
|
|
$t->logError('No dsn found for DBI conntection', 400); |
13
|
0
|
|
|
|
|
|
return; |
14
|
|
|
|
|
|
|
} |
15
|
0
|
|
|
|
|
|
my $dbi = DBI->connect($dsn, $user, $password); |
16
|
0
|
|
|
|
|
|
return $dbi; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub connect_info { |
20
|
0
|
|
|
0
|
0
|
|
my ($self, $t) = @_; |
21
|
0
|
|
|
|
|
|
my $conf = $t->plugin('config')->find('coredb'); |
22
|
0
|
|
|
|
|
|
return ($conf->{dsn}, $conf->{user}, $conf->{password}); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |