Color/Space/Basis.pm

filter: Statementstmt 98.3% 119 / 121 Branchbran 84.1% 69 / 82 Conditioncond 75.0% 45 / 60 MC/DCmcdc 48.6% 18 / 37 Subroutinesub 97.1% 34 / 35 Podpod 0.0% 0 / 31 totaltotal 77.8% 285 / 366 CC 66 SCAR 19.9
CC
66
Cov
89%
new
22.1
is_partial_hash
9.0
space_name
7.2
CRAP 7.3
« Color/Space/Instance/HWB.pm ↑ Summary Color/Space/Instance/NCol.pm »
1  
2 # count and names of color space axis (short and long), space name = usr | prefix + axis initials
3  
4 package Graphics::Toolkit::Color::Space::Basis;
5 52 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 52 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 52 ▶use Graphics::Toolkit::Color::Space::Util qw/is_nr/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 52 ▶use Graphics::Toolkit::Color::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 547 ▶sub new {
Subroutine new: called CC=20 SCAR=31.0
Pod undocumented
11 547 my ($pkg, $axis_long_names, $axis_short_names, $space_name, $alias_name, $family, $axis_role_names) = @_;
12 547 ▶ return 'first argument (axis names) has to be an ARRAY reference' unless ref $axis_long_names eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $axis_long_names eq "ARRAY" 3 544 547
13 544 ▶ return 'amount of short axis names have to match the count of long axis names'
Branch: 1 branch
BranchTrueFalseTotal
if defined $axis_short_names and ref $axis_short_names ne "ARRAY" || @$axis_long_names != @$axis_short_names 1 543 544
Condition83%5/6
defined $axis_short_names and ref $axis_short_names ne "ARRAY" || @$axis_long_names != @$axis_short_names
!ll&&!rl&&r
507361
ref $axis_short_names ne "ARRAY" or @$axis_long_names != @$axis_short_names
l!l&&r!l&&!r
0136
MC/DC66%2/3
defined $axis_short_names and ref $axis_short_names ne "ARRAY" || @$axis_long_names != @$axis_short_names
defined $axis_short_names ref $axis_short_names ne "ARRAY" @$axis_long_names != @$axis_short_names
Truth table75%3/4
A and B or C
A= defined $axis_short_namesB= ref $axis_short_names ne "ARRAY"C= @$axis_long_names != @$axis_short_names
ABCresult
0XX0
1000
11X1
1011
14 if defined $axis_short_names and (ref $axis_short_names ne 'ARRAY' or @$axis_long_names != @$axis_short_names);
15  
16 543 my @axis_long_name = map {lc} @$axis_long_names;
17 543 ▶ my @axis_short_name = map { color_key_shortcut($_) } (defined $axis_short_names) ? @$axis_short_names : @axis_long_name;
Branch: 1 branch
BranchTrueFalseTotal
defined $axis_short_names ? : 36 507 543
18 543 ▶ return 'need some axis names to create a color space' unless @axis_long_name > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless @axis_long_name > 0 0 543 543
19 543 ▶ return 'need same amount of axis short names and long names' unless @axis_long_name == @axis_short_name;
Branch: 1 branch
BranchTrueFalseTotal
unless @axis_long_name == @axis_short_name 0 543 543
20 543 ▶ return 'space family dan only be a string' if defined $family and ref $family;
Branch: 1 branch
BranchTrueFalseTotal
if defined $family and ref $family 0 543 543
Condition66%2/3
defined $family and ref $family
!ll&&!rl&&r
474960
MC/DC0%0/2
defined $family and ref $family
defined $family ref $family
Truth table66%2/3
A and B
A= defined $familyB= ref $family
ABresult
0X0
100
111
21 543 ▶ return 'axis role description has to be provided with a family name' if defined($axis_role_names) and not defined($family);
Branch: 1 branch
BranchTrueFalseTotal
if defined $axis_role_names and not defined $family 0 543 543
Condition66%2/3
defined $axis_role_names and not defined $family
!ll&&!rl&&r
3991440
MC/DC0%0/2
defined $axis_role_names and not defined $family
defined $axis_role_names not defined $family
Truth table66%2/3
A and not(B)
A= defined $axis_role_namesB= not defined $family
ABresult
0X0
100
111
22 543 ▶ return 'axis role description has to have same length as axis names'
Branch: 1 branch
BranchTrueFalseTotal
if defined $axis_role_names and ref $axis_role_names ne "ARRAY" || @$axis_role_names != @$axis_long_names 0 543 543
Condition50%3/6
defined $axis_role_names and ref $axis_role_names ne "ARRAY" || @$axis_role_names != @$axis_long_names
!ll&&!rl&&r
3991440
ref $axis_role_names ne "ARRAY" or @$axis_role_names != @$axis_long_names
l!l&&r!l&&!r
00144
MC/DC0%0/3
defined $axis_role_names and ref $axis_role_names ne "ARRAY" || @$axis_role_names != @$axis_long_names
defined $axis_role_names ref $axis_role_names ne "ARRAY" @$axis_role_names != @$axis_long_names
Truth table50%2/4
A and B or C
A= defined $axis_role_namesB= ref $axis_role_names ne "ARRAY"C= @$axis_role_names != @$axis_long_names
ABCresult
0XX0
1000
11X1
1011
23 if defined $axis_role_names and (ref $axis_role_names ne 'ARRAY' or @$axis_role_names != @$axis_long_names);
24  
25 543 my @iterator = 0 .. $#axis_long_name;
26 543 my %long_name_order = map { $axis_long_name[$_] => $_ } @iterator;
27 543 my %short_name_order = map { $axis_short_name[$_] => $_ } @iterator;
28 543 my $axis_initials = uc join( '', @axis_short_name );
29 543 ▶ $space_name //= $axis_initials;
Condition66%2/3
$space_name //= $axis_initials
l!l&&r!l&&!r
3571860
MC/DC0%0/2
$space_name //= $axis_initials
$space_name $axis_initials
Truth table66%2/3
A //= B
A= $space_nameB= $axis_initials
ABresult
1X1
011
000
30 543 ▶ $alias_name //= '';
Condition100%2/2
$alias_name //= ""
l!l
261282
MC/DC100%1/1
$alias_name //= ""
$alias_name
Truth table100%2/2
A
A= $alias_name
Aresult
11
00
31  
32 543 my %role_name_order;
33 543 ▶ %role_name_order = map { $axis_role_names->[$_] => $_ } @iterator if defined $axis_role_names;
Branch: 1 branch
BranchTrueFalseTotal
if defined $axis_role_names 144 399 543
34  
35 543 ▶ bless { space_name => $space_name, alias_name => $alias_name,
Condition100%4/4
$family // ""
l!l
49647
$axis_role_names // []
l!l
144399
MC/DC100%1/1
$family // ""
$family
MC/DC100%1/1
$axis_role_names // []
$axis_role_names
Truth table100%2/2
A
A= $family
Aresult
11
00
Truth table100%2/2
A
A= $axis_role_names
Aresult
11
00
36 normal_name => normalize_name('',$space_name), normal_alias => normalize_name('',$alias_name),
37 space_family_name => $family // '',
38 axis_long_name => \@axis_long_name, long_name_order => \%long_name_order,
39 axis_short_name => \@axis_short_name, short_name_order => \%short_name_order,
40 axis_role_name => $axis_role_names // [], role_name_order => \%role_name_order,
41 axis_iterator => \@iterator,
42 }
43 }
44 1657 ▶sub color_key_shortcut { lc substr($_[0], 0, 1) if defined $_[0] }
Subroutine color_key_shortcut: called CC=2 SCAR=7.6
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0] 1657 0 1657
45  
46 #### getter ############################################################
47 8038 ▶sub space_name { # -- ?alias ?given --> ~
Subroutine space_name: called CC=7 SCAR=19.7
Pod undocumented
48 8038 my ($self, $alias, $given) = @_;
49 8038 ▶ $given = undef if defined $given and not $given;
Branch: 1 branch
BranchTrueFalseTotal
if defined $given and not $given 0 8038 8038
Condition66%2/3
defined $given and not $given
!ll&&!rl&&r
7970680
MC/DC0%0/2
defined $given and not $given
defined $given not $given
Truth table66%2/3
A and not(B)
A= defined $givenB= not $given
ABresult
0X0
100
111
50 8038 ▶ if (defined $alias and $alias ){ return defined( $given ) ? $self->{'alias_name'} : $self->{'normal_alias'} }
Branch: 2 branches
BranchTrueFalseTotal
if (defined $alias and $alias) { } 545 7493 8038
defined $given ? : 6 539 545
Condition66%2/3
defined $alias and $alias
!ll&&!rl&&r
74930545
MC/DC50%1/2
defined $alias and $alias
defined $alias $alias
Truth table66%2/3
A and B
A= defined $aliasB= $alias
ABresult
0X0
100
111
51 7493 ▶ else { return defined( $given ) ? $self->{'space_name'} : $self->{'normal_name'} }
Branch: 1 branch
BranchTrueFalseTotal
defined $given ? : 62 7431 7493
52 }
53 990 ▶sub family { $_[0]{'space_family_name'}} #
Subroutine family: called CC=1 SCAR=0.0
Pod undocumented
54 312 ▶sub long_axis_names { @{$_[0]{'axis_long_name'}} } #
Subroutine long_axis_names: called CC=1 SCAR=0.0
Pod undocumented
55 9 ▶sub short_axis_names { @{$_[0]{'axis_short_name'}} } #
Subroutine short_axis_names: called CC=1 SCAR=0.0
Pod undocumented
56 0 ▶sub axis_role_names { @{$_[0]{'axis_role_name'}} } #
Subroutine axis_role_names: not called CC=1 SCAR=6.9
Pod undocumented
57 12490 ▶sub axis_iterator { @{$_[0]{'axis_iterator'}} } # counting all axis 0 .. -1
Subroutine axis_iterator: called CC=1 SCAR=0.0
Pod undocumented
58 19205 ▶sub axis_count { int @{$_[0]{'axis_iterator'}} } #
Subroutine axis_count: called CC=1 SCAR=0.0
Pod undocumented
59  
60 #### predicates ########################################################
61 3452 ▶sub is_name { # --> ? # is this a valid name of this space
Subroutine is_name: called CC=5 SCAR=16.1
Pod undocumented
62 3452 my ($self, $name) = @_;
63 3452 ▶ return 0 unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 1024 2428 3452
64 2428 $name = $self->normalize_name( $name );
65 2428 ▶ return 1 if $name eq $self->{'normal_name'};
Branch: 1 branch
BranchTrueFalseTotal
if $name eq $self->{"normal_name"} 180 2248 2428
66 2248 ▶ return 1 if $self->{'alias_name'} and $name eq $self->{'normal_alias'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"alias_name"} and $name eq $self->{"normal_alias"} 40 2208 2248
Condition100%3/3
$self->{"alias_name"} and $name eq $self->{"normal_alias"}
!ll&&!rl&&r
1120108840
MC/DC100%2/2
$self->{"alias_name"} and $name eq $self->{"normal_alias"}
$self->{"alias_name"} $name eq $self->{"normal_alias"}
Truth table100%3/3
A and B
A= $self->{"alias_name"}B= $name eq $self->{"normal_alias"}
ABresult
0X0
100
111
67 2208 return 0;
68 }
69 19725 ▶sub normalize_name {
Subroutine normalize_name: called CC=2 SCAR=7.0
Pod undocumented
70 19725 my ($self, $name) = @_;
71 19725 ▶ return $name unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 19725 19725
72 19725 $name = uc $name;
73 19725 $name =~ tr/_ .-//d; # '-' has to be last
74 19725 return $name;
75 }
76  
77 1555 ▶sub is_long_axis_name { (defined $_[1] and exists $_[0]->{'long_name_order'}{ lc $_[1] }) ? 1 : 0 } # ~long_name --> ?
Subroutine is_long_axis_name: called CC=3 SCAR=11.1
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] && exists $_[0]{'long_name_order'}{lc $_[1]} ? : 446 1109 1555
Condition66%2/3
defined $_[1] and exists $_[0]{"long_name_order"}{lc $_[1]}
!ll&&!rl&&r
01109446
MC/DC50%1/2
defined $_[1] and exists $_[0]{"long_name_order"}{lc $_[1]}
defined $_[1] exists $_[0]{"long_name_order"}{lc $_[1]}
Truth table66%2/3
A and B
A= defined $_[1]B= exists $_[0]{"long_name_order"}{lc $_[1]}
ABresult
0X0
100
111
78 1114 ▶sub is_short_axis_name { (defined $_[1] and exists $_[0]->{'short_name_order'}{ lc $_[1] }) ? 1 : 0 } # ~short_name --> ?
Subroutine is_short_axis_name: called CC=3 SCAR=11.1
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] && exists $_[0]{'short_name_order'}{lc $_[1]} ? : 413 701 1114
Condition66%2/3
defined $_[1] and exists $_[0]{"short_name_order"}{lc $_[1]}
!ll&&!rl&&r
0701413
MC/DC50%1/2
defined $_[1] and exists $_[0]{"short_name_order"}{lc $_[1]}
defined $_[1] exists $_[0]{"short_name_order"}{lc $_[1]}
Truth table66%2/3
A and B
A= defined $_[1]B= exists $_[0]{"short_name_order"}{lc $_[1]}
ABresult
0X0
100
111
79 28 ▶sub is_axis_role_name { (defined $_[1] and exists $_[0]->{'role_name_order'}{ lc $_[1] }) ? 1 : 0 } # ~role_name --> ?
Subroutine is_axis_role_name: called CC=3 SCAR=14.2
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] && exists $_[0]{'role_name_order'}{lc $_[1]} ? : 0 28 28
Condition33%1/3
defined $_[1] and exists $_[0]{"role_name_order"}{lc $_[1]}
!ll&&!rl&&r
0280
MC/DC0%0/2
defined $_[1] and exists $_[0]{"role_name_order"}{lc $_[1]}
defined $_[1] exists $_[0]{"role_name_order"}{lc $_[1]}
Truth table33%1/3
A and B
A= defined $_[1]B= exists $_[0]{"role_name_order"}{lc $_[1]}
ABresult
0X0
100
111
80 1547 ▶sub is_axis_name { $_[0]->is_long_axis_name($_[1]) or $_[0]->is_short_axis_name($_[1]) } # ~long|short --> ?
Subroutine is_axis_name: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->is_long_axis_name($_[1]) or $_[0]->is_short_axis_name($_[1]) 441 1106 1547
81 28 ▶sub is_axis_role { $_[0]->is_axis_role_name($_[1]) or $_[0]->is_axis_name($_[1]) } # ~name --> ?
Subroutine is_axis_role: called CC=2 SCAR=7.6
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->is_axis_role_name($_[1]) or $_[0]->is_axis_name($_[1]) 0 28 28
82  
83 1141 ▶sub pos_from_long_axis_name { defined $_[1] ? $_[0]->{'long_name_order'}{ lc $_[1] } : undef } # ~long_name --> +pos
Subroutine pos_from_long_axis_name: called CC=2 SCAR=7.6
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] ? : 1141 0 1141
84 564 ▶sub pos_from_short_axis_name { defined $_[1] ? $_[0]->{'short_name_order'}{ lc $_[1] } : undef } # ~short_name --> +pos
Subroutine pos_from_short_axis_name: called CC=2 SCAR=7.6
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] ? : 564 0 564
85 88 ▶sub pos_from_axis_role_name { defined $_[1] ? $_[0]->{'role_name_order'}{ lc $_[1] } : undef } # ~role_name --> +pos
Subroutine pos_from_axis_role_name: called CC=2 SCAR=7.6
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] ? : 88 0 88
86 495 ▶sub pos_from_axis_name { pos_from_long_axis_name(@_) // pos_from_short_axis_name(@_) } # ~long|short --> +pos
Subroutine pos_from_axis_name: called CC=2 SCAR=6.9
Pod undocumented
Condition100%3/3
pos_from_long_axis_name(@_) // pos_from_short_axis_name(@_)
l!l&&r!l&&!r
26019936
MC/DC100%2/2
pos_from_long_axis_name(@_) // pos_from_short_axis_name(@_)
pos_from_long_axis_name(@_) pos_from_short_axis_name(@_)
Truth table100%3/3
A // B
A= pos_from_long_axis_name(@_)B= pos_from_short_axis_name(@_)
ABresult
1X1
011
000
87 88 ▶sub pos_from_axis_role { pos_from_axis_role_name(@_) // pos_from_axis_name(@_) } # ~name --> +pos
Subroutine pos_from_axis_role: called CC=2 SCAR=7.2
Pod undocumented
Condition66%2/3
pos_from_axis_role_name(@_) // pos_from_axis_name(@_)
l!l&&r!l&&!r
0835
MC/DC50%1/2
pos_from_axis_role_name(@_) // pos_from_axis_name(@_)
pos_from_axis_role_name(@_) pos_from_axis_name(@_)
Truth table66%2/3
A // B
A= pos_from_axis_role_name(@_)B= pos_from_axis_name(@_)
ABresult
1X1
011
000
88  
89 2355 ▶sub is_hash { # with all axis names as keys
Subroutine is_hash: called CC=2 SCAR=6.9
Pod undocumented
90 2355 my ($self, $value_hash) = @_;
91 2355 ▶ $self->is_partial_hash( $value_hash ) and (keys %$value_hash == $self->axis_count);
Branch: 1 branch
BranchTrueFalseTotal
$self->is_partial_hash($value_hash) and keys %$value_hash == $self->axis_count 111 2244 2355
92 }
93 2849 ▶sub is_partial_hash { # with some axis names as keys
Subroutine is_partial_hash: called CC=9 SCAR=22.0
Pod undocumented
94 2849 my ($self, $value_hash) = @_;
95 2849 ▶ return 0 unless ref $value_hash eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value_hash eq "HASH" 1815 1034 2849
96 1034 my $key_count = keys %$value_hash;
97 1034 my @axis_visited;
98 1034 ▶ return 0 unless $key_count and $key_count <= $self->axis_count;
Branch: 1 branch
BranchTrueFalseTotal
unless $key_count and $key_count <= $self->axis_count 177 857 1034
Condition100%3/3
$key_count and $key_count <= $self->axis_count
!ll&&!rl&&r
36141857
MC/DC100%2/2
$key_count and $key_count <= $self->axis_count
$key_count $key_count <= $self->axis_count
Truth table100%3/3
A and B
A= $key_countB= $key_count <= $self->axis_count
ABresult
0X0
100
111
99 857 for my $axis_name (keys %$value_hash) {
100 1263 ▶ return 0 unless $self->is_axis_name( $axis_name ) and defined $value_hash->{$axis_name};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_axis_name($axis_name) and defined $value_hash->{$axis_name} 626 637 1263
Condition66%2/3
$self->is_axis_name($axis_name) and defined $value_hash->{$axis_name}
!ll&&!rl&&r
6260637
MC/DC50%1/2
$self->is_axis_name($axis_name) and defined $value_hash->{$axis_name}
$self->is_axis_name($axis_name) defined $value_hash->{$axis_name}
Truth table66%2/3
A and B
A= $self->is_axis_name($axis_name)B= defined $value_hash->{$axis_name}
ABresult
0X0
100
111
101 637 my $axis_pos = $self->pos_from_long_axis_name( $axis_name );
102 637 ▶ $axis_pos = $self->pos_from_short_axis_name( $axis_name ) unless defined $axis_pos;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $axis_pos 320 317 637
103 637 $axis_visited[ $axis_pos ]++;
104 637 ▶ return 0 if $axis_visited[ $axis_pos ] > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $axis_visited[$axis_pos] > 1 12 625 637
105 }
106 219 return 1;
107 }
108 10447 ▶sub is_value_tuple { (ref $_[1] eq 'ARRAY' and @{$_[1]} == $_[0]->axis_count) ? 1 : 0 }
Subroutine is_value_tuple: called CC=3 SCAR=11.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
ref $_[1] eq 'ARRAY' && @{$_[1];} == $_[0]->axis_count ? : 8195 2252 10447
Condition100%3/3
ref $_[1] eq "ARRAY" and @{$_[1];} == $_[0]->axis_count
!ll&&!rl&&r
115510978195
MC/DC100%2/2
ref $_[1] eq "ARRAY" and @{$_[1];} == $_[0]->axis_count
ref $_[1] eq "ARRAY" @{$_[1];} == $_[0]->axis_count
Truth table100%3/3
A and B
A= ref $_[1] eq "ARRAY"B= @{$_[1];} == $_[0]->axis_count
ABresult
0X0
100
111
109 2398 ▶sub is_number_tuple {
Subroutine is_number_tuple: called CC=3 SCAR=11.0
Pod undocumented
110 2398 my ($self, $tuple) = @_;
111 2398 ▶ return 0 unless $self->is_value_tuple( $tuple );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_value_tuple($tuple) 9 2389 2398
112 2389 ▶ map { return 0 unless is_nr( $tuple->[$_] ) } $self->axis_iterator;
Branch: 1 branch
BranchTrueFalseTotal
unless is_nr($tuple->[$_]) 4 7205 7209
113 2385 return 1;
114 }
115  
116 #### converter #########################################################
117 4 ▶sub short_axis_name_from_long {
Subroutine short_axis_name_from_long: called CC=2 SCAR=6.9
Pod undocumented
118 4 my ($self, $name) = @_;
119 4 ▶ return unless $self->is_long_axis_name( $name );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_long_axis_name($name) 1 3 4
120 3 ($self->short_axis_names)[ $self->pos_from_long_axis_name( $name ) ];
121 }
122 4 ▶sub long_axis_name_from_short {
Subroutine long_axis_name_from_short: called CC=2 SCAR=6.9
Pod undocumented
123 4 my ($self, $name) = @_;
124 4 ▶ return unless $self->is_short_axis_name( $name );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_short_axis_name($name) 1 3 4
125 3 ($self->long_axis_names)[ $self->pos_from_short_axis_name( $name ) ];
126 }
127  
128 13 ▶sub long_name_hash_from_tuple {
Subroutine long_name_hash_from_tuple: called CC=2 SCAR=6.9
Pod undocumented
129 13 my ($self, $tuple) = @_;
130 13 ▶ return unless $self->is_value_tuple( $tuple );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_value_tuple($tuple) 2 11 13
131 11 return { map { $self->{'axis_long_name'}[$_] => $tuple->[$_]} $self->axis_iterator };
132 }
133 10 ▶sub short_name_hash_from_tuple {
Subroutine short_name_hash_from_tuple: called CC=2 SCAR=6.9
Pod undocumented
134 10 my ($self, $tuple) = @_;
135 10 ▶ return unless $self->is_value_tuple( $tuple );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_value_tuple($tuple) 2 8 10
136 8 return { map {$self->{'axis_short_name'}[$_] => $tuple->[$_]} $self->axis_iterator };
137 }
138  
139 39 ▶sub tuple_from_hash {
Subroutine tuple_from_hash: called CC=3 SCAR=11.0
Pod undocumented
140 39 my ($self, $value_hash) = @_;
141 39 ▶ return unless $self->is_hash( $value_hash );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_hash($value_hash) 1 38 39
142 38 my $values = [ (0) x $self->axis_count ];
143 38 for my $key (keys %$value_hash) {
144 120 $values->[ $self->pos_from_axis_name( $key ) ] = $value_hash->{ $key };
145 }
146 38 return $values;
147 }
148 387 ▶sub tuple_from_partial_hash {
Subroutine tuple_from_partial_hash: called CC=3 SCAR=11.0
Pod undocumented
149 387 my ($self, $value_hash) = @_;
150 387 ▶ return unless $self->is_partial_hash( $value_hash );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_partial_hash($value_hash) 350 37 387
151 37 my $values = [];
152 37 for my $key (keys %$value_hash) {
153 57 $values->[ $self->pos_from_axis_name( $key ) ] = $value_hash->{ $key };
154 }
155 37 return $values;
156 }
157  
158 52 1;
« Color/Space/Instance/HWB.pm ↑ Summary Color/Space/Instance/NCol.pm »