ZofCMS/Plugin/Base.pm

filter: Statementstmt 28.5% 8 / 28 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 25.0% 2 / 8 Podpod 0.0% 0 / 2 totaltotal 15.6% 10 / 64 CC 10 SCAR 32.7
CC
10
Cov
17%
process
56.0
_has_value
12.0
_dbh
6.0
CRAP 26.4
« ZofCMS/Plugin/StyleSwitcher.pm ↑ Summary ZofCMS/Plugin/ConfigToTemplate.pm »
1 package App::ZofCMS::Plugin::Base;
2  
3 28 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 28 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 28 our $VERSION = '1.001010'; # VERSION
7  
8 0 ▶sub new { bless {}, shift }
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
9  
10 0 ▶sub process {
Subroutine process: not called CC=7 SCAR=40.3
Pod undocumented
11 0 my ( $self, $template, $query, $config ) = @_;
12  
13 0 my $key = $self->_key;
14  
15 $template->{$key} = $template->{$key}->( $template, $query, $config )
16 0 ▶ if ref $template->{$key} eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $template->{$key} eq "CODE" 0 0 0
17  
18 $config->conf->{$key} = $config->conf->{$key}->( $template, $query, $config )
19 0 ▶ if ref $config->conf->{$key} eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $config->conf->{$key} eq "CODE" 0 0 0
20  
21 return
22 unless $template->{$key}
23 0 ▶ or $config->conf->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless $template->{$key} or $config->conf->{$key} 0 0 0
Condition0%0/3
$template->{$key} or $config->conf->{$key}
l!l&&r!l&&!r
000
MC/DC0%0/2
$template->{$key} or $config->conf->{$key}
$template->{$key} $config->conf->{$key}
Truth table0%0/3
A or B
A= $template->{$key}B= $config->conf->{$key}
ABresult
1X1
011
000
24  
25 my %conf = (
26 $self->_defaults,
27 0 ▶ %{ delete $config->conf->{$key} || {} },
Condition0%0/2
delete $config->conf->{$key} || {}
l!l
00
MC/DC0%0/1
delete $config->conf->{$key} || {}
delete $config->conf->{$key}
Truth table0%0/2
A
A= delete $config->conf->{$key}
Aresult
11
00
28 0 ▶ %{ delete $template->{$key} || {} },
Condition0%0/2
delete $template->{$key} || {}
l!l
00
MC/DC0%0/1
delete $template->{$key} || {}
delete $template->{$key}
Truth table0%0/2
A
A= delete $template->{$key}
Aresult
11
00
29 );
30  
31 0 $self->_do( \%conf, $template, $query, $config );
32 }
33  
34 0 ▶sub _key { 'base' }
Subroutine _key: not called CC=1 SCAR=6.9
35 0 ▶sub _defaults { () }
Subroutine _defaults: not called CC=1 SCAR=6.9
36 0 ▶sub _has_value {
Subroutine _has_value: not called CC=3 SCAR=24.8
37 0 my $v = shift;
38  
39 0 ▶ return 1
Branch: 1 branch
BranchTrueFalseTotal
if defined $v and length $v 0 0 0
Condition0%0/3
defined $v and length $v
!ll&&!rl&&r
000
MC/DC0%0/2
defined $v and length $v
defined $v length $v
Truth table0%0/3
A and B
A= defined $vB= length $v
ABresult
0X0
100
111
40 if defined $v and length $v;
41  
42 0 return 0;
43 }
44  
45 0 ▶sub _dbh {
Subroutine _dbh: not called CC=2 SCAR=17.9
46 0 my $self = shift;
47  
48 return $self->{DBH}
49 0 ▶ if $self->{DBH};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"DBH"} 0 0 0
50  
51 $self->{DBH} = DBI->connect_cached(
52 0 @{ $self->{CONF} }{ qw/dsn user pass opt/ },
53 );
54  
55 0 return $self->{DBH};
56 }
57  
58 28 1;
59 __END__
« ZofCMS/Plugin/StyleSwitcher.pm ↑ Summary ZofCMS/Plugin/ConfigToTemplate.pm »