ZofCMS/Plugin/DBIPPT.pm

filter: Statementstmt 29.1% 14 / 48 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 27 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 50.0% 4 / 8 Podpod n/a totaltotal 14.8% 18 / 121 CC 27 SCAR 51.5
CC
27
Cov
14%
_do
210.0
_process_key
210.0
_key
2.0
CRAP 173.2
« ZofCMS/Plugin/FileList.pm ↑ Summary ZofCMS/Plugin/FloodControl.pm »
1 package App::ZofCMS::Plugin::DBIPPT;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '1.001010'; # VERSION
7  
8 1 ▶use base 'App::ZofCMS::Plugin::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use HTML::Entities;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 0 ▶sub _key { 'plug_dbippt' }
Subroutine _key: not called CC=1 SCAR=6.9
12  
13 0 ▶sub _defaults {
Subroutine _defaults: not called CC=1 SCAR=6.9
14 0 cell => 't',
15 key => 'dbi',
16 n => undef,
17 t => 'time',
18 }
19  
20 0 ▶sub _do {
Subroutine _do: not called CC=14 SCAR=53.5
21 0 my ( $self, $conf, $t, $q, $config ) = @_;
22  
23 $conf->{key} = $conf->{key}->( $t, $q, $config )
24 0 ▶ if ref $conf->{key} eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $conf->{"key"} eq "CODE" 0 0 0
25  
26 $conf->{n} = $conf->{n}->( $t, $q, $config )
27 0 ▶ if ref $conf->{n} eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $conf->{"n"} eq "CODE" 0 0 0
28  
29 $conf->{t} = $conf->{t}->( $t, $q, $config )
30 0 ▶ if ref $conf->{t} eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $conf->{"t"} eq "CODE" 0 0 0
31  
32 return
33 unless defined $conf->{key}
34 and ( defined $conf->{n}
35 or defined $conf->{t}
36 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf->{"key"} and defined $conf->{"n"} || defined $conf->{"t"} 0 0 0
Condition0%0/6
defined $conf->{"key"} and defined $conf->{"n"} || defined $conf->{"t"}
!ll&&!rl&&r
000
defined $conf->{"n"} or defined $conf->{"t"}
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $conf->{"key"} and defined $conf->{"n"} || defined $conf->{"t"}
defined $conf->{"key"} defined $conf->{"n"} defined $conf->{"t"}
Truth table0%0/4
A and B or C
A= defined $conf->{"key"}B= defined $conf->{"n"}C= defined $conf->{"t"}
ABCresult
0XX0
1000
11X1
1011
37  
38 $conf->{key} = [ $conf->{key} ]
39 if not ref $conf->{key}
40 0 ▶ and defined $conf->{key};
Branch: 1 branch
BranchTrueFalseTotal
if not ref $conf->{"key"} and defined $conf->{"key"} 0 0 0
Condition0%0/3
not ref $conf->{"key"} and defined $conf->{"key"}
!ll&&!rl&&r
000
MC/DC0%0/2
not ref $conf->{"key"} and defined $conf->{"key"}
not ref $conf->{"key"} defined $conf->{"key"}
Truth table0%0/3
not(A) and B
A= not ref $conf->{"key"}B= defined $conf->{"key"}
ABresult
0X0
100
111
41  
42 $conf->{t} = [ $conf->{t} ]
43 if not ref $conf->{t}
44 0 ▶ and defined $conf->{t};
Branch: 1 branch
BranchTrueFalseTotal
if not ref $conf->{"t"} and defined $conf->{"t"} 0 0 0
Condition0%0/3
not ref $conf->{"t"} and defined $conf->{"t"}
!ll&&!rl&&r
000
MC/DC0%0/2
not ref $conf->{"t"} and defined $conf->{"t"}
not ref $conf->{"t"} defined $conf->{"t"}
Truth table0%0/3
not(A) and B
A= not ref $conf->{"t"}B= defined $conf->{"t"}
ABresult
0X0
100
111
45  
46 $conf->{n} = [ $conf->{n} ]
47 if not ref $conf->{n}
48 0 ▶ and defined $conf->{n};
Branch: 1 branch
BranchTrueFalseTotal
if not ref $conf->{"n"} and defined $conf->{"n"} 0 0 0
Condition0%0/3
not ref $conf->{"n"} and defined $conf->{"n"}
!ll&&!rl&&r
000
MC/DC0%0/2
not ref $conf->{"n"} and defined $conf->{"n"}
not ref $conf->{"n"} defined $conf->{"n"}
Truth table0%0/3
not(A) and B
A= not ref $conf->{"n"}B= defined $conf->{"n"}
ABresult
0X0
100
111
49  
50  
51 0 for ( @{ $conf->{key} } ) {
52 0 _process_key( $t, $conf, $_ );
53 }
54  
55 0 1;
56 }
57  
58 0 ▶sub _process_key {
Subroutine _process_key: not called CC=14 SCAR=53.5
59 0 my ( $t, $conf, $key ) = @_;
60  
61 0 my $ref = $t->{ $conf->{cell} }{ $key };
62 return
63 0 ▶ unless defined $ref
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ref and ref $ref eq "ARRAY" and @$ref 0 0 0
Condition0%0/6
defined $ref and ref $ref eq "ARRAY" and @$ref
!ll&&!rl&&r
000
defined $ref and ref $ref eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/3
defined $ref and ref $ref eq "ARRAY" and @$ref
defined $ref ref $ref eq "ARRAY" @$ref
Truth table0%0/4
A and B and C
A= defined $refB= ref $ref eq "ARRAY"C= @$ref
ABCresult
0XX0
10X0
1100
1111
64 and ref $ref eq 'ARRAY'
65 and @$ref;
66  
67 0 my $is_hash = ref $ref->[0] eq 'HASH';
68  
69 0 my @t = @{ $conf->{t} };
70 0 my @n = @{ $conf->{n} };
71  
72 0 for ( @$ref ) {
73 0 ▶ if ( $is_hash ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_hash) { } 0 0 0
74 0 for ( @$_{ @n } ) {
75 0 encode_entities $_;
76 0 s/\r?\n/<br>/g;
77 }
78 0 for ( @$_{ @t } ) {
79 0 ▶ $_ = localtime $_
Branch: 1 branch
BranchTrueFalseTotal
if defined $_ and length $_ 0 0 0
Condition0%0/3
defined $_ and length $_
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ and length $_
defined $_ length $_
Truth table0%0/3
A and B
A= defined $_B= length $_
ABresult
0X0
100
111
80 if defined and length;
81 }
82 }
83 else {
84 0 for ( @$_[ @n ] ) {
85 0 encode_entities $_;
86 0 s/\r?\n/<br>/g;
87 }
88 0 for ( @$_[ @t ] ) {
89 0 ▶ $_ = localtime $_
Branch: 1 branch
BranchTrueFalseTotal
if defined $_ and length $_ 0 0 0
Condition0%0/3
defined $_ and length $_
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ and length $_
defined $_ length $_
Truth table0%0/3
A and B
A= defined $_B= length $_
ABresult
0X0
100
111
90 if defined and length;
91 }
92 }
93 }
94 }
95  
96 1 1;
97 __END__
« ZofCMS/Plugin/FileList.pm ↑ Summary ZofCMS/Plugin/FloodControl.pm »