blib/lib/Tags/HTML.pm

filter: Statementstmt 92.8% 52 / 56 Branchbran 100% 10 / 10 Conditioncond 100% 15 / 15 MC/DCmcdc 100% 7 / 7 Subroutinesub 100% 14 / 14 Podpod 100% 5 / 5 totaltotal 96.2% 103 / 107 SCAR 24.0
CC
11
Cov
95%
new
8.0
process_css
3.0
process
2.0
CRAP 11.0
↑ 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.07;
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 before 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 # Process 'Tags'.
68 sub process {
69 2 ▶ my ($self, @params) = @_;
Subroutine process: called CC=2 SCAR=7.0
Pod documented
70  
71 2 ▶ if (! defined $self->{'tags'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"tags"}) 1 1 2
72 1 err "Parameter 'tags' isn't defined.";
73 }
74  
75 1 $self->_process(@params);
76  
77 0 return;
78 }
79  
80 # Process 'CSS::Struct'.
81 sub process_css {
82 3 ▶ my ($self, @params) = @_;
Subroutine process_css: called CC=3 SCAR=11.0
Pod documented
83  
84 # No CSS support.
85 3 ▶ if ($self->{'no_css'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"no_css"}) 1 2 3
86 1 return;
87 }
88  
89 2 ▶ if (! defined $self->{'css'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"css"}) 1 1 2
90 1 err "Parameter 'css' isn't defined.";
91 }
92  
93 1 $self->_process_css(@params);
94  
95 0 return;
96 }
97  
98 sub _cleanup {
99 1 ▶ my ($self, @params) = @_;
Subroutine _cleanup: called CC=1 SCAR=0.0
100  
101 # Default is no special code.
102  
103 1 return;
104 }
105  
106 sub _init {
107 1 ▶ my ($self, @params) = @_;
Subroutine _init: called CC=1 SCAR=0.0
108  
109 # Default is no special code.
110  
111 1 return;
112 }
113  
114 sub _process {
115 1 ▶ my ($self, @params) = @_;
Subroutine _process: called CC=1 SCAR=0.4
116  
117 1 err "Need to be implemented in inherited class in _process() method.";
118  
119 0 return;
120 }
121  
122 sub _process_css {
123 1 ▶ my ($self, @params) = @_;
Subroutine _process_css: called CC=1 SCAR=0.4
124  
125 1 err "Need to be implemented in inherited class in _process_css() method.";
126  
127 0 return;
128 }
129  
130 7 1;
131  
132 __END__
↑ Summary