Zoom/ZConfig.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 70.0% 7 / 10 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 6 totaltotal 72.8% 43 / 59 SCAR 22.4
CC
9
Cov
83%
new
9.9
BEGIN
1.0
parser
1.0
CRAP 9.4
« Zoom/FilterBuilder/Template.pm ↑ Summary Zoom/StreamBase.pm »
1 package HTML::Zoom::ZConfig;
2  
3 16 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 16 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 16 my $ALL_DEFAULT;
14  
15 sub new {
16 252 ▶ my ($class, $args) = @_;
Subroutine new: called CC=9 SCAR=23.0
Pod undocumented
17 252 ▶ return $ALL_DEFAULT if $ALL_DEFAULT && !keys %{$args||{}};
Branch: 2 branches
BranchTrueFalseTotal
if $ALL_DEFAULT and not keys %{$args or {};} 238 14 252
$args or {} 188 50 238
Condition66%2/3
$ALL_DEFAULT and not keys %{$args or {};}
!ll&&!rl&&r
140238
MC/DC50%1/2
$ALL_DEFAULT and not keys %{$args or {};}
$ALL_DEFAULT not keys %{$args or {};}
Truth table66%2/3
A and not(B)
A= $ALL_DEFAULTB= not keys %{$args or {};}
ABresult
0X0
100
111
18 14 my $new = {};
19 14 foreach my $arg_name (keys %DEFAULTS) {
20 70 ▶ $new->{$arg_name} = $args->{$arg_name} || $DEFAULTS{$arg_name};
Condition33%1/3
$args->{$arg_name} || $DEFAULTS{$arg_name}
l!l&&r!l&&!r
0700
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 70 ▶ if (ref($new->{$arg_name})) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $new->{$arg_name}) { } 0 70 70
22 0 $new->{$arg_name} = $new->{$arg_name}->with_zconfig($new);
23 } else {
24 70 require(do { (my $m = $new->{$arg_name}) =~ s/::/\//g; "${m}.pm" });
25 70 $new->{$arg_name} = $new->{$arg_name}->new({ zconfig => $new });
26 }
27 }
28 14 ▶ $ALL_DEFAULT = $new if !keys %{$args||{}};
Branch: 2 branches
BranchTrueFalseTotal
unless keys %{$args or {};} 14 0 14
$args or {} 0 14 14
29 14 bless($new, $class);
30 }
31  
32 191 ▶sub parser { shift->{parser} }
Subroutine parser: called CC=1 SCAR=0.0
Pod undocumented
33 61 ▶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 667 ▶sub stream_utils { shift->{stream_utils} }
Subroutine stream_utils: called CC=1 SCAR=0.0
Pod undocumented
37  
38 16 1;
« Zoom/FilterBuilder/Template.pm ↑ Summary Zoom/StreamBase.pm »