Zoom/Transform.pm

filter: Statementstmt 100% 25 / 25 Branchbran 50.0% 2 / 4 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 6 totaltotal 76.9% 40 / 52 CC 5 SCAR 5.9
CC
5
Cov
88%
new
3.1
with_filter
2.0
match
2.0
CRAP 1.8
« Zoom/SubObject.pm ↑ Summary Zoom/TransformBuilder.pm »
1 package HTML::Zoom::Transform;
2  
3 15 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use base qw(HTML::Zoom::SubObject);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use HTML::Zoom::TransformedStream;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 296 ▶sub new {
Subroutine new: called CC=3 SCAR=11.2
Pod undocumented
8 296 my ($class, $args) = @_;
9 296 my $new = $class->SUPER::new($args);
10 296 $new->{selector} = $args->{selector};
11 296 ▶ $new->{match} = $args->{match} if $args->{match};
Branch: 1 branch
BranchTrueFalseTotal
if $args->{"match"} 0 296 296
12 296 ▶ $new->{filters} = $args->{filters}||[];
Condition50%1/2
$args->{'filters'} || []
l!l
2960
MC/DC0%0/1
$args->{'filters'} || []
$args->{'filters'}
Truth table50%1/2
A
A= $args->{'filters'}
Aresult
11
00
13 296 $new;
14 }
15  
16 266 ▶sub selector { shift->{selector} }
Subroutine selector: called CC=1 SCAR=0.0
Pod undocumented
17  
18 257 ▶sub filters { shift->{filters} }
Subroutine filters: called CC=1 SCAR=0.0
Pod undocumented
19  
20 130 ▶sub with_filter {
Subroutine with_filter: called CC=2 SCAR=7.1
Pod undocumented
21 130 my ($self, $filter) = @_;
22 (ref $self)->new({
23 selector => $self->selector,
24 ($self->{match} ? (match => $self->{match}) : ()),
25 130 ▶ filters => [ @{$self->filters}, $filter ]
Branch: 1 branch
BranchTrueFalseTotal
$self->{'match'} ? : 0 130 130
26 });
27 }
28  
29 130 ▶sub match {
Subroutine match: called CC=2 SCAR=7.1
Pod undocumented
30 130 my ($self) = @_;
31 $self->{match} ||=
32 $self->_zconfig
33 ->selector_parser
34 130 ▶ ->parse_selector($self->{selector});
Condition66%2/3
$self->{"match"} ||= $self->_zconfig->selector_parser->parse_selector($self->{"selector"})
l!l&&r!l&&!r
01273
MC/DC50%1/2
$self->{"match"} ||= $self->_zconfig->selector_parser->parse_selector($self->{"selector"})
$self->{"match"} $self->_zconfig->selector_parser->parse_selector($self->{"selector"})
Truth table66%2/3
A ||= B
A= $self->{"match"}B= $self->_zconfig->selector_parser->parse_selector($self->{"selector"})
ABresult
1X1
011
000
35 }
36  
37 130 ▶sub apply_to_stream {
Subroutine apply_to_stream: called CC=1 SCAR=0.0
Pod undocumented
38 130 my ($self, $stream) = @_;
39 130 HTML::Zoom::TransformedStream->new({
40 stream => $stream,
41 transform => $self,
42 zconfig => $self->_zconfig,
43 });
44 }
45
46  
47 15 1;
« Zoom/SubObject.pm ↑ Summary Zoom/TransformBuilder.pm »