| 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
Condition66%2/3
$ALL_DEFAULT and not keys %{$args or {};}
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 {};}
| |||||||||||||||||||||||||||||||||
| 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}
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}
| |||||||||||||||||||||||||||||||||
| 21 | 70 | ▶ | if (ref($new->{$arg_name})) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||||||