blib/lib/Terse/Plugin/DBI.pm

filter: Statementstmt 61.5% 16 / 26 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 2 totaltotal 56.7% 21 / 37 CC 2 SCAR 8.6
CC
2
Cov
57%
connect
6.0
connect_info
2.0
BEGIN
1.0
CRAP 2.4
↑ Summary
1 package Terse::Plugin::DBI;
2 1 ▶use 5.006; use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 our $VERSION = '0.05';
4 1 ▶use base 'Terse::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub connect {
Subroutine connect: not called CC=2 SCAR=17.9
Pod undocumented
9 0 my ($self, $t) = @_;
10 0 my ($dsn, $user, $password) = $self->connect_info($t);
11 0 ▶ if (!$dsn) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dsn) 0 0 0
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 0 ▶sub connect_info {
Subroutine connect_info: not called CC=1 SCAR=6.9
Pod undocumented
20 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 1;
26  
27 __END__
↑ Summary