Zoom/Producer/BuiltIn.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 85.7% 12 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 3 totaltotal 86.3% 38 / 44 CC 8 SCAR 17.5
CC
8
Cov
92%
event_to_html
8.1
BEGIN
1.0
BEGIN
1.0
CRAP 5.7
« Zoom/FilterBuilder.pm ↑ Summary Zoom/Parser/BuiltIn.pm »
1 package HTML::Zoom::Producer::BuiltIn;
2  
3 13 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use base qw(HTML::Zoom::SubObject);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 84 ▶sub html_from_stream {
Subroutine html_from_stream: called CC=1 SCAR=0.0
Pod undocumented
7 84 my ($self, $stream) = @_;
8 return
9 84 join '',
10 map $self->event_to_html($_),
11 $self->_zconfig->stream_utils->stream_to_array($stream)
12 }
13  
14 2 ▶sub html_from_events {
Subroutine html_from_events: called CC=1 SCAR=0.0
Pod undocumented
15 2 my ($self, $events) = @_;
16 2 join '', map $self->event_to_html($_), @$events;
17 }
18  
19 1242 ▶sub event_to_html {
Subroutine event_to_html: called CC=8 SCAR=20.9
Pod undocumented
20 1242 my ($self, $evt) = @_;
21 # big expression
22 1242 ▶ if (defined $evt->{raw}) {
Branch: 4 branches
BranchTrueFalseTotal
if (defined $evt->{'raw'}) { } 1199 43 1242
elsif ($evt->{'type'} eq 'OPEN') { } 38 5 43
elsif ($evt->{'type'} eq 'CLOSE') { } 4 1 5
elsif ($evt->{'type'} eq 'EMPTY') { } 1 0 1
23 $evt->{raw}
24 1199 } elsif ($evt->{type} eq 'OPEN') {
25 '<'
26 .$evt->{name}
27 .(defined $evt->{raw_attrs}
28 ? $evt->{raw_attrs}
29 : do {
30 36 my @names = @{$evt->{attr_names}};
31 @names
32 36 ▶ ? join(' ', '', map qq{${_}="${\$evt->{attrs}{$_}}"}, @names)
Branch: 2 branches
BranchTrueFalseTotal
@names ? : 36 0 36
$evt->{'is_in_place_close'} ? : 2 36 38
33 : ''
34 }
35 )
36 38 ▶ .($evt->{is_in_place_close} ? ' /' : '')
Branch: 1 branch
BranchTrueFalseTotal
defined $evt->{'raw_attrs'} ? : 2 36 38
37 .'>'
38 } elsif ($evt->{type} eq 'CLOSE') {
39 4 '</'.$evt->{name}.'>'
40 } elsif ($evt->{type} eq 'EMPTY') {
41 1 ''
42 } else {
43 0 die "No raw value in event and no special handling for type ".$evt->{type};
44 }
45 }
46  
47 13 1;
« Zoom/FilterBuilder.pm ↑ Summary Zoom/Parser/BuiltIn.pm »