blib/lib/Config/Model/Role/WarpSubject.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 83.3% 5 / 6 Conditioncond 80.0% 4 / 5 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 92.3% 48 / 52 CC 8 SCAR 16.8
CC
8
Cov
93%
merge_properties
8.1
BEGIN
1.0
BEGIN
1.0
CRAP 5.4
« blib/lib/Config/Model/BackendTrackOrder.pm ↑ Summary blib/lib/Config/Model/TreeSearcher.pm »
1 #
2 # This file is part of Config-Model
3 #
4 # This software is Copyright (c) 2005-2022 by Dominique Dumont.
5 #
6 # This is free software, licensed under:
7 #
8 # The GNU Lesser General Public License, Version 2.1, February 1999
9 #
10 package Config::Model::Role::WarpSubject 2.169;
11  
12 # ABSTRACT: common methods for a warped element
13  
14 59 ▶use Mouse::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 59 ▶use Mouse::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 59 ▶use feature qw/postderef signatures/;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 59 ▶no warnings qw/experimental::postderef experimental::signatures/;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 59 requires 'backup', 'allowed_warp_params';
21  
22 59 ▶use Log::Log4perl qw(get_logger :levels);
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 59 my $logger = get_logger("WarpSubject");
25  
26 5632 ▶sub merge_properties($self, %raw_args) {
Subroutine merge_properties: called CC=8 SCAR=20.9
Pod documented
27 5632 ▶ my %args = %{ $self->backup // {} };
Condition50%1/2
$self->backup // {}
l!l
56320
MC/DC0%0/1
$self->backup // {}
$self->backup
Truth table50%1/2
A
A= $self->backup
Aresult
11
00
28 5632 for my $p ( $self->allowed_warp_params() ) {
29 # cleanup all parameters that are handled by warp
30 106795 delete $self->{$p};
31  
32 106795 ▶ next unless exists $raw_args{$p};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $raw_args{$p} 106356 439 106795
33  
34 439 my $new = $raw_args{$p};
35  
36 439 ▶ if (defined $args{$p} and ref $args{$p} eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{$p} and ref $args{$p} eq 'HASH') { } 23 416 439
Condition100%3/3
defined $args{$p} and ref $args{$p} eq "HASH"
!ll&&!rl&&r
3308623
MC/DC100%2/2
defined $args{$p} and ref $args{$p} eq "HASH"
defined $args{$p} ref $args{$p} eq "HASH"
Truth table100%3/3
A and B
A= defined $args{$p}B= ref $args{$p} eq "HASH"
ABresult
0X0
100
111
37 23 ▶ if (ref $new eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $new eq 'HASH') { } 23 0 23
38 23 for my $sub_p (keys $new->%*) {
39 23 $args{$p}{$sub_p} = $new->{$sub_p};
40 }
41 }
42 else {
43 0 Config::Model::Exception::Model->throw(
44 object => $self,
45 error => "property $p is not a HASH ref"
46 );
47 }
48 }
49 else {
50 416 $args{$p} = $new;
51 }
52 }
53  
54 5632 return %args;
55 }
56  
57 59 1;
58  
59 __END__
« blib/lib/Config/Model/BackendTrackOrder.pm ↑ Summary blib/lib/Config/Model/TreeSearcher.pm »