Class/MakeMethods/Generic.pm

filter: Statementstmt 91.1% 383 / 420 Branchbran 68.9% 218 / 316 Conditioncond 56.9% 82 / 144 MC/DCmcdc 29.1% 23 / 79 Subroutinesub 96.4% 55 / 57 Podpod 100% 6 / 6 totaltotal 75.0% 767 / 1022 CC 236 SCAR 27.6
CC
236
Cov
78%
__ANON__
39.6
__ANON__
32.9
__ANON__
29.8
CRAP 15.8
« Object/MixIn.pm ↑ Summary Class/MakeMethods/Set.pm »
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'
l!l
25
MC/DC100%1/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table100%2/2
A
A= $args->{'interface'}
Aresult
11
00
30  
31 7 ▶ if($interface eq 'get_set')
Branch: 2 branches
BranchTrueFalseTotal
if ($interface eq 'get_set') { } 5 2 7
elsif ($interface eq 'get_set_init') { } 2 0 2
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
BranchTrueFalseTotal
if @_ > 1 5 8 13
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"
l!l
02
MC/DC0%0/1
$args->{'init_method'} || "init_$name"
$args->{'init_method'}
Truth table50%1/2
A
A= $args->{'init_method'}
Aresult
11
00
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
BranchTrueFalseTotal
if @_ > 1 4 8 12
46 return defined $Scalar{$_[0]}{$name} ?
47 8 ▶ $Scalar{$_[0]}{$name} : ($Scalar{$_[0]}{$name} = $_[0]->$init_method())
Branch: 1 branch
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Scalar{$_[0]}{$name} ? : 4 4 8
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'
l!l
02
MC/DC0%0/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table50%1/2
A
A= $args->{'interface'}
Aresult
11
00
72  
73 2 ▶ if($interface eq 'get_set')
Branch: 1 branch
BranchTrueFalseTotal
if ($interface eq 'get_set') { } 2 0 2
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
BranchTrueFalseTotal
ref $_[0] ? : 0 34 34
78  
79 34 ▶ if(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 6 28 34
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
BranchTrueFalseTotal
if exists $Rose::Class::MakeMethods::Generic::Inheritable_Scalar{$class}{$name} 12 16 28
86  
87 16 my @parents = ($class);
88  
89 16 ▶ while(my $parent = shift(@parents))
Branch: 1 branch
BranchTrueFalseTotal
if (my $parent = shift @parents) 26 0 26
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
BranchTrueFalseTotal
if (exists $Rose::Class::MakeMethods::Generic::Inheritable_Scalar{$subclass}{$name}) 16 10 26
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'
l!l
04
MC/DC0%0/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table50%1/2
A
A= $args->{'interface'}
Aresult
11
00
120  
121 4 ▶ if($interface eq 'get_set')
Branch: 1 branch
BranchTrueFalseTotal
if ($interface eq 'get_set') { } 4 0 4
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
BranchTrueFalseTotal
ref $_[0] ? : 0 82 82
126  
127 82 ▶ if(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 18 64 82
128 {
129 18 ▶ return $Inheritable_Boolean{$class}{$name} = $_[0] ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$_[0] ? : 12 6 18
130 }
131  
132 return $Inheritable_Boolean{$class}{$name}
133 64 ▶ if(exists $Inheritable_Boolean{$class}{$name});
Branch: 1 branch
BranchTrueFalseTotal
if exists $Rose::Class::MakeMethods::Generic::Inheritable_Boolean{$class}{$name} 30 34 64
134  
135 34 my @parents = ($class);
136  
137 34 ▶ while(my $parent = shift(@parents))
Branch: 1 branch
BranchTrueFalseTotal
if (my $parent = shift @parents) 54 6 60
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
BranchTrueFalseTotal
if (exists $Rose::Class::MakeMethods::Generic::Inheritable_Boolean{$subclass}{$name}) 28 20 48
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
l!l&&r!l&&!r
1220
MC/DC0%0/2
$args->{'hash_key'} || $name
$args->{'hash_key'} $name
Truth table66%2/3
A || B
A= $args->{'hash_key'}B= $name
ABresult
1X1
011
000
181 14 ▶ my $interface = $args->{'interface'} || 'get_set';
Condition100%2/2
$args->{'interface'} || 'get_set'
l!l
122
MC/DC100%1/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table100%2/2
A
A= $args->{'interface'}
Aresult
11
00
182  
183 14 ▶ if($interface eq 'get_set_all')
Branch: 8 branches
BranchTrueFalseTotal
if ($interface eq 'get_set_all') { } 2 12 14
elsif ($interface eq 'clear') { } 2 10 12
elsif ($interface eq 'reset') { } 0 10 10
elsif ($interface eq 'delete') { } 2 8 10
elsif ($interface eq 'exists') { } 2 6 8
elsif ($interface =~ /^(?:keys|names)$/) { } 2 4 6
elsif ($interface eq 'values') { } 2 2 4
elsif ($interface eq 'get_set') { } 2 0 2
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
BranchTrueFalseTotal
ref $_[0] ? : 0 10 10
188  
189 # If called with no arguments, return hash contents
190 10 ▶ return wantarray ? %{$Hash{$class}{$key} || {}} : $Hash{$class}{$key} unless(@_);
Branch: 2 branches
BranchTrueFalseTotal
unless @_ 6 4 10
wantarray ? : 2 4 6
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key} || {}
l!l
20
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}
Aresult
11
00
191  
192 # Set hash to arguments
193 4 ▶ if(@_ == 1 && ref $_[0] eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'HASH') { } 2 2 4
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
!ll&&!rl&&r
202
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"
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if @_ % 2 0 2 2
201  
202 2 ▶ while(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 4 2 6
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
BranchTrueFalseTotal
wantarray ? : 0 4 4
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key} || {}
l!l
00
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}
Aresult
11
00
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
BranchTrueFalseTotal
unless @_ > 1 0 2 2
231 2 delete @{$Hash{$_[0]}{$key}}{@_[1 .. $#_]};
232 }
233 2 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
$interface eq 'manip' ? : 0 2 2
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
BranchTrueFalseTotal
unless @_ == 2 0 2 2
239 2 ▶ defined $Hash{$_[0]}{$key} ? exists $Hash{$_[0]}{$key}{$_[1]} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Hash{$_[0]}{$key} ? : 2 0 2
240 }
241 2 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
$interface eq 'manip' ? : 0 2 2
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
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Hash{$_[0]}{$key} ? : 0 0 0
247 0 ▶ (defined $Hash{$_[0]}{$key} ? [ keys %{$Hash{$_[0]}{$key}} ] : []);
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 4 0 4
defined $Rose::Class::MakeMethods::Generic::Hash{$_[0]}{$key} ? : 4 0 4
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
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Hash{$_[0]}{$key} ? : 0 0 0
255 0 ▶ (defined $Hash{$_[0]}{$key} ? [ values %{$Hash{$_[0]}{$key}} ] : []);
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 4 0 4
defined $Rose::Class::MakeMethods::Generic::Hash{$_[0]}{$key} ? : 4 0 4
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
BranchTrueFalseTotal
ref $_[0] ? : 0 4 4
263  
264 # If called with no arguments, return hash contents
265 4 ▶ unless(@_)
Branch: 1 branch
BranchTrueFalseTotal
unless (@_) 0 4 4
266 {
267 0 ▶ return wantarray ? (defined $Hash{$class}{$key} ? %{$Hash{$class}{$key}} : ()) : $Hash{$class}{$key}
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 0 0 0
defined $Rose::Class::MakeMethods::Generic::Hash{$class}{$key} ? : 0 0 0
268 }
269  
270 # If called with a hash ref, set value
271 4 ▶ if(@_ == 1 && ref $_[0] eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'HASH') { } 0 4 4
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
!ll&&!rl&&r
220
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"
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if (@_ == 1) 2 2 4
279 {
280 0 return ref $_[0] eq 'ARRAY' ? @{$Hash{$class}{$key}}{@{$_[0]}} :
281 2 ▶ $Hash{$class}{$key}{$_[0]};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'ARRAY' ? : 0 2 2
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
BranchTrueFalseTotal
if @_ % 2 0 2 2
286  
287 2 ▶ while(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 4 2 6
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
BranchTrueFalseTotal
wantarray ? : 0 2 2
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Hash{$class}{$key} || {}
l!l
00
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}
Aresult
11
00
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
l!l&&r!l&&!r
1420
MC/DC0%0/2
$args->{'hash_key'} || $name
$args->{'hash_key'} $name
Truth table66%2/3
A || B
A= $args->{'hash_key'}B= $name
ABresult
1X1
011
000
323 16 ▶ my $interface = $args->{'interface'} || 'get_set';
Condition100%2/2
$args->{'interface'} || 'get_set'
l!l
142
MC/DC100%1/1
$args->{'interface'} || 'get_set'
$args->{'interface'}
Truth table100%2/2
A
A= $args->{'interface'}
Aresult
11
00
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
BranchTrueFalseTotal
ref $_[0] ? : 0 14 14
328  
329 # Inherit shallow copy from subclass
330 14 my @parents = ($class);
331  
332 14 ▶ SEARCH: while(my $parent = shift(@parents))
Branch: 1 branch
BranchTrueFalseTotal
if (my $parent = shift @parents) 14 4 18
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
BranchTrueFalseTotal
if (exists $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$subclass}{$key}) 10 0 10
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
BranchTrueFalseTotal
if ($interface eq 'get_set_all') { } 2 14 16
elsif ($interface eq 'clear') { } 2 12 14
elsif ($interface eq 'reset') { } 2 10 12
elsif ($interface eq 'delete') { } 2 8 10
elsif ($interface eq 'exists') { } 2 6 8
elsif ($interface =~ /^(?:keys|names)$/) { } 2 4 6
elsif ($interface eq 'values') { } 2 2 4
elsif ($interface eq 'get_set') { } 2 0 2
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
BranchTrueFalseTotal
ref $_[0] ? : 0 10 10
353  
354 10 ▶ defined $Inheritable_Hash{$class}{$key} || $init_method->($class);
Branch: 1 branch
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} or &$init_method($class) 6 4 10
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
BranchTrueFalseTotal
unless @_ 6 4 10
wantarray ? : 2 4 6
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
l!l
20
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}
Aresult
11
00
358  
359 # Set hash to arguments
360 4 ▶ if(@_ == 1 && ref $_[0] eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'HASH') { } 2 2 4
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
!ll&&!rl&&r
202
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"
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if @_ % 2 0 2 2
368  
369 2 ▶ while(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 4 2 6
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
BranchTrueFalseTotal
wantarray ? : 0 4 4
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
l!l
00
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}
Aresult
11
00
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
BranchTrueFalseTotal
unless @_ > 1 0 4 4
398 4 ▶ defined $Inheritable_Hash{$_[0]}{$key} || $init_method->($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} or &$init_method($_[0]) 4 0 4
399 4 delete @{$Inheritable_Hash{$_[0]}{$key}}{@_[1 .. $#_]};
400 }
401 2 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
$interface eq 'manip' ? : 0 2 2
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
BranchTrueFalseTotal
unless @_ == 2 0 8 8
407 8 ▶ defined $Inheritable_Hash{$_[0]}{$key} || $init_method->($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} or &$init_method($_[0]) 8 0 8
408 8 ▶ defined $Inheritable_Hash{$_[0]}{$key} ? exists $Inheritable_Hash{$_[0]}{$key}{$_[1]} : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} ? : 8 0 8
409 }
410 2 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
$interface eq 'manip' ? : 0 2 2
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
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} or &$init_method($_[0]) 14 10 24
416 24 ▶ wantarray ? (defined $Inheritable_Hash{$_[0]}{$key} ? keys %{$Inheritable_Hash{$_[0]}{$key} || {}} : ()) :
Branch: 1 branch
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} ? : 0 0 0
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
l!l
240
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}
Aresult
11
00
417 0 ▶ (defined $Inheritable_Hash{$_[0]}{$key} ? [ keys %{$Inheritable_Hash{$_[0]}{$key} || {}} ] : []);
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 24 0 24
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} ? : 24 0 24
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
l!l
00
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}
Aresult
11
00
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
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} or &$init_method($_[0]) 24 0 24
425 24 ▶ wantarray ? (defined $Inheritable_Hash{$_[0]}{$key} ? values %{$Inheritable_Hash{$_[0]}{$key} || {}} : ()) :
Branch: 1 branch
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} ? : 0 0 0
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
l!l
240
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}
Aresult
11
00
426 0 ▶ (defined $Inheritable_Hash{$_[0]}{$key} ? [ values %{$Inheritable_Hash{$_[0]}{$key} || {}} ] : []);
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 24 0 24
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} ? : 24 0 24
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$_[0]}{$key} || {}
l!l
00
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}
Aresult
11
00
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
BranchTrueFalseTotal
ref $_[0] ? : 0 6 6
434  
435 6 ▶ defined $Inheritable_Hash{$class}{$key} || $init_method->($class);
Branch: 1 branch
BranchTrueFalseTotal
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} or &$init_method($class) 6 0 6
436  
437 # If called with no arguments, return hash contents
438 6 ▶ unless(@_)
Branch: 1 branch
BranchTrueFalseTotal
unless (@_) 0 6 6
439 {
440 0 ▶ return wantarray ? (defined $Inheritable_Hash{$class}{$key} ? %{$Inheritable_Hash{$class}{$key} || {}} : ()) : $Inheritable_Hash{$class}{$key}
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 0 0 0
defined $Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} ? : 0 0 0
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
l!l
00
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}
Aresult
11
00
441 }
442  
443 # If called with a hash ref, set value
444 6 ▶ if(@_ == 1 && ref $_[0] eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'HASH') { } 0 6 6
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
!ll&&!rl&&r
420
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"
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if (@_ == 1) 2 4 6
452 {
453 0 return ref $_[0] eq 'ARRAY' ? @{$Inheritable_Hash{$class}{$key}}{@{$_[0]}} :
454 2 ▶ $Inheritable_Hash{$class}{$key}{$_[0]};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'ARRAY' ? : 0 2 2
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
BranchTrueFalseTotal
if @_ % 2 0 4 4
459  
460 4 ▶ while(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 6 4 10
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
BranchTrueFalseTotal
wantarray ? : 0 4 4
Condition0%0/2
$Rose::Class::MakeMethods::Generic::Inheritable_Hash{$class}{$key} || {}
l!l
00
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}
Aresult
11
00
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'
l!l
08
MC/DC0%0/1
$args->{'plural_name'} || $name . 's'
$args->{'plural_name'}
Truth table50%1/2
A
A= $args->{'plural_name'}
Aresult
11
00
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
l!l&&r!l&&!r
080
$args->{"get_set_all_method"} or $args->{"hash_method"}
l!l&&r!l&&!r
008
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
ABCresult
1XX1
01X1
0011
0000
541 8 ▶ my $keys_method = $args->{'keys_method'} || $name . '_keys';
Condition100%2/2
$args->{'keys_method'} || $name . '_keys'
l!l
44
MC/DC100%1/1
$args->{'keys_method'} || $name . '_keys'
$args->{'keys_method'}
Truth table100%2/2
A
A= $args->{'keys_method'}
Aresult
11
00
542 8 ▶ my $cache_method = $args->{'cache_method'} || $plural_name . '_cache';
Condition50%1/2
$args->{'cache_method'} || $plural_name . '_cache'
l!l
08
MC/DC0%0/1
$args->{'cache_method'} || $plural_name . '_cache'
$args->{'cache_method'}
Truth table50%1/2
A
A= $args->{'cache_method'}
Aresult
11
00
543 8 ▶ my $exists_method = $args->{'exists_method'} || $args->{'exists_method'} || $name . '_exists';
Condition80%4/5
$args->{'exists_method'} || $args->{'exists_method'} || $name . '_exists'
l!l
44
$args->{"exists_method"} or $args->{"exists_method"}
l!l&&r!l&&!r
404
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"}
ABresult
1X1
011
000
544 8 ▶ my $add_method = $args->{'add_method'} || 'add_' . $name;
Condition50%1/2
$args->{'add_method'} || 'add_' . $name
l!l
08
MC/DC0%0/1
$args->{'add_method'} || 'add_' . $name
$args->{'add_method'}
Truth table50%1/2
A
A= $args->{'add_method'}
Aresult
11
00
545 8 ▶ my $adds_method = $args->{'adds_method'} || 'add_' . $plural_name;
Condition50%1/2
$args->{'adds_method'} || 'add_' . $plural_name
l!l
08
MC/DC0%0/1
$args->{'adds_method'} || 'add_' . $plural_name
$args->{'adds_method'}
Truth table50%1/2
A
A= $args->{'adds_method'}
Aresult
11
00
546 8 ▶ my $delete_method = $args->{'delete_method'} || 'delete_' . $name;
Condition50%1/2
$args->{'delete_method'} || 'delete_' . $name
l!l
08
MC/DC0%0/1
$args->{'delete_method'} || 'delete_' . $name
$args->{'delete_method'}
Truth table50%1/2
A
A= $args->{'delete_method'}
Aresult
11
00
547 8 ▶ my $deletes_method = $args->{'deletes_method'} || 'delete_' . $plural_name;
Condition50%1/2
$args->{'deletes_method'} || 'delete_' . $plural_name
l!l
08
MC/DC0%0/1
$args->{'deletes_method'} || 'delete_' . $plural_name
$args->{'deletes_method'}
Truth table50%1/2
A
A= $args->{'deletes_method'}
Aresult
11
00
548 8 ▶ my $clear_method = $args->{'clear_method'} || 'clear_' . $plural_name;
Condition50%1/2
$args->{'clear_method'} || 'clear_' . $plural_name
l!l
08
MC/DC0%0/1
$args->{'clear_method'} || 'clear_' . $plural_name
$args->{'clear_method'}
Truth table50%1/2
A
A= $args->{'clear_method'}
Aresult
11
00
549 8 ▶ my $inherit_method = $args->{'inherit_method'} || 'inherit_' . $name;
Condition50%1/2
$args->{'inherit_method'} || 'inherit_' . $name
l!l
08
MC/DC0%0/1
$args->{'inherit_method'} || 'inherit_' . $name
$args->{'inherit_method'}
Truth table50%1/2
A
A= $args->{'inherit_method'}
Aresult
11
00
550 8 ▶ my $inherits_method = $args->{'inherits_method'} || 'inherit_' . $plural_name;
Condition50%1/2
$args->{'inherits_method'} || 'inherit_' . $plural_name
l!l
08
MC/DC0%0/1
$args->{'inherits_method'} || 'inherit_' . $plural_name
$args->{'inherits_method'}
Truth table50%1/2
A
A= $args->{'inherits_method'}
Aresult
11
00
551  
552 8 ▶ my $interface = $args->{'interface'} || 'all';
Condition50%1/2
$args->{'interface'} || 'all'
l!l
08
MC/DC0%0/1
$args->{'interface'} || 'all'
$args->{'interface'}
Truth table50%1/2
A
A= $args->{'interface'}
Aresult
11
00
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
BranchTrueFalseTotal
if defined $add_implies and not ref $add_implies 4 4 8
Condition66%2/3
defined $add_implies and not ref $add_implies
!ll&&!rl&&r
404
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
ABresult
0X0
100
111
559 if(defined $add_implies && !ref $add_implies);
560  
561 8 ▶ $delete_implies = [ $delete_implies ]
Branch: 1 branch
BranchTrueFalseTotal
if defined $delete_implies and not ref $delete_implies 4 4 8
Condition66%2/3
defined $delete_implies and not ref $delete_implies
!ll&&!rl&&r
404
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
ABresult
0X0
100
111
562 if(defined $delete_implies && !ref $delete_implies);
563  
564 8 ▶ $inherit_implies = [ $inherit_implies ]
Branch: 1 branch
BranchTrueFalseTotal
if defined $inherit_implies and not ref $inherit_implies 4 4 8
Condition66%2/3
defined $inherit_implies and not ref $inherit_implies
!ll&&!rl&&r
404
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
ABresult
0X0
100
111
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]
l!l&&r!l&&!r
02440
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
Truth table33%1/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
570  
571 244 ▶ if($Inherited_Hash{$name}{$class}[META]{'cache_is_valid'})
Branch: 1 branch
BranchTrueFalseTotal
if ($Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[0]{"cache_is_valid"}) 142 102 244
572 {
573 return
574 0 ▶ wantarray ? (%{$Inherited_Hash{$name}{$class}[CACHE] ||= []}) :
Condition25%1/4
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
l!l
00
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
l!l
1420
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]
Aresult
11
00
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Aresult
11
00
575 142 ▶ ($Inherited_Hash{$name}{$class}[CACHE] ||= []);
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 142 142
576 }
577  
578 102 ▶ my $cache = $Inherited_Hash{$name}{$class}[CACHE] ||= [];
Condition100%2/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
l!l
8418
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]
Aresult
11
00
579  
580 102 my @parents = ($class);
581  
582 102 ▶ while(my $parent = shift(@parents))
Branch: 1 branch
BranchTrueFalseTotal
if (my $parent = shift @parents) 216 102 318
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
BranchTrueFalseTotal
if ($superclass->can($cache_method)) { } 114 0 114
elsif ($superclass->can($keys_method)) { } 0 0 0
590 {
591 114 my $supercache = $superclass->$cache_method();
592  
593 114 ▶ while(my($attr, $state) = each %{$supercache->[META] || {}})
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$supercache->[0] or {};}) 464 114 578
Condition100%2/2
$supercache->[0] || {}
l!l
5744
MC/DC100%1/1
$supercache->[0] || {}
$supercache->[0]
Truth table100%2/2
A
A= $supercache->[0]
Aresult
11
00
594 {
595 464 ▶ next if($state == DELETED_VALUE);
Branch: 1 branch
BranchTrueFalseTotal
if $state == 3 166 298 464
596  
597 3 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
598 298 ▶ unless(exists $cache->[ATTRS]{$attr})
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $cache->[1]{$attr}) 128 170 298
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
BranchTrueFalseTotal
unless (exists $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1][1]{$attr}) 0 0 0
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
BranchTrueFalseTotal
unless defined $want 6 96 102
627 0 ▶ $want ? (%{$Inherited_Hash{$name}{$class}[CACHE] ||= []}) :
Condition25%1/4
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
l!l
00
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
l!l
960
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]
Aresult
11
00
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1]
Aresult
11
00
628 96 ▶ ($Inherited_Hash{$name}{$class}[CACHE] ||= []);
Branch: 1 branch
BranchTrueFalseTotal
$want ? : 0 96 96
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
BranchTrueFalseTotal
ref $_[0] ? : 0 216 216
634 216 ▶ return 0 unless(defined $_[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[0] 0 216 216
635  
636 216 my $key = shift;
637  
638 216 ▶ if(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 16 200 216
639 {
640 16 ▶ Carp::croak "More than one value passed to $get_set_method()" if(@_ > 1);
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 0 16 16
641 16 $class->$adds_method($key, @_);
642 }
643 else
644 {
645 200 ▶ if($Inherited_Hash{$name}{$class}[META]{'cache_is_valid'})
Branch: 1 branch
BranchTrueFalseTotal
if ($Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[0]{"cache_is_valid"}) 194 6 200
646 {
647 194 ▶ my $cache = $Inherited_Hash{$name}{$class}[CACHE] ||= [];
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
l!l
1940
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]
Aresult
11
00
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
BranchTrueFalseTotal
unless $cache->[0]{$key} == 3 178 16 194
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
BranchTrueFalseTotal
unless $cache->[0]{$key} == 3 6 0 6
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
BranchTrueFalseTotal
if ref $class 0 42 42
666 42 return wantarray ? keys %{$class->$get_set_all_method()} :
667 0 ▶ [ keys %{$class->$get_set_all_method()} ];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 42 0 42
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
BranchTrueFalseTotal
if ref $class 0 48 48
675  
676 48 ▶ if(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 6 42 48
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] || {}
l!l
402
MC/DC100%1/1
$cache->[1] || {}
$cache->[1]
Truth table100%2/2
A
A= $cache->[1]
Aresult
11
00
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
BranchTrueFalseTotal
if $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1][0]{$k} == 3 20 108 128
688 }
689  
690 42 ▶ return wantarray ? %hash : \%hash;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 42 42
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
BranchTrueFalseTotal
ref $_[0] ? : 0 288 288
696  
697 288 my $key = shift;
698  
699 288 ▶ return 0 unless(defined $key);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key 0 288 288
700  
701 288 ▶ if($Inherited_Hash{$name}{$class}[META]{'cache_is_valid'})
Branch: 1 branch
BranchTrueFalseTotal
if ($Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[0]{"cache_is_valid"}) 212 76 288
702 {
703 212 ▶ my $cache = $Inherited_Hash{$name}{$class}[CACHE] ||= [];
Condition50%1/2
$Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}[1] ||= []
l!l
2120
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]
Aresult
11
00
704 212 ▶ return (exists $cache->[ATTRS]{$key} && $cache->[META]{$key} != DELETED_VALUE) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
exists $cache->[1]{$key} && $cache->[0]{$key} != 3 ? : 144 68 212
Condition100%3/3
exists $cache->[1]{$key} and $cache->[0]{$key} != 3
!ll&&!rl&&r
1058144
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
ABresult
0X0
100
111
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
BranchTrueFalseTotal
exists $cache->[1]{$key} && $cache->[0]{$key} != 3 ? : 68 8 76
Condition66%2/3
exists $cache->[1]{$key} and $cache->[0]{$key} != 3
!ll&&!rl&&r
8068
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
ABresult
0X0
100
111
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
BranchTrueFalseTotal
ref $_[0] ? : 0 72 72
717 72 ▶ Carp::croak("Missing name/value pair(s) to add") unless(@_);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 72 72
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] ||= []
l!l
666
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]
Aresult
11
00
723  
724 # XXX: Lame duplication to avoid copying the hash
725 72 ▶ if(@_ == 1 && ref $_[0] eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'HASH') { } 2 70 72
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
!ll&&!rl&&r
7002
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"
ABresult
0X0
100
111
726 {
727 2 ▶ while(my($attr, $value) = each(%{$_[0]}))
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$_[0];}) 6 2 8
728 {
729 6 ▶ next unless(defined $attr);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $attr 0 6 6
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
BranchTrueFalseTotal
if ($add_implies) 0 6 6
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
BranchTrueFalseTotal
if @_ % 2 0 70 70
750  
751 70 ▶ while(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 82 70 152
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
BranchTrueFalseTotal
unless defined $attr 0 82 82
759 82 $cache->[ATTRS]{$attr} = $value;
760 82 $cache->[META]{$attr} = CLASS_VALUE;
761  
762 82 ▶ if($add_implies)
Branch: 1 branch
BranchTrueFalseTotal
if ($add_implies) 28 54 82
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
BranchTrueFalseTotal
if ($count) 72 0 72
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
BranchTrueFalseTotal
if ($test_class->isa($class) and $test_class ne $class) 90 138 228
Condition100%3/3
$test_class->isa($class) and $test_class ne $class
!ll&&!rl&&r
667290
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
ABresult
0X0
100
111
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
BranchTrueFalseTotal
ref $_[0] ? : 0 8 8
796 8 my @keys = $class->$keys_method();
797 8 ▶ return unless(@keys);
Branch: 1 branch
BranchTrueFalseTotal
unless @keys 4 4 8
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
BranchTrueFalseTotal
ref $_[0] ? : 0 72 72
806 72 ▶ Carp::croak("Missing value(s) to delete") unless(@_);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 72 72
807  
808 # Init set if it doesn't exist
809 72 ▶ unless(exists $Inherited_Hash{$name}{$class})
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $Rose::Class::MakeMethods::Generic::Inherited_Hash{$name}{$class}) 6 66 72
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] ||= []
l!l
720
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]
Aresult
11
00
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
BranchTrueFalseTotal
unless defined $attr 0 82 82
822  
823 82 ▶ if(exists $cache->[ATTRS]{$attr} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $cache->[1]{$attr} and $cache->[0]{$attr} != 3) 52 30 82
Condition66%2/3
exists $cache->[1]{$attr} and $cache->[0]{$attr} != 3
!ll&&!rl&&r
30052
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
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if ($delete_implies) 32 20 52
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
BranchTrueFalseTotal
if $class eq $test_class 52 128 180
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] ||= []
l!l
1280
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]
Aresult
11
00
842  
843 128 ▶ if($test_class->isa($class) && exists $test_cache->[ATTRS]{$attr} &&
Branch: 1 branch
BranchTrueFalseTotal
if ($test_class->isa($class) and exists $test_cache->[1]{$attr} and $test_cache->[0]{$attr} == 2) 46 82 128
Condition83%5/6
$test_class->isa($class) and exists $test_cache->[1]{$attr} and $test_cache->[0]{$attr} == 2
!ll&&!rl&&r
622046
$test_class->isa($class) and exists $test_cache->[1]{$attr}
!ll&&!rl&&r
62066
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
ABCresult
0XX0
10X0
1100
1111
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
BranchTrueFalseTotal
ref $_[0] ? : 0 14 14
862 14 ▶ Carp::croak("Missing value(s) to inherit") unless(@_);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 14 14
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] ||= []
l!l
140
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]
Aresult
11
00
867  
868 14 foreach my $attr (@_)
869 {
870 14 ▶ if(exists $cache->[ATTRS]{$attr})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $cache->[1]{$attr}) 12 2 14
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
BranchTrueFalseTotal
if ($inherit_implies) 6 8 14
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
BranchTrueFalseTotal
if ($interface ne "all") 0 8 8
891 {
892 0 Carp::croak "Unknown interface: $interface";
893 }
894  
895 8 return \%methods;
896 }
897  
898  
899 3 1;
900  
901 __END__
« Object/MixIn.pm ↑ Summary Class/MakeMethods/Set.pm »