Zoom/ZConfig.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 66.6% 4 / 6 Conditioncond 60.0% 6 / 10 MC/DCmcdc 33.3% 2 / 6 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 6 totaltotal 72.1% 44 / 61 CC 9 SCAR 18.5
CC
9
Cov
83%
new
9.9
BEGIN
1.0
parser
1.0
CRAP 6.4
« Zoom/FilterStream.pm ↑ Summary Zoom/SelectorParser.pm »
1 package HTML::Zoom::ZConfig;
2  
3 15 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 15 my %DEFAULTS = (
6 parser => 'HTML::Zoom::Parser::BuiltIn',
7 producer => 'HTML::Zoom::Producer::BuiltIn',
8 filter_builder => 'HTML::Zoom::FilterBuilder',
9 selector_parser => 'HTML::Zoom::SelectorParser',
10 stream_utils => 'HTML::Zoom::StreamUtils',
11 );
12  
13 15 my $ALL_DEFAULT;
14  
15 251 ▶sub new {
Subroutine new: called CC=9 SCAR=23.0
Pod undocumented
16 251 my ($class, $args) = @_;
17 251 ▶ return $ALL_DEFAULT if $ALL_DEFAULT && !keys %{$args||{}};
Branch: 1 branch
BranchTrueFalseTotal
if $ALL_DEFAULT and not keys %{$args or {};} 238 13 251
Condition80%4/5
$ALL_DEFAULT and not keys %{$args or {};}
!ll&&!rl&&r
130238
$args || {}
l!l
50188
MC/DC50%1/2
$ALL_DEFAULT and not keys %{$args or {};}
$ALL_DEFAULT not keys %{$args or {};}
MC/DC100%1/1
$args || {}
$args
Truth table66%2/3
A and not(B)
A= $ALL_DEFAULTB= not keys %{$args or {};}
ABresult
0X0
100
111
Truth table100%2/2
A
A= $args
Aresult
11
00
18 13 my $new = {};
19 13 foreach my $arg_name (keys %DEFAULTS) {
20 65 ▶ $new->{$arg_name} = $args->{$arg_name} || $DEFAULTS{$arg_name};
Condition33%1/3
$args->{$arg_name} || $DEFAULTS{$arg_name}
l!l&&r!l&&!r
0650
MC/DC0%0/2
$args->{$arg_name} || $DEFAULTS{$arg_name}
$args->{$arg_name} $DEFAULTS{$arg_name}
Truth table33%1/3
A || B
A= $args->{$arg_name}B= $DEFAULTS{$arg_name}
ABresult
1X1
011
000
21 65 ▶ if (ref($new->{$arg_name})) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $new->{$arg_name}) { } 0 65 65
22 0 $new->{$arg_name} = $new->{$arg_name}->with_zconfig($new);
23 } else {
24 65 require(do { (my $m = $new->{$arg_name}) =~ s/::/\//g; "${m}.pm" });
25 65 $new->{$arg_name} = $new->{$arg_name}->new({ zconfig => $new });
26 }
27 }
28 13 ▶ $ALL_DEFAULT = $new if !keys %{$args||{}};
Branch: 1 branch
BranchTrueFalseTotal
unless keys %{$args or {};} 13 0 13
Condition50%1/2
$args || {}
l!l
130
MC/DC0%0/1
$args || {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
29 13 bless($new, $class);
30 }
31  
32 190 ▶sub parser { shift->{parser} }
Subroutine parser: called CC=1 SCAR=0.0
Pod undocumented
33 60 ▶sub producer { shift->{producer} }
Subroutine producer: called CC=1 SCAR=0.0
Pod undocumented
34 157 ▶sub filter_builder { shift->{filter_builder} }
Subroutine filter_builder: called CC=1 SCAR=0.0
Pod undocumented
35 130 ▶sub selector_parser { shift->{selector_parser} }
Subroutine selector_parser: called CC=1 SCAR=0.0
Pod undocumented
36 665 ▶sub stream_utils { shift->{stream_utils} }
Subroutine stream_utils: called CC=1 SCAR=0.0
Pod undocumented
37  
38 15 1;
« Zoom/FilterStream.pm ↑ Summary Zoom/SelectorParser.pm »