| 1 | package Rose::Class::MakeMethods::Set; | ||||||||||||||||||||||||||||||||||||||||||
| 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.81'; | |||||||||||||||||||||||||||||||||||||||||
| 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 %Inheritable_Set; | |||||||||||||||||||||||||||||||||||||||||
| 13 | # ( | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # some_attr_name => | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # class1 => | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # meta => { ... }, | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # cache => { ... }, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # class2 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 23 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # ); | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | sub inheritable_set | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inheritable_set: called CC=18 SCAR=30.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | my($class, $name, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 6 | my %methods; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | # Interface example: | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # name: required_html_attr | ||||||||||||||||||||||||||||||||||||||||||
| 35 | # plural_name: required_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 36 | # list_method: required_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 37 | # hash_method: required_html_attrs_hash | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # test_method: is_required_html_attr (or html_attr_is_required) | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # add_method: add_required_html_attr | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # adds_method: add_required_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 41 | # delete_method: delete_required_html_attr | ||||||||||||||||||||||||||||||||||||||||||
| 42 | # deletes_method: delete_required_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # clear_method: clear_required_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 6 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 6 | ▶ | my $list_method = $args->{'list_method'} || $plural_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$args->{'list_method'} || $plural_name
MC/DC0%0/2
$args->{'list_method'} || $plural_name
$args->{'list_method'}
$plural_name
Truth table66%2/3
A || B
A= $args->{'list_method'}B= $plural_name
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 6 | ▶ | my $hash_method = $args->{'hash_method'} || $plural_name . '_hash'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'hash_method'} || $plural_name . '_hash'
MC/DC0%0/1
$args->{'hash_method'} || $plural_name . '_hash'
$args->{'hash_method'}
Truth table50%1/2
A
A= $args->{'hash_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 6 | ▶ | my $test_method = $args->{'test_method'} || $args->{'test_method'} || 'is_' . $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
$args->{'test_method'} || $args->{'test_method'} || 'is_' . $name
$args->{"test_method"} or $args->{"test_method"}
MC/DC50%1/2
$args->{'test_method'} || $args->{'test_method'} || 'is_' . $name
$args->{"test_method"}
$args->{"test_method"}
Truth table66%2/3
A or B
A= $args->{"test_method"}B= $args->{"test_method"}
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 6 | ▶ | my $add_method = $args->{'add_method'} || 'add_' . $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'add_method'} || 'add_' . $name
MC/DC100%1/1
$args->{'add_method'} || 'add_' . $name
$args->{'add_method'}
Truth table100%2/2
A
A= $args->{'add_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 6 | ▶ | my $adds_method = $args->{'adds_method'} || $add_method . 's'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'adds_method'} || $add_method . 's'
MC/DC100%1/1
$args->{'adds_method'} || $add_method . 's'
$args->{'adds_method'}
Truth table100%2/2
A
A= $args->{'adds_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 6 | ▶ | my $delete_method = $args->{'delete_method'} || 'delete_' . $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'delete_method'} || 'delete_' . $name
MC/DC100%1/1
$args->{'delete_method'} || 'delete_' . $name
$args->{'delete_method'}
Truth table100%2/2
A
A= $args->{'delete_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 6 | ▶ | my $deletes_method = $args->{'deletes_method'} || 'delete_' . $plural_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'deletes_method'} || 'delete_' . $plural_name
MC/DC100%1/1
$args->{'deletes_method'} || 'delete_' . $plural_name
$args->{'deletes_method'}
Truth table100%2/2
A
A= $args->{'deletes_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 6 | ▶ | my $clear_method = $args->{'clear_method'} || 'clear_' . $plural_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args->{'clear_method'} || 'clear_' . $plural_name
MC/DC100%1/1
$args->{'clear_method'} || 'clear_' . $plural_name
$args->{'clear_method'}
Truth table100%2/2
A
A= $args->{'clear_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 6 | ▶ | my $value_method = $args->{'value_method'} || $name . '_value'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'value_method'} || $name . '_value'
MC/DC0%0/1
$args->{'value_method'} || $name . '_value'
$args->{'value_method'}
Truth table50%1/2
A
A= $args->{'value_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 6 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 6 | my $add_implies = $args->{'add_implies'}; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 6 | my $delete_implies = $args->{'delete_implies'}; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 6 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | if(defined $add_implies && !ref $add_implies); | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 6 | ▶ | $delete_implies = [ $delete_implies ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $delete_implies and not ref $delete_implies
MC/DC0%0/2
defined $delete_implies and not ref $delete_implies
defined $delete_implies
not ref $delete_implies
Truth table33%1/3
A and not(B)
A= defined $delete_impliesB= not ref $delete_implies
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | if(defined $delete_implies && !ref $delete_implies); | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | $methods{$test_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 22 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 22 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 22 | ▶ | return 0 unless(defined $_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 22 | ▶ | return 1 if(exists $class->$hash_method()->{$_[0]}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 4 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 76 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | $methods{$hash_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 67 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=23.1
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 67 | ▶ | 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]
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 67 | ▶ | unless(exists $Inheritable_Set{$name}{$class}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | { | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 14 | my @parents = ($class); | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 14 | ▶ | while(my $parent = shift(@parents)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 30 | foreach my $subclass (@{$parent . '::ISA'}) | |||||||||||||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 16 | push(@parents, $subclass); | |||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 16 | ▶ | if(exists $Inheritable_Set{$name}{$subclass}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | { | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 8 | ▶ | while(my($k, $v) = each(%{$Inheritable_Set{$name}{$subclass}})) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 22 | ▶ | next if(exists $Inheritable_Set{$name}{$class}{$k}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 16 | $Inheritable_Set{$name}{$class}{$k} = $v; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 67 | ▶ | $Inheritable_Set{$name}{$class} ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Rose::Class::MakeMethods::Set::Inheritable_Set{$name}{$class} ||= {}
MC/DC100%1/1
$Rose::Class::MakeMethods::Set::Inheritable_Set{$name}{$class} ||= {}
$Rose::Class::MakeMethods::Set::Inheritable_Set{$name}{$class}
Truth table100%2/2
A
A= $Rose::Class::MakeMethods::Set::Inheritable_Set{$name}{$class}
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | return wantarray ? %{$Inheritable_Set{$name}{$class}} : | |||||||||||||||||||||||||||||||||||||||||
| 109 | 67 | ▶ | $Inheritable_Set{$name}{$class}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | $methods{$list_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=21.6
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 14 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 14 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 14 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | { | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $class->$clear_method(); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $class->$adds_method(@_); | |||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | return unless(defined wantarray); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 14 | return wantarray ? sort keys %{$class->$hash_method()} : | |||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | [ sort keys %{$class->$hash_method()} ]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 6 | ▶ | $methods{$add_method} = sub { shift->$adds_method(@_) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | $methods{$adds_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=11 SCAR=24.3
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 9 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 9 | ▶ | Carp::croak("Missing value(s) to add") unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 9 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 9 | my $req_hash = $class->$hash_method(); | |||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 9 | ▶ | return 0 unless(defined $_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 7 | my %attrs; | |||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 7 | foreach my $arg (grep { defined } @_) | |||||||||||||||||||||||||||||||||||||||||
| 144 | { | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 13 | ▶ | if(ref $arg eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $attrs{$_} = $arg->{$_} for(keys %$arg); | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | else | ||||||||||||||||||||||||||||||||||||||||||
| 150 | { | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 13 | $attrs{$arg} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 7 | ▶ | while(my($attr, $val) = each(%attrs)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 13 | ▶ | next unless(defined $attr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 13 | $req_hash->{$attr} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 13 | ▶ | if($add_implies) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | { | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 6 | foreach my $method (@$add_implies) | |||||||||||||||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 6 | $class->$method($attr); | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 13 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 7 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | $methods{$clear_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 4 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 4 | my @values = $class->$list_method(); | |||||||||||||||||||||||||||||||||||||||||
| 179 | 4 | ▶ | return unless(@values); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | $class->$deletes_method(@values); | |||||||||||||||||||||||||||||||||||||||||
| 181 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 6 | ▶ | $methods{$delete_method} = sub { shift->$deletes_method(@_) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | $methods{$deletes_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=22.2
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 4 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | ▶ | Carp::croak("Missing value(s) to delete") unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 4 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | my $req_hash = $class->$hash_method(); | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 4 | foreach my $attr (@_) | |||||||||||||||||||||||||||||||||||||||||
| 194 | { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | 6 | ▶ | next unless(defined $attr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 6 | ▶ | next unless(exists $req_hash->{$attr}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 6 | delete $req_hash->{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 6 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 6 | ▶ | if($delete_implies) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | { | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | foreach my $method (@$delete_implies) | |||||||||||||||||||||||||||||||||||||||||
| 204 | { | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $class->$method($attr); | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 4 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | $methods{$value_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 18 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.5
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 18 | ▶ | 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]
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 18 | my $hash = $class->$hash_method(); | |||||||||||||||||||||||||||||||||||||||||
| 218 | 18 | ▶ | return undef unless($_[1] && exists $hash->{$_[1]}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_[1] and exists $$hash{$_[1]}
MC/DC50%1/2
$_[1] and exists $$hash{$_[1]}
$_[1]
exists $$hash{$_[1]}
Truth table66%2/3
A and B
A= $_[1]B= exists $$hash{$_[1]}
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 8 | ▶ | return $hash->{$_[1]} = $_[2] if(@_ > 2); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 3 | return $hash->{$_[1]}; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 6 | ▶ | if($interface ne 'all') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | Carp::croak "Unknown interface: $interface"; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 6 | return \%methods; | |||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 3 | ▶ | use constant CLASS_VALUE => 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 3 | ▶ | use constant INHERITED_VALUE => 2; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 3 | ▶ | use constant DELETED_VALUE => 3; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 3 | our %Inherited_Set; | |||||||||||||||||||||||||||||||||||||||||
| 236 | # ( | ||||||||||||||||||||||||||||||||||||||||||
| 237 | # some_attr_name => | ||||||||||||||||||||||||||||||||||||||||||
| 238 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 239 | # class1 => | ||||||||||||||||||||||||||||||||||||||||||
| 240 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 241 | # meta => { ... }, | ||||||||||||||||||||||||||||||||||||||||||
| 242 | # cache => { ... }, | ||||||||||||||||||||||||||||||||||||||||||
| 243 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 244 | # class2 => ..., | ||||||||||||||||||||||||||||||||||||||||||
| 245 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 246 | # }, | ||||||||||||||||||||||||||||||||||||||||||
| 247 | # ... | ||||||||||||||||||||||||||||||||||||||||||
| 248 | # ); | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | sub inherited_set | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inherited_set: called CC=22 SCAR=32.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 4 | my($class, $name, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 4 | my %methods; | |||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | # Interface example: | ||||||||||||||||||||||||||||||||||||||||||
| 257 | # name: valid_html_attr | ||||||||||||||||||||||||||||||||||||||||||
| 258 | # plural_name: valid_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 259 | # list_method: valid_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 260 | # cache_method: valid_html_attrs_cache | ||||||||||||||||||||||||||||||||||||||||||
| 261 | # hash_method: valid_html_attrs_hash | ||||||||||||||||||||||||||||||||||||||||||
| 262 | # test_method: is_valid_html_attr (or html_attr_is_valid) | ||||||||||||||||||||||||||||||||||||||||||
| 263 | # add_method: add_valid_html_attr | ||||||||||||||||||||||||||||||||||||||||||
| 264 | # adds_method: add_valid_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 265 | # delete_method: delete_valid_html_attr | ||||||||||||||||||||||||||||||||||||||||||
| 266 | # deletes_method: delete_valid_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 267 | # clear_method clear_valid_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 268 | # inherit_method: inherit_valid_html_attr | ||||||||||||||||||||||||||||||||||||||||||
| 269 | # inherits_method: inherit_valid_html_attrs | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 4 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 4 | ▶ | my $list_method = $args->{'list_method'} || $plural_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'list_method'} || $plural_name
MC/DC0%0/2
$args->{'list_method'} || $plural_name
$args->{'list_method'}
$plural_name
Truth table33%1/3
A || B
A= $args->{'list_method'}B= $plural_name
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 4 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 4 | ▶ | my $hash_method = $args->{'hash_method'} || $plural_name . '_hash'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'hash_method'} || $plural_name . '_hash'
MC/DC0%0/1
$args->{'hash_method'} || $plural_name . '_hash'
$args->{'hash_method'}
Truth table50%1/2
A
A= $args->{'hash_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 4 | ▶ | my $test_method = $args->{'test_method'} || $args->{'test_method'} || 'is_' . $name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$args->{'test_method'} || $args->{'test_method'} || 'is_' . $name
$args->{"test_method"} or $args->{"test_method"}
MC/DC0%0/2
$args->{'test_method'} || $args->{'test_method'} || 'is_' . $name
$args->{"test_method"}
$args->{"test_method"}
Truth table33%1/3
A or B
A= $args->{"test_method"}B= $args->{"test_method"}
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 4 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 4 | ▶ | my $adds_method = $args->{'adds_method'} || $add_method . 's'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'adds_method'} || $add_method . 's'
MC/DC0%0/1
$args->{'adds_method'} || $add_method . 's'
$args->{'adds_method'}
Truth table50%1/2
A
A= $args->{'adds_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 4 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | 4 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 4 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 4 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 4 | ▶ | my $inherits_method = $args->{'inherits_method'} || $inherit_method . 's'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{'inherits_method'} || $inherit_method . 's'
MC/DC0%0/1
$args->{'inherits_method'} || $inherit_method . 's'
$args->{'inherits_method'}
Truth table50%1/2
A
A= $args->{'inherits_method'}
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 4 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 4 | my $add_implies = $args->{'add_implies'}; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 4 | my $delete_implies = $args->{'delete_implies'}; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 4 | my $inherit_implies = $args->{'inherit_implies'}; | |||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 4 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | if(defined $add_implies && !ref $add_implies); | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 4 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | if(defined $delete_implies && !ref $delete_implies); | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 4 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | if(defined $inherit_implies && !ref $inherit_implies); | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | $methods{$cache_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 200 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=19 SCAR=33.0
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 200 | ▶ | 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]
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 200 | ▶ | if($Inherited_Set{$name}{$class}{'meta'}{'cache_is_valid'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | { | ||||||||||||||||||||||||||||||||||||||||||
| 306 | return | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 8 | ▶ | wantarray ? (%{$Inherited_Set{$name}{$class}{'cache'} ||= {}}) : | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"} ||= {}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"} ||= {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"} ||= {}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}
MC/DC0%0/1
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"} ||= {}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 112 | ▶ | ($Inherited_Set{$name}{$class}{'cache'} ||= {}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 88 | my @parents = ($class); | |||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 88 | ▶ | while(my $parent = shift(@parents)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | { | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 194 | foreach my $subclass (@{$parent . '::ISA'}) | |||||||||||||||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 106 | push(@parents, $subclass); | |||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 106 | ▶ | if($subclass->can($cache_method)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | { | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 106 | my $cache = $subclass->$cache_method(); | |||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 106 | ▶ | while(my($attr, $val) = each %$cache) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | { | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 440 | ▶ | next if($val == DELETED_VALUE); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | $Inherited_Set{$name}{$class}{'cache'}{$attr} = INHERITED_VALUE | ||||||||||||||||||||||||||||||||||||||||||
| 328 | 268 | ▶ | unless(exists $Inherited_Set{$name}{$class}{'cache'}{$attr}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | # Slower method for subclasses that don't want to implement the | ||||||||||||||||||||||||||||||||||||||||||
| 332 | # cache method (which is not strictly part of the public API) | ||||||||||||||||||||||||||||||||||||||||||
| 333 | elsif($subclass->can($list_method)) | ||||||||||||||||||||||||||||||||||||||||||
| 334 | { | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | foreach my $attr ($subclass->$list_method()) | |||||||||||||||||||||||||||||||||||||||||
| 336 | { | ||||||||||||||||||||||||||||||||||||||||||
| 337 | $Inherited_Set{$name}{$class}{'cache'}{$attr} = INHERITED_VALUE | ||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | unless(exists $Inherited_Set{$name}{$class}{'cache'}{$attr}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | 88 | $Inherited_Set{$name}{$class}{'meta'}{'cache_is_valid'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | 88 | my $want = wantarray; | |||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 88 | ▶ | return unless(defined $want); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | $want ? (%{$Inherited_Set{$name}{$class}{'cache'} ||= {}}) : | ||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"} ||= {}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"} ||= {}
MC/DC0%0/1
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"} ||= {}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}
MC/DC0%0/1
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"} ||= {}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}
Truth table0%0/2
A
A= $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}
Truth table50%1/2
A
A= $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 82 | ▶ | ($Inherited_Set{$name}{$class}{'cache'} ||= {}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | $methods{$hash_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.6
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 8 | ▶ | 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]
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 8 | my %hash = $class->$cache_method(); | |||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 8 | ▶ | while(my($k, $v) = each %hash) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | { | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 36 | ▶ | delete $hash{$k} if($v == DELETED_VALUE); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 8 | ▶ | return wantarray ? %hash : \%hash; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | $methods{$list_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 368 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=21.6
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 8 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 8 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 8 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | { | ||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $class->$clear_method(); | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | $class->$adds_method(@_); | |||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | return unless(defined wantarray); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | 8 | return wantarray ? sort keys %{$class->$hash_method()} : | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | [ sort keys %{$class->$hash_method()} ]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | $methods{$test_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 385 | 304 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=21.0
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | 304 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | 304 | ▶ | return 0 unless(defined $_[0]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 304 | ▶ | if($Inherited_Set{$name}{$class}{'meta'}{'cache_is_valid'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | { | ||||||||||||||||||||||||||||||||||||||||||
| 391 | return (exists $Inherited_Set{$name}{$class}{'cache'}{$_[0]} && | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 224 | ▶ | $Inherited_Set{$name}{$class}{'cache'}{$_[0]} != DELETED_VALUE) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$_[0]} and $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$_[0]} != 3
MC/DC100%2/2
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$_[0]} and $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$_[0]} != 3
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$_[0]}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$_[0]} != 3
Truth table100%3/3
A and B
A= exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$_[0]}B= $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$_[0]} != 3
| |||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | 80 | my $cache = $class->$cache_method(); | |||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 80 | ▶ | return (exists $cache->{$_[0]} && $cache->{$_[0]} != DELETED_VALUE) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $$cache{$_[0]} and $$cache{$_[0]} != 3
MC/DC50%1/2
exists $$cache{$_[0]} and $$cache{$_[0]} != 3
exists $$cache{$_[0]}
$$cache{$_[0]} != 3
Truth table66%2/3
A and B
A= exists $$cache{$_[0]}B= $$cache{$_[0]} != 3
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 4 | ▶ | $methods{$add_method} = sub { shift->$adds_method(@_) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | $methods{$adds_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 403 | 62 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=11 SCAR=24.2
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | 62 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 62 | ▶ | Carp::croak("Missing value(s) to add") unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 62 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 62 | foreach my $attr (@_) | |||||||||||||||||||||||||||||||||||||||||
| 410 | { | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 70 | ▶ | next unless(defined $attr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | 70 | $Inherited_Set{$name}{$class}{'cache'}{$attr} = CLASS_VALUE; | |||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 70 | ▶ | if($add_implies) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | { | ||||||||||||||||||||||||||||||||||||||||||
| 417 | 22 | foreach my $method (@$add_implies) | |||||||||||||||||||||||||||||||||||||||||
| 418 | { | ||||||||||||||||||||||||||||||||||||||||||
| 419 | 22 | $class->$method($attr); | |||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 70 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | # _invalidate_inherited_set_caches($class, $name) if($count); | ||||||||||||||||||||||||||||||||||||||||||
| 427 | # Inlined since it is private and only called once | ||||||||||||||||||||||||||||||||||||||||||
| 428 | 62 | ▶ | if($count) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 429 | { | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 62 | foreach my $test_class (keys %{$Inherited_Set{$name}}) | |||||||||||||||||||||||||||||||||||||||||
| 431 | { | ||||||||||||||||||||||||||||||||||||||||||
| 432 | 222 | ▶ | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | { | ||||||||||||||||||||||||||||||||||||||||||
| 434 | 96 | $Inherited_Set{$name}{$test_class}{'meta'}{'cache_is_valid'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 62 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 440 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | $methods{$clear_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | 2 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | 2 | my @values = $class->$list_method(); | |||||||||||||||||||||||||||||||||||||||||
| 446 | 2 | ▶ | return unless(@values); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 2 | $class->$deletes_method(@values); | |||||||||||||||||||||||||||||||||||||||||
| 448 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | 4 | ▶ | $methods{$delete_method} = sub { shift->$deletes_method(@_) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | $methods{$deletes_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 60 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=15 SCAR=27.2
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 60 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | 60 | ▶ | Carp::croak("Missing value(s) to delete") unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | # Init set if it doesn't exist | ||||||||||||||||||||||||||||||||||||||||||
| 458 | 60 | ▶ | unless(exists $Inherited_Set{$name}{$class}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 459 | { | ||||||||||||||||||||||||||||||||||||||||||
| 460 | 6 | $class->$cache_method(); | |||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 60 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | 60 | foreach my $attr (@_) | |||||||||||||||||||||||||||||||||||||||||
| 466 | { | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 3 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 66 | ▶ | next unless(defined $attr); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | 66 | ▶ | if(exists $Inherited_Set{$name}{$class}{'cache'}{$attr} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} and $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} != 3
MC/DC50%1/2
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} and $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} != 3
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} != 3
Truth table66%2/3
A and B
A= exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr}B= $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} != 3
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | $Inherited_Set{$name}{$class}{'cache'}{$attr} != DELETED_VALUE) | ||||||||||||||||||||||||||||||||||||||||||
| 472 | { | ||||||||||||||||||||||||||||||||||||||||||
| 473 | 44 | $Inherited_Set{$name}{$class}{'cache'}{$attr} = DELETED_VALUE; | |||||||||||||||||||||||||||||||||||||||||
| 474 | 44 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||
| 476 | 44 | ▶ | if($delete_implies) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | { | ||||||||||||||||||||||||||||||||||||||||||
| 478 | 26 | foreach my $method (@$delete_implies) | |||||||||||||||||||||||||||||||||||||||||
| 479 | { | ||||||||||||||||||||||||||||||||||||||||||
| 480 | 26 | $class->$method($attr); | |||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 44 | foreach my $test_class (keys %{$Inherited_Set{$name}}) | |||||||||||||||||||||||||||||||||||||||||
| 485 | { | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 172 | ▶ | next if($class eq $test_class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||
| 488 | 128 | ▶ | if($test_class->isa($class) && exists $Inherited_Set{$name}{$test_class}{'cache'}{$attr} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$test_class->isa($class) and exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$test_class}{"cache"}{$attr} and $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$test_class}{"cache"}{$attr} == 2
$test_class->isa($class) and exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$test_class}{"cache"}{$attr}
MC/DC100%3/3
$test_class->isa($class) and exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$test_class}{"cache"}{$attr} and $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$test_class}{"cache"}{$attr} == 2
$test_class->isa($class)
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$test_class}{"cache"}{$attr}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$test_class}{"cache"}{$attr} == 2
Truth table100%4/4
A and B and C
A= $test_class->isa($class)B= exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$test_class}{"cache"}{$attr}C= $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$test_class}{"cache"}{$attr} == 2
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | $Inherited_Set{$name}{$test_class}{'cache'}{$attr} == INHERITED_VALUE) | ||||||||||||||||||||||||||||||||||||||||||
| 490 | { | ||||||||||||||||||||||||||||||||||||||||||
| 491 | 40 | delete $Inherited_Set{$name}{$test_class}{'cache'}{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 492 | 40 | $Inherited_Set{$name}{$test_class}{'meta'}{'cache_is_valid'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | # Not required | ||||||||||||||||||||||||||||||||||||||||||
| 499 | #_invalidate_inherited_set_caches($class, $name) if($count); | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 60 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 502 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||
| 504 | 4 | ▶ | $methods{$inherit_method} = sub { shift->$inherits_method(@_) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | $methods{$inherits_method} = sub | ||||||||||||||||||||||||||||||||||||||||||
| 507 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=21.0
| |||||||||||||||||||||||||||||||||||||||||||
| 508 | 10 | ▶ | my($class) = ref($_[0]) ? ref(shift) : shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | 10 | ▶ | Carp::croak("Missing value(s) to inherit") unless(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | 10 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | 10 | foreach my $attr (@_) | |||||||||||||||||||||||||||||||||||||||||
| 514 | { | ||||||||||||||||||||||||||||||||||||||||||
| 515 | 10 | ▶ | if(exists $Inherited_Set{$name}{$class}{'cache'}{$attr} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} and $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} == 3
MC/DC50%1/2
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} and $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} == 3
exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr}
$Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} == 3
Truth table66%2/3
A and B
A= exists $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr}B= $Rose::Class::MakeMethods::Set::Inherited_Set{$name}{$class}{"cache"}{$attr} == 3
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | $Inherited_Set{$name}{$class}{'cache'}{$attr} == DELETED_VALUE) | ||||||||||||||||||||||||||||||||||||||||||
| 517 | { | ||||||||||||||||||||||||||||||||||||||||||
| 518 | 8 | delete $Inherited_Set{$name}{$class}{'cache'}{$attr}; | |||||||||||||||||||||||||||||||||||||||||
| 519 | 8 | $Inherited_Set{$name}{$class}{'meta'}{'cache_is_valid'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 520 | 8 | $count++; | |||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | 10 | ▶ | if($inherit_implies) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | { | ||||||||||||||||||||||||||||||||||||||||||
| 525 | 4 | foreach my $method (@$inherit_implies) | |||||||||||||||||||||||||||||||||||||||||
| 526 | { | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 4 | $class->$method($attr); | |||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||
| 532 | 10 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 533 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 4 | ▶ | if($interface ne 'all') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | { | ||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | Carp::croak "Unknown interface: $interface"; | |||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | 4 | return \%methods; | |||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | # Inlined above since it is private and only called once | ||||||||||||||||||||||||||||||||||||||||||
| 544 | # sub _invalidate_inherited_set_caches | ||||||||||||||||||||||||||||||||||||||||||
| 545 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 546 | # my($class, $name) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 547 | # | ||||||||||||||||||||||||||||||||||||||||||
| 548 | # foreach my $test_class (keys %{$Inherited_Set{$name}}) | ||||||||||||||||||||||||||||||||||||||||||
| 549 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 550 | # if($test_class->isa($class) && $test_class ne $class) | ||||||||||||||||||||||||||||||||||||||||||
| 551 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 552 | # $Inherited_Set{$name}{$test_class}{'meta'}{'cache_is_valid'} = 0; | ||||||||||||||||||||||||||||||||||||||||||
| 553 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 554 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 555 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | __END__ | ||||||||||||||||||||||||||||||||||||||||||