blib/lib/Tags/HTML.pm

filter: Statementstmt 85.2% 52 / 61 Branchbran 100% 10 / 10 Conditioncond 100% 15 / 15 MC/DCmcdc 100% 7 / 7 Subroutinesub 87.5% 14 / 16 Podpod 100% 6 / 6 totaltotal 90.4% 104 / 115 CC 11 SCAR 12.6
CC
11
Cov
90%
new
8.0
process_css
3.0
process
2.0
CRAP 3.5
↑ Summary
1 package Tags::HTML;
2  
3 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 ▶use Class::Utils qw(set_params);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 7 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 7 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 7 our $VERSION = 0.08;
11  
12 # Constructor.
13 sub new {
14 14 ▶ my ($class, @params) = @_;
Subroutine new: called CC=8 SCAR=20.8
Pod documented
15  
16 # Create object.
17 14 my $self = bless {}, $class;
18  
19 # 'CSS::Struct::Output' object.
20 14 $self->{'css'} = undef;
21  
22 # No CSS support.
23 14 $self->{'no_css'} = 0;
24  
25 # 'Tags::Output' object.
26 14 $self->{'tags'} = undef;
27  
28 # Process params.
29 14 set_params($self, @params);
30  
31 # Check to 'CSS::Struct::Output' object.
32 14 ▶ if (! $self->{'no_css'} && defined $self->{'css'}
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{"no_css"} and defined $self->{"css"} and not builtin::blessed($self->{"css"}) && $self->{"css"}->isa("CSS::Struct::Output")) 3 11 14
Condition100%9/9
not $self->{"no_css"} and defined $self->{"css"} and not builtin::blessed($self->{"css"}) && $self->{"css"}->isa("CSS::Struct::Output")
!ll&&!rl&&r
1013
not $self->{"no_css"} and defined $self->{"css"}
!ll&&!rl&&r
194
builtin::blessed($self->{'css'}) && $self->{'css'}->isa('CSS::Struct::Output')
!ll&&!rl&&r
211
MC/DC100%4/4
not $self->{"no_css"} and defined $self->{"css"} and not builtin::blessed($self->{"css"}) && $self->{"css"}->isa("CSS::Struct::Output")
not $self->{"no_css"} defined $self->{"css"} builtin::blessed($self->{'css'}) $self->{'css'}->isa('CSS::Struct::Output')
Truth table100%5/5
not(A) and B and not(C && D)
A= not $self->{"no_css"}B= defined $self->{"css"}C= builtin::blessed($self->{'css'})D= $self->{'css'}->isa('CSS::Struct::Output')
ABCDresult
0XXX0
10XX0
11110
110X1
11101
33 && (! blessed($self->{'css'}) || ! $self->{'css'}->isa('CSS::Struct::Output'))) {
34  
35 3 err "Parameter 'css' must be a 'CSS::Struct::Output::*' class.";
36 }
37  
38 # Check to 'Tags' object.
39 11 ▶ if (defined $self->{'tags'}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"tags"} and not builtin::blessed($self->{"tags"}) && $self->{"tags"}->isa("Tags::Output")) 3 8 11
Condition100%6/6
defined $self->{"tags"} and not builtin::blessed($self->{"tags"}) && $self->{"tags"}->isa("Tags::Output")
!ll&&!rl&&r
713
builtin::blessed($self->{'tags'}) && $self->{'tags'}->isa('Tags::Output')
!ll&&!rl&&r
211
MC/DC100%3/3
defined $self->{"tags"} and not builtin::blessed($self->{"tags"}) && $self->{"tags"}->isa("Tags::Output")
defined $self->{"tags"} builtin::blessed($self->{'tags'}) $self->{'tags'}->isa('Tags::Output')
Truth table100%4/4
A and not(B && C)
A= defined $self->{"tags"}B= builtin::blessed($self->{'tags'})C= $self->{'tags'}->isa('Tags::Output')
ABCresult
0XX0
1110
10X1
1101
40 && (! blessed($self->{'tags'}) || ! $self->{'tags'}->isa('Tags::Output'))) {
41  
42 3 err "Parameter 'tags' must be a 'Tags::Output::*' class.";
43 }
44  
45 # Object.
46 8 return $self;
47 }
48  
49 # Cleanup after dynamic part.
50 sub cleanup {
51 1 ▶ my ($self, @params) = @_;
Subroutine cleanup: called CC=1 SCAR=0.0
Pod documented
52  
53 1 $self->_cleanup(@params);
54  
55 1 return;
56 }
57  
58 # Initialize in dynamic part.
59 sub init {
60 1 ▶ my ($self, @params) = @_;
Subroutine init: called CC=1 SCAR=0.0
Pod documented
61  
62 1 $self->_init(@params);
63  
64 1 return;
65 }
66  
67 # Initialize in preparation phase.
68 sub prepare {
69 0 ▶ my ($self, @params) = @_;
Subroutine prepare: not called CC=1 SCAR=6.9
Pod documented
70  
71 0 $self->_prepare(@params);
72  
73 0 return;
74 }
75  
76 # Process 'Tags'.
77 sub process {
78 2 ▶ my ($self, @params) = @_;
Subroutine process: called CC=2 SCAR=7.0
Pod documented
79  
80 2 ▶ if (! defined $self->{'tags'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"tags"}) 1 1 2
81 1 err "Parameter 'tags' isn't defined.";
82 }
83  
84 1 $self->_process(@params);
85  
86 0 return;
87 }
88  
89 # Process 'CSS::Struct'.
90 sub process_css {
91 3 ▶ my ($self, @params) = @_;
Subroutine process_css: called CC=3 SCAR=11.0
Pod documented
92  
93 # No CSS support.
94 3 ▶ if ($self->{'no_css'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"no_css"}) 1 2 3
95 1 return;
96 }
97  
98 2 ▶ if (! defined $self->{'css'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"css"}) 1 1 2
99 1 err "Parameter 'css' isn't defined.";
100 }
101  
102 1 $self->_process_css(@params);
103  
104 0 return;
105 }
106  
107 sub _cleanup {
108 1 ▶ my ($self, @params) = @_;
Subroutine _cleanup: called CC=1 SCAR=0.0
109  
110 # Default is no special code.
111  
112 1 return;
113 }
114  
115 sub _init {
116 1 ▶ my ($self, @params) = @_;
Subroutine _init: called CC=1 SCAR=0.0
117  
118 # Default is no special code.
119  
120 1 return;
121 }
122  
123 sub _prepare {
124 0 ▶ my ($self, @params) = @_;
Subroutine _prepare: not called CC=1 SCAR=6.9
125  
126 # Default is no special code.
127  
128 0 return;
129 }
130  
131 sub _process {
132 1 ▶ my ($self, @params) = @_;
Subroutine _process: called CC=1 SCAR=0.4
133  
134 1 err "Need to be implemented in inherited class in _process() method.";
135  
136 0 return;
137 }
138  
139 sub _process_css {
140 1 ▶ my ($self, @params) = @_;
Subroutine _process_css: called CC=1 SCAR=0.4
141  
142 1 err "Need to be implemented in inherited class in _process_css() method.";
143  
144 0 return;
145 }
146  
147 7 1;
148  
149 __END__
↑ Summary