| 1 | package Rose::Class::MakeMethods::Generic; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Carp(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | our $VERSION = '0.854'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use Rose::Object::MakeMethods; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | our @ISA = qw(Rose::Object::MakeMethods); | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | our %Scalar; | |||||||||||||||||||||||||||||||||||||||||
| 13 | # ( | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # class_name => | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # some_attr_name1 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # some_attr_name2 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # ); | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | sub scalar | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scalar: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | my($class, $name, $args, $options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 7 | my %methods; | |||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 7 | ▶ | my $interface = $args->{'interface'} || 'get_set'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'interface'} || 'get_set'
MC/DC100%1/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table100%2/2
A
A= $args->{'interface'}
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 7 | ▶ | if($interface eq 'get_set') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | { | ||||||||||||||||||||||||||||||||||||||||||
| 33 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 13 | ▶ | return $Scalar{$_[0]}{$name} = $_[1] if(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 8 | return $Scalar{$_[0]}{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | }; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | elsif($interface eq 'get_set_init') | ||||||||||||||||||||||||||||||||||||||||||
| 40 | { | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | ▶ | my $init_method = $args->{'init_method'} || "init_$name"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'init_method'} || "init_$name"
MC/DC0%0/1
$args->{'init_method'} || "init_$name"
$args->{'init_method'}
Truth table50%1/2
A
A= $args->{'init_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 12 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 12 | ▶ | return $Scalar{$_[0]}{$name} = $_[1] if(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | return defined $Scalar{$_[0]}{$name} ? | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 8 | ▶ | $Scalar{$_[0]}{$name} : ($Scalar{$_[0]}{$name} = $_[0]->$init_method()) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 7 | return \%methods; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 3 | our %Inheritable_Scalar; | |||||||||||||||||||||||||||||||||||||||||
| 55 | # ( | ||||||||||||||||||||||||||||||||||||||||||
| 56 | # class_name => | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | # some_attr_name1 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 59 | # some_attr_name2 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 60 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 61 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 62 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 63 | # ); | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | sub inheritable_scalar | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inheritable_scalar: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | my($class, $name, $args, $options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | my %methods; | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | ▶ | my $interface = $args->{'interface'} || 'get_set'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'interface'} || 'get_set'
MC/DC0%0/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table50%1/2
A
A= $args->{'interface'}
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | ▶ | if($interface eq 'get_set') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | { | ||||||||||||||||||||||||||||||||||||||||||
| 75 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 34 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 34 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 34 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | { | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 6 | return $Inheritable_Scalar{$class}{$name} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | return $Inheritable_Scalar{$class}{$name} | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 28 | ▶ | if(exists $Inheritable_Scalar{$class}{$name}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 16 | my @parents = ($class); | |||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 16 | ▶ | while(my $parent = shift(@parents)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | { | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 26 | foreach my $subclass (@{$parent . '::ISA'}) | |||||||||||||||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 26 | push(@parents, $subclass); | |||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 26 | ▶ | if(exists $Inheritable_Scalar{$subclass}{$name}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 16 | return $Inheritable_Scalar{$subclass}{$name} | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | else { Carp::croak "Unknown interface: $interface" } | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 2 | return \%methods; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 3 | our %Inheritable_Boolean; | |||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | sub inheritable_boolean | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inheritable_boolean: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 4 | my($class, $name, $args, $options) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 4 | my %methods; | |||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 4 | ▶ | my $interface = $args->{'interface'} || 'get_set'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'interface'} || 'get_set'
MC/DC0%0/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table50%1/2
A
A= $args->{'interface'}
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 4 | ▶ | if($interface eq 'get_set') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | { | ||||||||||||||||||||||||||||||||||||||||||
| 123 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 82 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 82 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 82 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | { | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 18 | ▶ | return $Inheritable_Boolean{$class}{$name} = $_[0] ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | return $Inheritable_Boolean{$class}{$name} | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 64 | ▶ | if(exists $Inheritable_Boolean{$class}{$name}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 34 | my @parents = ($class); | |||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 34 | ▶ | while(my $parent = shift(@parents)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | { | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 54 | foreach my $subclass (@{$parent . '::ISA'}) | |||||||||||||||||||||||||||||||||||||||||
| 141 | { | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 48 | push(@parents, $subclass); | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 48 | ▶ | if(exists $Inheritable_Boolean{$subclass}{$name}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | { | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 28 | return $Inheritable_Boolean{$subclass}{$name} | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 6 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | else { Carp::croak "Unknown interface: $interface" } | |||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 4 | return \%methods; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 3 | our %Hash; | |||||||||||||||||||||||||||||||||||||||||
| 160 | # ( | ||||||||||||||||||||||||||||||||||||||||||
| 161 | # class_name => | ||||||||||||||||||||||||||||||||||||||||||
| 162 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 163 | # key => | ||||||||||||||||||||||||||||||||||||||||||
| 164 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | # some_attr_name1 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 166 | # some_attr_name2 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 167 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 168 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 169 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 170 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 172 | # ); | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | sub hash | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hash: called CC=13 SCAR=29.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 14 | my($class, $name, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 14 | my %methods; | |||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 14 | ▶ | my $key = $args->{'hash_key'} || $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$args->{'hash_key'} || $name
MC/DC0%0/2
$args->{'hash_key'} || $name
$args->{'hash_key'}
$name
Truth table66%2/3
A || B
A= $args->{'hash_key'}B= $name
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 14 | ▶ | my $interface = $args->{'interface'} || 'get_set'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'interface'} || 'get_set'
MC/DC100%1/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table100%2/2
A
A= $args->{'interface'}
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 14 | ▶ | if($interface eq 'get_set_all') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | { | ||||||||||||||||||||||||||||||||||||||||||
| 185 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=11 SCAR=25.6
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 10 | ▶ | my($class) = ref $_[0] ? ref shift : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | # If called with no arguments, return hash contents | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 10 | ▶ | return wantarray ? %{$Hash{$class}{$key} || {}} : $Hash{$class}{$key} unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key} || {}
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key}
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Hash{$class}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | # Set hash to arguments | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 4 | ▶ | if(@_ == 1 && ref $_[0] eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC50%1/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 2 | $Hash{$class}{$key} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | else | ||||||||||||||||||||||||||||||||||||||||||
| 198 | { | ||||||||||||||||||||||||||||||||||||||||||
| 199 | # Push on new values and return complete set | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 2 | ▶ | Carp::croak "Odd number of items in assigment to $name" if(@_ % 2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 2 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | { | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 4 | local $_ = shift; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 4 | $Hash{$class}{$key}{$_} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | return wantarray ? %{$Hash{$class}{$key} || {}} : $Hash{$class}{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key} || {}
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key}
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Generic::Hash{$class}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 212 | elsif($interface eq 'clear') | ||||||||||||||||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $Hash{$_[0]}{$key} = {} | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 219 | elsif($interface eq 'reset') | ||||||||||||||||||||||||||||||||||||||||||
| 220 | { | ||||||||||||||||||||||||||||||||||||||||||
| 221 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $Hash{$_[0]}{$key} = undef | |||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 226 | elsif($interface eq 'delete') | ||||||||||||||||||||||||||||||||||||||||||
| 227 | { | ||||||||||||||||||||||||||||||||||||||||||
| 228 | $methods{($interface eq 'manip' ? 'delete_' : '') . $name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 2 | ▶ | Carp::croak "Missing key(s) to delete" unless(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 2 | delete @{$Hash{$_[0]}{$key}}{@_[1 .. $#_]}; | |||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 2 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | elsif($interface eq 'exists') | ||||||||||||||||||||||||||||||||||||||||||
| 235 | { | ||||||||||||||||||||||||||||||||||||||||||
| 236 | $methods{$name . ($interface eq 'manip' ? '_exists' : '')} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | ▶ | Carp::croak "Missing key argument" unless(@_ == 2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 2 | ▶ | defined $Hash{$_[0]}{$key} ? exists $Hash{$_[0]}{$key}{$_[1]} : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 2 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | elsif($interface =~ /^(?:keys|names)$/) | ||||||||||||||||||||||||||||||||||||||||||
| 243 | { | ||||||||||||||||||||||||||||||||||||||||||
| 244 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=19.1
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 4 | ▶ | wantarray ? (defined $Hash{$_[0]}{$key} ? keys %{$Hash{$_[0]}{$key}} : ()) : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | (defined $Hash{$_[0]}{$key} ? [ keys %{$Hash{$_[0]}{$key}} ] : []); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 250 | elsif($interface eq 'values') | ||||||||||||||||||||||||||||||||||||||||||
| 251 | { | ||||||||||||||||||||||||||||||||||||||||||
| 252 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 253 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=19.1
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 4 | ▶ | wantarray ? (defined $Hash{$_[0]}{$key} ? values %{$Hash{$_[0]}{$key}} : ()) : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | (defined $Hash{$_[0]}{$key} ? [ values %{$Hash{$_[0]}{$key}} ] : []); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 258 | elsif($interface eq 'get_set') | ||||||||||||||||||||||||||||||||||||||||||
| 259 | { | ||||||||||||||||||||||||||||||||||||||||||
| 260 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=13 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 4 | ▶ | my($class) = ref $_[0] ? ref shift : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | # If called with no arguments, return hash contents | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 4 | ▶ | unless(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | { | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | return wantarray ? (defined $Hash{$class}{$key} ? %{$Hash{$class}{$key}} : ()) : $Hash{$class}{$key} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | # If called with a hash ref, set value | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 4 | ▶ | if(@_ == 1 && ref $_[0] eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | { | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | $Hash{$class}{$key} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | else | ||||||||||||||||||||||||||||||||||||||||||
| 276 | { | ||||||||||||||||||||||||||||||||||||||||||
| 277 | # If called with an index, get that value, or a slice for array refs | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 4 | ▶ | if(@_ == 1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | { | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | return ref $_[0] eq 'ARRAY' ? @{$Hash{$class}{$key}}{@{$_[0]}} : | |||||||||||||||||||||||||||||||||||||||||
| 281 | 2 | ▶ | $Hash{$class}{$key}{$_[0]}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | # Push on new values and return complete set | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 2 | ▶ | Carp::croak "Odd number of items in assigment to $name" if(@_ % 2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 2 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | { | ||||||||||||||||||||||||||||||||||||||||||
| 289 | 4 | local $_ = shift; | |||||||||||||||||||||||||||||||||||||||||
| 290 | 4 | $Hash{$class}{$key}{$_} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | return wantarray ? %{$Hash{$class}{$key} || {}} : $Hash{$class}{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key} || {}
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key}
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Generic::Hash{$class}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | else { Carp::croak "Unknown interface: $interface" } | |||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 14 | return \%methods; | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 3 | our %Inheritable_Hash; | |||||||||||||||||||||||||||||||||||||||||
| 302 | # ( | ||||||||||||||||||||||||||||||||||||||||||
| 303 | # class_name => | ||||||||||||||||||||||||||||||||||||||||||
| 304 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 305 | # key => | ||||||||||||||||||||||||||||||||||||||||||
| 306 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 307 | # some_attr_name1 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # some_attr_name2 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 309 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 310 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 311 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 312 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 313 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 314 | # ); | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | sub inheritable_hash | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inheritable_hash: called CC=13 SCAR=28.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 16 | my($class, $name, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 16 | my %methods; | |||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 16 | ▶ | my $key = $args->{'hash_key'} || $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$args->{'hash_key'} || $name
MC/DC0%0/2
$args->{'hash_key'} || $name
$args->{'hash_key'}
$name
Truth table66%2/3
A || B
A= $args->{'hash_key'}B= $name
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 16 | ▶ | my $interface = $args->{'interface'} || 'get_set'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'interface'} || 'get_set'
MC/DC100%1/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table100%2/2
A
A= $args->{'interface'}
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | my $init_method = sub | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 14 | ▶ | my($class) = ref $_[0] ? ref shift : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | # Inherit shallow copy from subclass | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 14 | my @parents = ($class); | |||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 14 | ▶ | SEARCH: while(my $parent = shift(@parents)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | { | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 14 | foreach my $subclass (@{$parent . '::ISA'}) | |||||||||||||||||||||||||||||||||||||||||
| 336 | { | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 10 | push(@parents, $subclass); | |||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 10 | ▶ | if(exists $Inheritable_Hash{$subclass}{$key}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | { | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 10 | $Inheritable_Hash{$class}{$key} = { %{$Inheritable_Hash{$subclass}{$key}} }; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 10 | last SEARCH; | |||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 16 | }; | |||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 16 | ▶ | if($interface eq 'get_set_all') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | { | ||||||||||||||||||||||||||||||||||||||||||
| 350 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=26.2
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 10 | ▶ | my($class) = ref $_[0] ? ref shift : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 10 | ▶ | defined $Inheritable_Hash{$class}{$key} || $init_method->($class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | # If called with no arguments, return hash contents | ||||||||||||||||||||||||||||||||||||||||||
| 357 | 10 | ▶ | return wantarray ? %{$Inheritable_Hash{$class}{$key} || {}} : $Inheritable_Hash{$class}{$key} unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key}
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | # Set hash to arguments | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 4 | ▶ | if(@_ == 1 && ref $_[0] eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC50%1/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | { | ||||||||||||||||||||||||||||||||||||||||||
| 362 | 2 | $Inheritable_Hash{$class}{$key} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||
| 364 | else | ||||||||||||||||||||||||||||||||||||||||||
| 365 | { | ||||||||||||||||||||||||||||||||||||||||||
| 366 | # Push on new values and return complete set | ||||||||||||||||||||||||||||||||||||||||||
| 367 | 2 | ▶ | Carp::croak "Odd number of items in assigment to $name" if(@_ % 2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 2 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | { | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 4 | local $_ = shift; | |||||||||||||||||||||||||||||||||||||||||
| 372 | 4 | $Inheritable_Hash{$class}{$key}{$_} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | return wantarray ? %{$Inheritable_Hash{$class}{$key} || {}} : $Inheritable_Hash{$class}{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key}
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 379 | elsif($interface eq 'clear') | ||||||||||||||||||||||||||||||||||||||||||
| 380 | { | ||||||||||||||||||||||||||||||||||||||||||
| 381 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 382 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | 2 | $Inheritable_Hash{$_[0]}{$key} = {} | |||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 386 | elsif($interface eq 'reset') | ||||||||||||||||||||||||||||||||||||||||||
| 387 | { | ||||||||||||||||||||||||||||||||||||||||||
| 388 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 2 | $Inheritable_Hash{$_[0]}{$key} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 393 | elsif($interface eq 'delete') | ||||||||||||||||||||||||||||||||||||||||||
| 394 | { | ||||||||||||||||||||||||||||||||||||||||||
| 395 | $methods{($interface eq 'manip' ? 'delete_' : '') . $name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 4 | ▶ | Carp::croak "Missing key(s) to delete" unless(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 4 | ▶ | defined $Inheritable_Hash{$_[0]}{$key} || $init_method->($_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | 4 | delete @{$Inheritable_Hash{$_[0]}{$key}}{@_[1 .. $#_]}; | |||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 401 | 2 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | elsif($interface eq 'exists') | ||||||||||||||||||||||||||||||||||||||||||
| 403 | { | ||||||||||||||||||||||||||||||||||||||||||
| 404 | $methods{$name . ($interface eq 'manip' ? '_exists' : '')} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 405 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | 8 | ▶ | Carp::croak "Missing key argument" unless(@_ == 2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 407 | 8 | ▶ | defined $Inheritable_Hash{$_[0]}{$key} || $init_method->($_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 8 | ▶ | defined $Inheritable_Hash{$_[0]}{$key} ? exists $Inheritable_Hash{$_[0]}{$key}{$_[1]} : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | 2 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | elsif($interface =~ /^(?:keys|names)$/) | ||||||||||||||||||||||||||||||||||||||||||
| 412 | { | ||||||||||||||||||||||||||||||||||||||||||
| 413 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 414 | 24 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | 24 | ▶ | defined $Inheritable_Hash{$_[0]}{$key} || $init_method->($_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 24 | ▶ | wantarray ? (defined $Inheritable_Hash{$_[0]}{$key} ? keys %{$Inheritable_Hash{$_[0]}{$key} || {}} : ()) : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key}
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | (defined $Inheritable_Hash{$_[0]}{$key} ? [ keys %{$Inheritable_Hash{$_[0]}{$key} || {}} ] : []); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key}
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 419 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 420 | elsif($interface eq 'values') | ||||||||||||||||||||||||||||||||||||||||||
| 421 | { | ||||||||||||||||||||||||||||||||||||||||||
| 422 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 24 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=27.5
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 24 | ▶ | defined $Inheritable_Hash{$_[0]}{$key} || $init_method->($_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 425 | 24 | ▶ | wantarray ? (defined $Inheritable_Hash{$_[0]}{$key} ? values %{$Inheritable_Hash{$_[0]}{$key} || {}} : ()) : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key}
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | (defined $Inheritable_Hash{$_[0]}{$key} ? [ values %{$Inheritable_Hash{$_[0]}{$key} || {}} ] : []); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key}
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 429 | elsif($interface eq 'get_set') | ||||||||||||||||||||||||||||||||||||||||||
| 430 | { | ||||||||||||||||||||||||||||||||||||||||||
| 431 | $methods{$name} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 432 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=15 SCAR=36.8
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 6 | ▶ | my($class) = ref $_[0] ? ref shift : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | 6 | ▶ | defined $Inheritable_Hash{$class}{$key} || $init_method->($class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | # If called with no arguments, return hash contents | ||||||||||||||||||||||||||||||||||||||||||
| 438 | 6 | ▶ | unless(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | { | ||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | return wantarray ? (defined $Inheritable_Hash{$class}{$key} ? %{$Inheritable_Hash{$class}{$key} || {}} : ()) : $Inheritable_Hash{$class}{$key} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key}
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | # If called with a hash ref, set value | ||||||||||||||||||||||||||||||||||||||||||
| 444 | 6 | ▶ | if(@_ == 1 && ref $_[0] eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | { | ||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $Inheritable_Hash{$class}{$key} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||
| 448 | else | ||||||||||||||||||||||||||||||||||||||||||
| 449 | { | ||||||||||||||||||||||||||||||||||||||||||
| 450 | # If called with an index, get that value, or a slice for array refs | ||||||||||||||||||||||||||||||||||||||||||
| 451 | 6 | ▶ | if(@_ == 1) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | { | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | return ref $_[0] eq 'ARRAY' ? @{$Inheritable_Hash{$class}{$key}}{@{$_[0]}} : | |||||||||||||||||||||||||||||||||||||||||
| 454 | 2 | ▶ | $Inheritable_Hash{$class}{$key}{$_[0]}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | # Push on new values and return complete set | ||||||||||||||||||||||||||||||||||||||||||
| 458 | 4 | ▶ | Carp::croak "Odd number of items in assigment to $name" if(@_ % 2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | 4 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 461 | { | ||||||||||||||||||||||||||||||||||||||||||
| 462 | 6 | local $_ = shift; | |||||||||||||||||||||||||||||||||||||||||
| 463 | 6 | $Inheritable_Hash{$class}{$key}{$_} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | return wantarray ? %{$Inheritable_Hash{$class}{$key} || {}} : $Inheritable_Hash{$class}{$key}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key}
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | else { Carp::croak "Unknown interface: $interface" } | |||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 16 | return \%methods; | |||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 3 | ▶ | use constant CLASS_VALUE => 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 476 | 3 | ▶ | use constant INHERITED_VALUE => 2; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | 3 | ▶ | use constant DELETED_VALUE => 3; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 3 | our %Inherited_Hash; | |||||||||||||||||||||||||||||||||||||||||
| 480 | # ( | ||||||||||||||||||||||||||||||||||||||||||
| 481 | # some_name => | ||||||||||||||||||||||||||||||||||||||||||
| 482 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 483 | # class1 => | ||||||||||||||||||||||||||||||||||||||||||
| 484 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 485 | # meta => { ... }, | ||||||||||||||||||||||||||||||||||||||||||
| 486 | # cache => | ||||||||||||||||||||||||||||||||||||||||||
| 487 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 488 | # meta => | ||||||||||||||||||||||||||||||||||||||||||
| 489 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 490 | # attr1 => CLASS_VALUE, | ||||||||||||||||||||||||||||||||||||||||||
| 491 | # attr2 => DELETED_VALUE, | ||||||||||||||||||||||||||||||||||||||||||
| 492 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 493 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 494 | # attrs => | ||||||||||||||||||||||||||||||||||||||||||
| 495 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 496 | # attr1 => value1, | ||||||||||||||||||||||||||||||||||||||||||
| 497 | # attr2 => value2, | ||||||||||||||||||||||||||||||||||||||||||
| 498 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 499 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 500 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 501 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 502 | # class2 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 503 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 504 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 505 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 506 | # ); | ||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | # Used as array indexes to replace {'meta'}, {'attrs'}, and {'cache'} | ||||||||||||||||||||||||||||||||||||||||||
| 509 | 3 | ▶ | use constant META => 0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 510 | 3 | ▶ | use constant CACHE => 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 511 | 3 | ▶ | use constant ATTRS => 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | # XXX: This implementation is space-inefficient and pretty silly | ||||||||||||||||||||||||||||||||||||||||||
| 514 | sub inherited_hash | ||||||||||||||||||||||||||||||||||||||||||
| 515 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inherited_hash: called CC=23 SCAR=32.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | 8 | my($class, $name, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | 8 | my %methods; | |||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | # Interface example: | ||||||||||||||||||||||||||||||||||||||||||
| 521 | # name: object_type_class | ||||||||||||||||||||||||||||||||||||||||||
| 522 | # plural_name: object_type_classes | ||||||||||||||||||||||||||||||||||||||||||
| 523 | # | ||||||||||||||||||||||||||||||||||||||||||
| 524 | # get_set: object_type_class | ||||||||||||||||||||||||||||||||||||||||||
| 525 | # get_set_all_method: object_type_classes | ||||||||||||||||||||||||||||||||||||||||||
| 526 | # keys_method: object_type_class_keys | ||||||||||||||||||||||||||||||||||||||||||
| 527 | # cache_method: object_type_classes_cache | ||||||||||||||||||||||||||||||||||||||||||
| 528 | # exists_method: object_type_class_exists | ||||||||||||||||||||||||||||||||||||||||||
| 529 | # add_method: add_object_type_class | ||||||||||||||||||||||||||||||||||||||||||
| 530 | # adds_method: add_object_type_classes | ||||||||||||||||||||||||||||||||||||||||||
| 531 | # delete_method: delete_object_type_class | ||||||||||||||||||||||||||||||||||||||||||
| 532 | # deletes_method: delete_object_type_classes | ||||||||||||||||||||||||||||||||||||||||||
| 533 | # clear_method clear_object_type_classes | ||||||||||||||||||||||||||||||||||||||||||
| 534 | # inherit_method: inherit_object_type_class | ||||||||||||||||||||||||||||||||||||||||||
| 535 | # inherits_method: inherit_object_type_classes | ||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | 8 | ▶ | my $plural_name = $args->{'plural_name'} || $name . 's'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'plural_name'} || $name . 's'
MC/DC0%0/1
$args->{'plural_name'} || $name . 's'
$args->{'plural_name'}
Truth table50%1/2
A
A= $args->{'plural_name'}
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | 8 | my $get_set_method = $name; | |||||||||||||||||||||||||||||||||||||||||
| 540 | 8 | ▶ | my $get_set_all_method = $args->{'get_set_all_method'} || $args->{'hash_method'} || $plural_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$args->{'get_set_all_method'} || $args->{'hash_method'} || $plural_name
$args->{"get_set_all_method"} or $args->{"hash_method"}
MC/DC0%0/3
$args->{'get_set_all_method'} || $args->{'hash_method'} || $plural_name
$args->{"get_set_all_method"}
$args->{"hash_method"}
$plural_name
Truth table25%1/4
A or B || C
A= $args->{"get_set_all_method"}B= $args->{"hash_method"}C= $plural_name
| |||||||||||||||||||||||||||||||||||||||||||
| 541 | 8 | ▶ | my $keys_method = $args->{'keys_method'} || $name . '_keys'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'keys_method'} || $name . '_keys'
MC/DC100%1/1
$args->{'keys_method'} || $name . '_keys'
$args->{'keys_method'}
Truth table100%2/2
A
A= $args->{'keys_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | 8 | ▶ | my $cache_method = $args->{'cache_method'} || $plural_name . '_cache'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'cache_method'} || $plural_name . '_cache'
MC/DC0%0/1
$args->{'cache_method'} || $plural_name . '_cache'
$args->{'cache_method'}
Truth table50%1/2
A
A= $args->{'cache_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | 8 | ▶ | my $exists_method = $args->{'exists_method'} || $args->{'exists_method'} || $name . '_exists'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
$args->{'exists_method'} || $args->{'exists_method'} || $name . '_exists'
$args->{"exists_method"} or $args->{"exists_method"}
MC/DC50%1/2
$args->{'exists_method'} || $args->{'exists_method'} || $name . '_exists'
$args->{"exists_method"}
$args->{"exists_method"}
Truth table66%2/3
A or B
A= $args->{"exists_method"}B= $args->{"exists_method"}
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | 8 | ▶ | my $add_method = $args->{'add_method'} || 'add_' . $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'add_method'} || 'add_' . $name
MC/DC0%0/1
$args->{'add_method'} || 'add_' . $name
$args->{'add_method'}
Truth table50%1/2
A
A= $args->{'add_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | 8 | ▶ | my $adds_method = $args->{'adds_method'} || 'add_' . $plural_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'adds_method'} || 'add_' . $plural_name
MC/DC0%0/1
$args->{'adds_method'} || 'add_' . $plural_name
$args->{'adds_method'}
Truth table50%1/2
A
A= $args->{'adds_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 546 | 8 | ▶ | my $delete_method = $args->{'delete_method'} || 'delete_' . $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'delete_method'} || 'delete_' . $name
MC/DC0%0/1
$args->{'delete_method'} || 'delete_' . $name
$args->{'delete_method'}
Truth table50%1/2
A
A= $args->{'delete_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 547 | 8 | ▶ | my $deletes_method = $args->{'deletes_method'} || 'delete_' . $plural_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'deletes_method'} || 'delete_' . $plural_name
MC/DC0%0/1
$args->{'deletes_method'} || 'delete_' . $plural_name
$args->{'deletes_method'}
Truth table50%1/2
A
A= $args->{'deletes_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 548 | 8 | ▶ | my $clear_method = $args->{'clear_method'} || 'clear_' . $plural_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'clear_method'} || 'clear_' . $plural_name
MC/DC0%0/1
$args->{'clear_method'} || 'clear_' . $plural_name
$args->{'clear_method'}
Truth table50%1/2
A
A= $args->{'clear_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | 8 | ▶ | my $inherit_method = $args->{'inherit_method'} || 'inherit_' . $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'inherit_method'} || 'inherit_' . $name
MC/DC0%0/1
$args->{'inherit_method'} || 'inherit_' . $name
$args->{'inherit_method'}
Truth table50%1/2
A
A= $args->{'inherit_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 550 | 8 | ▶ | my $inherits_method = $args->{'inherits_method'} || 'inherit_' . $plural_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'inherits_method'} || 'inherit_' . $plural_name
MC/DC0%0/1
$args->{'inherits_method'} || 'inherit_' . $plural_name
$args->{'inherits_method'}
Truth table50%1/2
A
A= $args->{'inherits_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | 8 | ▶ | my $interface = $args->{'interface'} || 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'interface'} || 'all'
MC/DC0%0/1
$args->{'interface'} || 'all'
$args->{'interface'}
Truth table50%1/2
A
A= $args->{'interface'}
| |||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | 8 | my $add_implies = $args->{'add_implies'}; | |||||||||||||||||||||||||||||||||||||||||
| 555 | 8 | my $delete_implies = $args->{'delete_implies'}; | |||||||||||||||||||||||||||||||||||||||||
| 556 | 8 | my $inherit_implies = $args->{'inherit_implies'}; | |||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | 8 | ▶ | $add_implies = [ $add_implies ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $add_implies and not ref $add_implies
MC/DC50%1/2
defined $add_implies and not ref $add_implies
defined $add_implies
not ref $add_implies
Truth table66%2/3
A and not(B)
A= defined $add_impliesB= not ref $add_implies
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | if(defined $add_implies && !ref $add_implies); | ||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | 8 | ▶ | $delete_implies = [ $delete_implies ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $delete_implies and not ref $delete_implies
MC/DC50%1/2
defined $delete_implies and not ref $delete_implies
defined $delete_implies
not ref $delete_implies
Truth table66%2/3
A and not(B)
A= defined $delete_impliesB= not ref $delete_implies
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | if(defined $delete_implies && !ref $delete_implies); | ||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 8 | ▶ | $inherit_implies = [ $inherit_implies ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $inherit_implies and not ref $inherit_implies
MC/DC50%1/2
defined $inherit_implies and not ref $inherit_implies
defined $inherit_implies
not ref $inherit_implies
Truth table66%2/3
A and not(B)
A= defined $inherit_impliesB= not ref $inherit_implies
| |||||||||||||||||||||||||||||||||||||||||||
| 565 | if(defined $inherit_implies && !ref $inherit_implies); | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | $methods{$cache_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 568 | 244 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=21 SCAR=34.9
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | 244 | ▶ | my($class) = ref($_[0]) || $_[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $_[0] || $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0]
$_[0]
Truth table33%1/3
A || B
A= ref $_[0]B= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | 244 | ▶ | if($Inherited_Hash{$name}{$class}[META]{'cache_is_valid'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | { | ||||||||||||||||||||||||||||||||||||||||||
| 573 | return | ||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | wantarray ? (%{$Inherited_Hash{$name}{$class}[CACHE] ||= []}) : | ||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 575 | 142 | ▶ | ($Inherited_Hash{$name}{$class}[CACHE] ||= []); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | 102 | ▶ | my $cache = $Inherited_Hash{$name}{$class}[CACHE] ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
MC/DC100%1/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table100%2/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | 102 | my @parents = ($class); | |||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||
| 582 | 102 | ▶ | while(my $parent = shift(@parents)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 583 | { | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 585 | 216 | foreach my $superclass (@{$parent . '::ISA'}) | |||||||||||||||||||||||||||||||||||||||||
| 586 | { | ||||||||||||||||||||||||||||||||||||||||||
| 587 | 114 | push(@parents, $superclass); | |||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||
| 589 | 114 | ▶ | if($superclass->can($cache_method)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 590 | { | ||||||||||||||||||||||||||||||||||||||||||
| 591 | 114 | my $supercache = $superclass->$cache_method(); | |||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | 114 | ▶ | while(my($attr, $state) = each %{$supercache->[META] || {}}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$supercache->[0] || {}
MC/DC100%1/1
$supercache->[0] || {}
$supercache->[0]
Truth table100%2/2
A
A= $supercache->[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 594 | { | ||||||||||||||||||||||||||||||||||||||||||
| 595 | 464 | ▶ | next if($state == DELETED_VALUE); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||
| 597 | 3 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | 298 | ▶ | unless(exists $cache->[ATTRS]{$attr}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 599 | { | ||||||||||||||||||||||||||||||||||||||||||
| 600 | 128 | $cache->[ATTRS]{$attr} = $supercache->[ATTRS]{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 601 | 128 | $cache->[META]{$attr} = INHERITED_VALUE; | |||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||
| 605 | # Slower method for superclasses that don't want to implement the | ||||||||||||||||||||||||||||||||||||||||||
| 606 | # cache method (which is not strictly part of the public API) | ||||||||||||||||||||||||||||||||||||||||||
| 607 | elsif($superclass->can($keys_method)) | ||||||||||||||||||||||||||||||||||||||||||
| 608 | { | ||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | foreach my $attr ($superclass->$keys_method()) | |||||||||||||||||||||||||||||||||||||||||
| 610 | { | ||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | ▶ | unless(exists $Inherited_Hash{$name}{$class}[CACHE][ATTRS]{$attr}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 612 | { | ||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | $Inherited_Hash{$name}{$class}[CACHE][META]{$attr} = INHERITED_VALUE; | |||||||||||||||||||||||||||||||||||||||||
| 614 | $Inherited_Hash{$name}{$class}[CACHE][ATTRS]{$attr} = | ||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | $Inherited_Hash{$name}{$superclass}[CACHE][ATTRS]{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | 102 | $Inherited_Hash{$name}{$class}[META]{'cache_is_valid'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||
| 624 | 102 | my $want = wantarray; | |||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | 102 | ▶ | return unless(defined $want); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | $want ? (%{$Inherited_Hash{$name}{$class}[CACHE] ||= []}) : | ||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 628 | 96 | ▶ | ($Inherited_Hash{$name}{$class}[CACHE] ||= []); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 629 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||
| 631 | $methods{$get_set_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 632 | 216 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.4
| |||||||||||||||||||||||||||||||||||||||||||
| 633 | 216 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 634 | 216 | ▶ | return 0 unless(defined $_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | 216 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | 216 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 639 | { | ||||||||||||||||||||||||||||||||||||||||||
| 640 | 16 | ▶ | Carp::croak "More than one value passed to $get_set_method()" if(@_ > 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | 16 | $class->$adds_method($key, @_); | |||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||
| 643 | else | ||||||||||||||||||||||||||||||||||||||||||
| 644 | { | ||||||||||||||||||||||||||||||||||||||||||
| 645 | 200 | ▶ | if($Inherited_Hash{$name}{$class}[META]{'cache_is_valid'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 646 | { | ||||||||||||||||||||||||||||||||||||||||||
| 647 | 194 | ▶ | my $cache = $Inherited_Hash{$name}{$class}[CACHE] ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||
| 649 | 3 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 650 | 194 | ▶ | return $cache->[ATTRS]{$key} unless($cache->[META]{$key} == DELETED_VALUE); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 651 | 16 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||
| 654 | 6 | my $cache = $class->$cache_method(); | |||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | 3 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 657 | 6 | ▶ | return $cache->[ATTRS]{$key} unless($cache->[META]{$key} == DELETED_VALUE); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||
| 660 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | $methods{$keys_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 663 | 42 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||
| 664 | 42 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 665 | 42 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 666 | 42 | return wantarray ? keys %{$class->$get_set_all_method()} : | |||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | [ keys %{$class->$get_set_all_method()} ]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | $methods{$get_set_all_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 671 | 48 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||
| 672 | 48 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||
| 674 | 48 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||
| 676 | 48 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 677 | { | ||||||||||||||||||||||||||||||||||||||||||
| 678 | 6 | $class->$clear_method(); | |||||||||||||||||||||||||||||||||||||||||
| 679 | 6 | return $class->$adds_method(@_); | |||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||
| 682 | 42 | my $cache = $class->$cache_method(); | |||||||||||||||||||||||||||||||||||||||||
| 683 | 42 | ▶ | my %hash = %{$cache->[ATTRS] || {}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$cache->[1] || {}
MC/DC100%1/1
$cache->[1] || {}
$cache->[1]
Truth table100%2/2
A
A= $cache->[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 42 | foreach my $k (keys %hash) | |||||||||||||||||||||||||||||||||||||||||
| 686 | { | ||||||||||||||||||||||||||||||||||||||||||
| 687 | 128 | ▶ | delete $hash{$k} if($Inherited_Hash{$name}{$class}[CACHE][META]{$k} == DELETED_VALUE); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||
| 690 | 42 | ▶ | return wantarray ? %hash : \%hash; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 691 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | $methods{$exists_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 694 | 288 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.3
| |||||||||||||||||||||||||||||||||||||||||||
| 695 | 288 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||
| 697 | 288 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | 288 | ▶ | return 0 unless(defined $key); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | 288 | ▶ | if($Inherited_Hash{$name}{$class}[META]{'cache_is_valid'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 702 | { | ||||||||||||||||||||||||||||||||||||||||||
| 703 | 212 | ▶ | my $cache = $Inherited_Hash{$name}{$class}[CACHE] ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 704 | 212 | ▶ | return (exists $cache->[ATTRS]{$key} && $cache->[META]{$key} != DELETED_VALUE) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $cache->[1]{$key} and $cache->[0]{$key} != 3
MC/DC100%2/2
exists $cache->[1]{$key} and $cache->[0]{$key} != 3
exists $cache->[1]{$key}
$cache->[0]{$key} != 3
Truth table100%3/3
A and B
A= exists $cache->[1]{$key}B= $cache->[0]{$key} != 3
| |||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||
| 707 | 76 | my $cache = $class->$cache_method(); | |||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||
| 709 | 76 | ▶ | return (exists $cache->[ATTRS]{$key} && $cache->[META]{$key} != DELETED_VALUE) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $cache->[1]{$key} and $cache->[0]{$key} != 3
MC/DC50%1/2
exists $cache->[1]{$key} and $cache->[0]{$key} != 3
exists $cache->[1]{$key}
$cache->[0]{$key} != 3
Truth table66%2/3
A and B
A= exists $cache->[1]{$key}B= $cache->[0]{$key} != 3
| |||||||||||||||||||||||||||||||||||||||||||
| 710 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||
| 712 | 8 | ▶ | $methods{$add_method} = sub { shift->$adds_method(@_) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | $methods{$adds_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 715 | 72 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=20 SCAR=30.5
| |||||||||||||||||||||||||||||||||||||||||||
| 716 | 72 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 717 | 72 | ▶ | Carp::croak("Missing name/value pair(s) to add") unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||
| 719 | 72 | my @attrs; | |||||||||||||||||||||||||||||||||||||||||
| 720 | 72 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | 72 | ▶ | my $cache = $Inherited_Hash{$name}{$class}[CACHE] ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
MC/DC100%1/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table100%2/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||
| 724 | # XXX: Lame duplication to avoid copying the hash | ||||||||||||||||||||||||||||||||||||||||||
| 725 | 72 | ▶ | if(@_ == 1 && ref $_[0] eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC50%1/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 726 | { | ||||||||||||||||||||||||||||||||||||||||||
| 727 | 2 | ▶ | while(my($attr, $value) = each(%{$_[0]})) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 728 | { | ||||||||||||||||||||||||||||||||||||||||||
| 729 | 6 | ▶ | next unless(defined $attr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | 6 | push(@attrs, $attr); | |||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||
| 733 | 6 | $cache->[ATTRS]{$attr} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 734 | 6 | $cache->[META]{$attr} = CLASS_VALUE; | |||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | 6 | ▶ | if($add_implies) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 737 | { | ||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | foreach my $method (@$add_implies) | |||||||||||||||||||||||||||||||||||||||||
| 739 | { | ||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | $class->$method($attr => $value); | |||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | 6 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||
| 747 | else | ||||||||||||||||||||||||||||||||||||||||||
| 748 | { | ||||||||||||||||||||||||||||||||||||||||||
| 749 | 70 | ▶ | Carp::croak("Odd number of arguments passed to $adds_method") if(@_ % 2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||
| 751 | 70 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 752 | { | ||||||||||||||||||||||||||||||||||||||||||
| 753 | 82 | my($attr, $value) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||
| 755 | 82 | push(@attrs, $attr); | |||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 758 | 82 | ▶ | next unless(defined $attr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 759 | 82 | $cache->[ATTRS]{$attr} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 760 | 82 | $cache->[META]{$attr} = CLASS_VALUE; | |||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||
| 762 | 82 | ▶ | if($add_implies) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 763 | { | ||||||||||||||||||||||||||||||||||||||||||
| 764 | 28 | foreach my $method (@$add_implies) | |||||||||||||||||||||||||||||||||||||||||
| 765 | { | ||||||||||||||||||||||||||||||||||||||||||
| 766 | 28 | $class->$method($attr => $value); | |||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||
| 770 | 82 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||
| 774 | 72 | ▶ | if($count) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 775 | { | ||||||||||||||||||||||||||||||||||||||||||
| 776 | 72 | foreach my $test_class (keys %{$Inherited_Hash{$name}}) | |||||||||||||||||||||||||||||||||||||||||
| 777 | { | ||||||||||||||||||||||||||||||||||||||||||
| 778 | 228 | ▶ | if($test_class->isa($class) && $test_class ne $class) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$test_class->isa($class) and $test_class ne $class
MC/DC100%2/2
$test_class->isa($class) and $test_class ne $class
$test_class->isa($class)
$test_class ne $class
Truth table100%3/3
A and B
A= $test_class->isa($class)B= $test_class ne $class
| |||||||||||||||||||||||||||||||||||||||||||
| 779 | { | ||||||||||||||||||||||||||||||||||||||||||
| 780 | 90 | $Inherited_Hash{$name}{$test_class}[META]{'cache_is_valid'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||||||||
| 782 | 90 | foreach my $attr (@attrs) | |||||||||||||||||||||||||||||||||||||||||
| 783 | { | ||||||||||||||||||||||||||||||||||||||||||
| 784 | 102 | delete $Inherited_Hash{$name}{$test_class}[CACHE][ATTRS]{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||
| 790 | 72 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 791 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||
| 793 | $methods{$clear_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 794 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 795 | 8 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 796 | 8 | my @keys = $class->$keys_method(); | |||||||||||||||||||||||||||||||||||||||||
| 797 | 8 | ▶ | return unless(@keys); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 798 | 4 | $class->$deletes_method(@keys); | |||||||||||||||||||||||||||||||||||||||||
| 799 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | 8 | ▶ | $methods{$delete_method} = sub { shift->$deletes_method(@_) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||
| 803 | $methods{$deletes_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 804 | 72 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=17 SCAR=28.7
| |||||||||||||||||||||||||||||||||||||||||||
| 805 | 72 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 806 | 72 | ▶ | Carp::croak("Missing value(s) to delete") unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||
| 808 | # Init set if it doesn't exist | ||||||||||||||||||||||||||||||||||||||||||
| 809 | 72 | ▶ | unless(exists $Inherited_Hash{$name}{$class}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 810 | { | ||||||||||||||||||||||||||||||||||||||||||
| 811 | 6 | $class->$cache_method(); | |||||||||||||||||||||||||||||||||||||||||
| 812 | } | ||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||
| 814 | 72 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||
| 816 | 72 | ▶ | my $cache = $Inherited_Hash{$name}{$class}[CACHE] ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||
| 818 | 72 | foreach my $attr (@_) | |||||||||||||||||||||||||||||||||||||||||
| 819 | { | ||||||||||||||||||||||||||||||||||||||||||
| 820 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 821 | 82 | ▶ | next unless(defined $attr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||
| 823 | 82 | ▶ | if(exists $cache->[ATTRS]{$attr} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $cache->[1]{$attr} and $cache->[0]{$attr} != 3
MC/DC50%1/2
exists $cache->[1]{$attr} and $cache->[0]{$attr} != 3
exists $cache->[1]{$attr}
$cache->[0]{$attr} != 3
Truth table66%2/3
A and B
A= exists $cache->[1]{$attr}B= $cache->[0]{$attr} != 3
| |||||||||||||||||||||||||||||||||||||||||||
| 824 | $cache->[META]{$attr} != DELETED_VALUE) | ||||||||||||||||||||||||||||||||||||||||||
| 825 | { | ||||||||||||||||||||||||||||||||||||||||||
| 826 | 52 | $cache->[META]{$attr} = DELETED_VALUE; | |||||||||||||||||||||||||||||||||||||||||
| 827 | 52 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||
| 829 | 52 | ▶ | if($delete_implies) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 830 | { | ||||||||||||||||||||||||||||||||||||||||||
| 831 | 32 | foreach my $method (@$delete_implies) | |||||||||||||||||||||||||||||||||||||||||
| 832 | { | ||||||||||||||||||||||||||||||||||||||||||
| 833 | 32 | $class->$method($attr); | |||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | 52 | foreach my $test_class (keys %{$Inherited_Hash{$name}}) | |||||||||||||||||||||||||||||||||||||||||
| 838 | { | ||||||||||||||||||||||||||||||||||||||||||
| 839 | 180 | ▶ | next if($class eq $test_class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||
| 841 | 128 | ▶ | my $test_cache = $Inherited_Hash{$name}{$test_class}[CACHE] ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$test_class}[1] ||= []
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$test_class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$test_class}[1]
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$test_class}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||
| 843 | 128 | ▶ | if($test_class->isa($class) && exists $test_cache->[ATTRS]{$attr} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$test_class->isa($class) and exists $test_cache->[1]{$attr} and $test_cache->[0]{$attr} == 2
$test_class->isa($class) and exists $test_cache->[1]{$attr}
MC/DC66%2/3
$test_class->isa($class) and exists $test_cache->[1]{$attr} and $test_cache->[0]{$attr} == 2
$test_class->isa($class)
exists $test_cache->[1]{$attr}
$test_cache->[0]{$attr} == 2
Truth table75%3/4
A and B and C
A= $test_class->isa($class)B= exists $test_cache->[1]{$attr}C= $test_cache->[0]{$attr} == 2
| |||||||||||||||||||||||||||||||||||||||||||
| 844 | $test_cache->[META]{$attr} == INHERITED_VALUE) | ||||||||||||||||||||||||||||||||||||||||||
| 845 | { | ||||||||||||||||||||||||||||||||||||||||||
| 846 | 46 | delete $test_cache->[ATTRS]{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 847 | 46 | delete $test_cache->[META]{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 848 | 46 | $Inherited_Hash{$name}{$test_class}[META]{'cache_is_valid'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||
| 850 | } | ||||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||
| 854 | 72 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 855 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||
| 857 | 8 | ▶ | $methods{$inherit_method} = sub { shift->$inherits_method(@_) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||
| 859 | $methods{$inherits_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 860 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||
| 861 | 14 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 862 | 14 | ▶ | Carp::croak("Missing value(s) to inherit") unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||
| 864 | 14 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||
| 866 | 14 | ▶ | my $cache = $Inherited_Hash{$name}{$class}[CACHE] ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
MC/DC0%0/1
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||
| 868 | 14 | foreach my $attr (@_) | |||||||||||||||||||||||||||||||||||||||||
| 869 | { | ||||||||||||||||||||||||||||||||||||||||||
| 870 | 14 | ▶ | if(exists $cache->[ATTRS]{$attr}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 871 | { | ||||||||||||||||||||||||||||||||||||||||||
| 872 | 12 | delete $cache->[ATTRS]{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 873 | 12 | delete $cache->[META]{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 874 | 12 | $Inherited_Hash{$name}{$class}[META]{'cache_is_valid'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 875 | 12 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||
| 878 | 14 | ▶ | if($inherit_implies) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 879 | { | ||||||||||||||||||||||||||||||||||||||||||
| 880 | 6 | foreach my $method (@$inherit_implies) | |||||||||||||||||||||||||||||||||||||||||
| 881 | { | ||||||||||||||||||||||||||||||||||||||||||
| 882 | 6 | $class->$method($attr); | |||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||
| 885 | } | ||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||
| 887 | 14 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 888 | 8 | }; | |||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||
| 890 | 8 | ▶ | if($interface ne 'all') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 891 | { | ||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | Carp::croak "Unknown interface: $interface"; | |||||||||||||||||||||||||||||||||||||||||
| 893 | } | ||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||
| 895 | 8 | return \%methods; | |||||||||||||||||||||||||||||||||||||||||
| 896 | } | ||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||
| 901 | __END__ | ||||||||||||||||||||||||||||||||||||||||||