| 1 | package Rose::DB::Object::Metadata::MethodMaker; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 61 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 61 | ▶ | use Carp(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 61 | ▶ | use Clone(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 61 | ▶ | use Rose::Object::MakeMethods::Generic; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 61 | ▶ | use Rose::DB::Object::Metadata::Object; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 61 | our @ISA = qw(Rose::DB::Object::Metadata::Object); | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 61 | our $VERSION = '0.769'; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # Class data | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | use Rose::Class::MakeMethods::Set | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 61 | ▶ | ( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 61 | inherited_set => | |||||||||||||||||||||||||||||||||||||||||
| 22 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 'common_method_maker_argument_name', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 'default_auto_method_type', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 61 | ); | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | # | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # Object data | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 61 | Rose::Object::MakeMethods::Generic->make_methods | |||||||||||||||||||||||||||||||||||||||||
| 33 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 34 | { preserve_existing => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | scalar => | ||||||||||||||||||||||||||||||||||||||||||
| 36 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 'name', | ||||||||||||||||||||||||||||||||||||||||||
| 38 | __PACKAGE__->common_method_maker_argument_names, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | array => | ||||||||||||||||||||||||||||||||||||||||||
| 42 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 'auto_method_types' => { interface => 'get_set_init' }, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 'add_auto_method_types' => | ||||||||||||||||||||||||||||||||||||||||||
| 45 | { | ||||||||||||||||||||||||||||||||||||||||||
| 46 | interface => 'push', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | init_method => 'init_auto_method_types', | ||||||||||||||||||||||||||||||||||||||||||
| 48 | hash_key => 'auto_method_types' , | ||||||||||||||||||||||||||||||||||||||||||
| 49 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 61 | *method_types = \&auto_method_types; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 61 | *add_method_types = \&add_auto_method_types; | |||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | # | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # Class methods | ||||||||||||||||||||||||||||||||||||||||||
| 58 | # | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 61 | our %Method_Maker_Info; | |||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | OVERRIDE: | ||||||||||||||||||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 61 | my $orig_add_method = \&add_common_method_maker_argument_names; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 61 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | *add_common_method_maker_argument_names = sub | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 319 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=19.7
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 319 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 319 | ▶ | if(@_ && $Method_Maker_Info{$class}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
MC/DC0%0/2
@_ and $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
@_
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
Truth table33%1/3
A and B
A= @_B= $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | foreach my $type (keys %{$Method_Maker_Info{$class}}) | |||||||||||||||||||||||||||||||||||||||||
| 74 | { | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | push(@{$Method_Maker_Info{$class}{$type}{'args'}}, @_); | |||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 319 | $orig_add_method->($class, @_); | |||||||||||||||||||||||||||||||||||||||||
| 80 | 61 | }; | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 61 | my $orig_delete_method = \&delete_common_method_maker_argument_names; | |||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | *delete_common_method_maker_argument_names = sub | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=19.7
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | ▶ | if(@_ && $Method_Maker_Info{$class}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
MC/DC0%0/2
@_ and $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
@_
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
Truth table33%1/3
A and B
A= @_B= $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | foreach my $type (keys %{$Method_Maker_Info{$class}}) | |||||||||||||||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | delete @{$Method_Maker_Info{$class}{$type}{'args'}}{@_}; | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | $orig_delete_method->($class, @_); | |||||||||||||||||||||||||||||||||||||||||
| 97 | 61 | }; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 285 | ▶ | sub init_auto_method_types { shift->default_auto_method_types } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_auto_method_types: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | # This is basically a Rose::Class::MakeMethods::Set::inherited_set | ||||||||||||||||||||||||||||||||||||||||||
| 103 | # but it's keyed. I'm only implementing a one-time superclass copy | ||||||||||||||||||||||||||||||||||||||||||
| 104 | # here, instead of the more involved "inherited_set" version where | ||||||||||||||||||||||||||||||||||||||||||
| 105 | # values can be permanently deleted or re-inherited. | ||||||||||||||||||||||||||||||||||||||||||
| 106 | sub init_method_maker_info | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 1466 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_method_maker_info: called CC=13 SCAR=25.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 1466 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 1466 | my $info = $Method_Maker_Info{$class}; | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 1466 | ▶ | unless($info && %$info) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$info and %$info
MC/DC50%1/2
$info and %$info
$info
%$info
Truth table66%2/3
A and B
A= $infoB= %$info
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 64 | my @parents = ($class); | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 64 | ▶ | while(my $parent = shift(@parents)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | { | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 61 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 275 | foreach my $subclass (@{$parent . '::ISA'}) | |||||||||||||||||||||||||||||||||||||||||
| 120 | { | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 211 | push(@parents, $subclass); | |||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 211 | ▶ | next unless($subclass->can('init_method_maker_info')); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 83 | my $subclass_info = $subclass->init_method_maker_info; | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 83 | ▶ | $info ||= $Method_Maker_Info{$class} ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition60%3/5
$info ||= ($Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} ||= {})
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} ||= {}
MC/DC0%0/2
$info ||= ($Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} ||= {})
$info
($Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} ||= {})
MC/DC0%0/1
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} ||= {}
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
Truth table66%2/3
A ||= B
A= $infoB= ($Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} ||= {})
Truth table50%1/2
A
A= $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 83 | foreach my $type ($subclass->available_method_types) | |||||||||||||||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 152 | ▶ | next unless($subclass_info->{$type}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 152 | foreach my $attr (qw(class type interface)) | |||||||||||||||||||||||||||||||||||||||||
| 134 | { | ||||||||||||||||||||||||||||||||||||||||||
| 135 | next if(!$subclass_info->{$type}{$attr} || | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 456 | ▶ | defined $info->{$type}{$attr}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $subclass_info->{$type}{$attr} or defined $info->{$type}{$attr}
MC/DC100%2/2
not $subclass_info->{$type}{$attr} or defined $info->{$type}{$attr}
not $subclass_info->{$type}{$attr}
defined $info->{$type}{$attr}
Truth table100%3/3
not(A) or B
A= not $subclass_info->{$type}{$attr}B= defined $info->{$type}{$attr}
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 194 | $info->{$type}{$attr} = Clone::clone($subclass_info->{$type}{$attr}); | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | # Args come from an already-inherited set | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 152 | $info->{$type}{'args'} = [ $class->common_method_maker_argument_names ]; | |||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 1466 | return $info; | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | sub method_maker_info | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 186 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_maker_info: called CC=8 SCAR=22.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | 186 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 186 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 186 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | { | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 817 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 817 | my $info = shift; | |||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 817 | ▶ | Carp::confess "Method maker info must be passed in type/hashref pairs" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $type and ref $info and ref $info eq "HASH"
defined $type and ref $info
MC/DC0%0/3
defined $type and ref $info and ref $info eq "HASH"
defined $type
ref $info
ref $info eq "HASH"
Truth table25%1/4
A and B and C
A= defined $typeB= ref $infoC= ref $info eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | unless(defined $type && ref $info && ref $info eq 'HASH'); | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 817 | ▶ | my $mm_info = $Method_Maker_Info{$class}{$type} ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type} ||= {}
MC/DC0%0/1
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type} ||= {}
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type}
Truth table50%1/2
A
A= $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type}
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 817 | ▶ | while(my($key, $value) = each(%$info)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | { | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 2207 | $mm_info->{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 186 | $class->init_method_maker_info; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 186 | return $Method_Maker_Info{$class}; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | sub add_method_maker_argument_names | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_method_maker_argument_names: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | { | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my $new_names = shift; | |||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | Carp::confess "Method maker argument names must be passed in type/arrayref pairs" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $type and ref $new_names and ref $new_names eq "ARRAY"
defined $type and ref $new_names
MC/DC0%0/3
defined $type and ref $new_names and ref $new_names eq "ARRAY"
defined $type
ref $new_names
ref $new_names eq "ARRAY"
Truth table0%0/4
A and B and C
A= defined $typeB= ref $new_namesC= ref $new_names eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | unless(defined $type && ref $new_names && ref $new_names eq 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $names = $class->method_maker_argument_names($type); | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | push(@$names, @$new_names); | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | sub method_maker_argument_names | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 371 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_maker_argument_names: called CC=11 SCAR=32.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 371 | my($class, $type) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 371 | ▶ | Carp::confess "Missing required type argument" unless(defined $type); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 371 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 371 | $class->init_method_maker_info; | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 371 | ▶ | my $mm_info = $Method_Maker_Info{$class}{$type} ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type} ||= {}
MC/DC0%0/1
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type} ||= {}
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type}
Truth table50%1/2
A
A= $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type}
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 371 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | { | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if(@_ == 1 && ref $_[0] && ref $_[0] eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
@_ == 1 and ref $_[0] and ref $_[0] eq "ARRAY"
@_ == 1 and ref $_[0]
MC/DC0%0/3
@_ == 1 and ref $_[0] and ref $_[0] eq "ARRAY"
@_ == 1
ref $_[0]
ref $_[0] eq "ARRAY"
Truth table0%0/4
A and B and C
A= @_ == 1B= ref $_[0]C= ref $_[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $mm_info->{'args'} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | else | ||||||||||||||||||||||||||||||||||||||||||
| 217 | { | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $mm_info->{'args'} = [ @_ ]; | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 371 | ▶ | unless(defined $mm_info->{'args'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | { | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 15 | ▶ | $mm_info->{'args'} = $class->common_method_maker_argument_names || []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$class->common_method_maker_argument_names || []
MC/DC0%0/1
$class->common_method_maker_argument_names || []
$class->common_method_maker_argument_names
Truth table50%1/2
A
A= $class->common_method_maker_argument_names
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 371 | return wantarray ? @{$mm_info->{'args'}} : | |||||||||||||||||||||||||||||||||||||||||
| 228 | 371 | ▶ | $mm_info->{'args'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | sub method_maker_class | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 386 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_maker_class: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 386 | my($class, $type) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 386 | ▶ | Carp::confess "Missing required type argument" unless(defined $type); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 386 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 386 | $class->init_method_maker_info; | |||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 386 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | { | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 15 | return $Method_Maker_Info{$class}{$type}{'class'} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 371 | return $Method_Maker_Info{$class}{$type}{'class'}; | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | sub method_maker_type | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 440 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_maker_type: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 440 | my($class, $type) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 440 | ▶ | Carp::confess "Missing required type argument" unless(defined $type); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 440 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 440 | $class->init_method_maker_info; | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 440 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | { | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 69 | return $Method_Maker_Info{$class}{$type}{'type'} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 371 | return $Method_Maker_Info{$class}{$type}{'type'}; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | sub available_method_types | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 106 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
available_method_types: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 106 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 269 | 106 | ▶ | $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 106 | ▶ | if($Method_Maker_Info{$class} && %{$Method_Maker_Info{$class}}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} and %{$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class};}
MC/DC100%2/2
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} and %{$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class};}
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
%{$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class};}
Truth table100%3/3
A and B
A= $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}B= %{$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class};}
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | { | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 50 | ▶ | return sort keys %{$Method_Maker_Info{$class} ||= {}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} ||= {}
MC/DC0%0/1
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class} ||= {}
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
Truth table50%1/2
A
A= $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 56 | return; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | # sub default_method_name | ||||||||||||||||||||||||||||||||||||||||||
| 280 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 281 | # my($class, $type) = (shift, shift); | ||||||||||||||||||||||||||||||||||||||||||
| 282 | # | ||||||||||||||||||||||||||||||||||||||||||
| 283 | # Carp::confess "Missing required type argument" unless(defined $type); | ||||||||||||||||||||||||||||||||||||||||||
| 284 | # | ||||||||||||||||||||||||||||||||||||||||||
| 285 | # $class = ref $class if(ref $class); | ||||||||||||||||||||||||||||||||||||||||||
| 286 | # | ||||||||||||||||||||||||||||||||||||||||||
| 287 | # if(@_) | ||||||||||||||||||||||||||||||||||||||||||
| 288 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 289 | # return $Method_Maker_Info{$class}{$type}{'name'} = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 290 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | # | ||||||||||||||||||||||||||||||||||||||||||
| 292 | # return $Method_Maker_Info{$class}{$type}{'name'} ||= | ||||||||||||||||||||||||||||||||||||||||||
| 293 | # $class->build_method_name_for_type($type); | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | # | ||||||||||||||||||||||||||||||||||||||||||
| 297 | # Object methods | ||||||||||||||||||||||||||||||||||||||||||
| 298 | # | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 148 | ▶ | sub hash_key { shift->name } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hash_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | sub methods | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
methods: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 7 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | 7 | ▶ | my %args = (@_ == 1) ? %{$_[0]} : @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 7 | $self->add_auto_method_types(keys %args); | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 7 | ▶ | while(my($type, $name) = each(%args)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | { | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 21 | ▶ | $self->method_name($type => $name) if(defined $name); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | sub method_name | ||||||||||||||||||||||||||||||||||||||||||
| 319 | 2553 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_name: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 2553 | my($self, $type) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 2553 | ▶ | Carp::confess "Missing required type argument" unless(defined $type); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 2553 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | { | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 424 | return $self->{'method_name'}{$type} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 2129 | return $self->{'method_name'}{$type}; | |||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | sub method_uses_formatted_key | ||||||||||||||||||||||||||||||||||||||||||
| 333 | 286 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_uses_formatted_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 286 | my($self, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 286 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | sub method_should_set | ||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_should_set: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my($self, $type, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | return 1 if($type eq 'set'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | return 0 if($type eq 'get'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | # $args is a reference to the method args *including* the invocant | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | return @$args > 1 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | sub build_method_name_for_type { Carp::confess "Override in subclass" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_method_name_for_type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | sub defined_method_types | ||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
defined_method_types: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | my @types = sort keys %{$self->{'method_name'} ||= {}}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"method_name"} ||= {}
MC/DC0%0/1
$self->{"method_name"} ||= {}
$self->{"method_name"}
Truth table0%0/2
A
A= $self->{"method_name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | return wantarray ? @types : \@types; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | sub method_maker_arguments | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 371 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_maker_arguments: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | 371 | my($self, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 371 | my $class = ref $self; | |||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 371 | ▶ | Carp::confess "Missing required type argument" unless(defined $type); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | 371 | my %opts = map { $_ => scalar $self->$_() } grep { defined scalar $self->$_() } | |||||||||||||||||||||||||||||||||||||||||
| 368 | $class->method_maker_argument_names($type); | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | # This is done by method_maker_argument_names() above | ||||||||||||||||||||||||||||||||||||||||||
| 371 | #$class->init_method_maker_info; | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 371 | ▶ | my $mm_info = $Method_Maker_Info{$class}{$type} ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type} ||= {}
MC/DC0%0/1
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type} ||= {}
$Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type}
Truth table50%1/2
A
A= $Rose::DB::Object::Metadata::MethodMaker::Method_Maker_Info{$class}{$type}
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 371 | ▶ | $opts{'interface'} = $mm_info->{'interface'} if(exists $mm_info->{'interface'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | 371 | ▶ | return wantarray ? %opts : \%opts; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | sub make_methods | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 271 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_methods: called CC=14 SCAR=31.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 271 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 271 | ▶ | my $options = $args{'options'} || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'options'} || {}
MC/DC0%0/1
$args{'options'} || {}
$args{'options'}
Truth table50%1/2
A
A= $args{'options'}
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 271 | ▶ | if(exists $args{'preserve_existing'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | { | ||||||||||||||||||||||||||||||||||||||||||
| 388 | 44 | $options->{'preserve_existing'} = $args{'preserve_existing'}; | |||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | 271 | ▶ | if(exists $args{'replace_existing'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | { | ||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | if($options->{'preserve_existing'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | { | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | Carp::croak "Cannot specify true values for both the ", | |||||||||||||||||||||||||||||||||||||||||
| 396 | "'replace_existing' and 'preserve_existing' ", | ||||||||||||||||||||||||||||||||||||||||||
| 397 | "options"; | ||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $options->{'override_existing'} = $args{'replace_existing'}; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 271 | ▶ | $options->{'target_class'} ||= $args{'target_class'} || (caller)[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$options->{"target_class"} ||= $args{"target_class"} || (caller)[0]
$args{'target_class'} || (caller)[0]
MC/DC0%0/3
$options->{"target_class"} ||= $args{"target_class"} || (caller)[0]
$options->{"target_class"}
$args{'target_class'}
(caller)[0]
Truth table0%0/4
A ||= B || C
A= $options->{"target_class"}B= $args{'target_class'}C= (caller)[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 271 | ▶ | my $types = $args{'types'} || [ $self->auto_method_types ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'types'} || [$self->auto_method_types]
MC/DC0%0/1
$args{'types'} || [$self->auto_method_types]
$args{'types'}
Truth table50%1/2
A
A= $args{'types'}
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 271 | foreach my $type (@$types) | |||||||||||||||||||||||||||||||||||||||||
| 408 | { | ||||||||||||||||||||||||||||||||||||||||||
| 409 | 371 | ▶ | my $method_maker_class = $self->method_maker_class($type) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | or Carp::croak "No method maker class defined for method type '$type'"; | ||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | 371 | ▶ | my $method_maker_type = $self->method_maker_type($type) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 413 | or Carp::croak "No method maker type defined for method type '$type'"; | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 371 | ▶ | my $method_name = $self->method_name($type) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | or Carp::croak "No method name defined for method type '$type'"; | ||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | 371 | ▶ | if(Rose::DB::Object->can($method_name)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | { | ||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | Carp::croak "Cannot create method '$method_name' in class ", | |||||||||||||||||||||||||||||||||||||||||
| 421 | "$options->{'target_class'} - Rose::DB::Object defines a ", | ||||||||||||||||||||||||||||||||||||||||||
| 422 | "method with the same name"; | ||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | $method_maker_class->make_methods( | ||||||||||||||||||||||||||||||||||||||||||
| 426 | 371 | $options, | |||||||||||||||||||||||||||||||||||||||||
| 427 | $method_maker_type => | ||||||||||||||||||||||||||||||||||||||||||
| 428 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 429 | $method_name => { $self->method_maker_arguments($type) } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | ]); | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 370 | $self->made_method_type($type => $method_name); | |||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 370 | ▶ | if($self->can('method_code')) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | { | ||||||||||||||||||||||||||||||||||||||||||
| 436 | 297 | $self->method_code($type => undef); | |||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | 270 | return; | |||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | 73 | ▶ | sub made_method_type { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
made_method_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | sub made_method_types { } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
made_method_types: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 61 | 1; | |||||||||||||||||||||||||||||||||||||||||