line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rose::DB::Object::Metadata::MethodMaker; |
2
|
|
|
|
|
|
|
|
3
|
61
|
|
|
61
|
|
440
|
use strict; |
|
61
|
|
|
|
|
144
|
|
|
61
|
|
|
|
|
1869
|
|
4
|
|
|
|
|
|
|
|
5
|
61
|
|
|
61
|
|
382
|
use Carp(); |
|
61
|
|
|
|
|
154
|
|
|
61
|
|
|
|
|
921
|
|
6
|
|
|
|
|
|
|
|
7
|
61
|
|
|
61
|
|
26702
|
use Clone(); |
|
61
|
|
|
|
|
156560
|
|
|
61
|
|
|
|
|
1731
|
|
8
|
61
|
|
|
61
|
|
468
|
use Rose::Object::MakeMethods::Generic; |
|
61
|
|
|
|
|
138
|
|
|
61
|
|
|
|
|
720
|
|
9
|
|
|
|
|
|
|
|
10
|
61
|
|
|
61
|
|
26933
|
use Rose::DB::Object::Metadata::Object; |
|
61
|
|
|
|
|
190
|
|
|
61
|
|
|
|
|
3997
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Rose::DB::Object::Metadata::Object); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.769'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# Class data |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Rose::Class::MakeMethods::Set |
20
|
|
|
|
|
|
|
( |
21
|
61
|
|
|
|
|
687
|
inherited_set => |
22
|
|
|
|
|
|
|
[ |
23
|
|
|
|
|
|
|
'common_method_maker_argument_name', |
24
|
|
|
|
|
|
|
'default_auto_method_type', |
25
|
|
|
|
|
|
|
], |
26
|
61
|
|
|
61
|
|
497
|
); |
|
61
|
|
|
|
|
142
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# |
29
|
|
|
|
|
|
|
# Object data |
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
*method_types = \&auto_method_types; |
54
|
|
|
|
|
|
|
*add_method_types = \&add_auto_method_types; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# |
57
|
|
|
|
|
|
|
# Class methods |
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
our %Method_Maker_Info; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
OVERRIDE: |
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
my $orig_add_method = \&add_common_method_maker_argument_names; |
65
|
|
|
|
|
|
|
|
66
|
61
|
|
|
61
|
|
47629
|
no warnings 'redefine'; |
|
61
|
|
|
|
|
165
|
|
|
61
|
|
|
|
|
23961
|
|
67
|
|
|
|
|
|
|
*add_common_method_maker_argument_names = sub |
68
|
|
|
|
|
|
|
{ |
69
|
319
|
|
|
319
|
|
905
|
my($class) = shift; |
70
|
|
|
|
|
|
|
|
71
|
319
|
50
|
33
|
|
|
2217
|
if(@_ && $Method_Maker_Info{$class}) |
72
|
|
|
|
|
|
|
{ |
73
|
0
|
|
|
|
|
0
|
foreach my $type (keys %{$Method_Maker_Info{$class}}) |
|
0
|
|
|
|
|
0
|
|
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
|
|
0
|
push(@{$Method_Maker_Info{$class}{$type}{'args'}}, @_); |
|
0
|
|
|
|
|
0
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
319
|
|
|
|
|
1288
|
$orig_add_method->($class, @_); |
80
|
|
|
|
|
|
|
}; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $orig_delete_method = \&delete_common_method_maker_argument_names; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
*delete_common_method_maker_argument_names = sub |
85
|
|
|
|
|
|
|
{ |
86
|
1
|
|
|
1
|
|
4
|
my($class) = shift; |
87
|
|
|
|
|
|
|
|
88
|
1
|
50
|
33
|
|
|
8
|
if(@_ && $Method_Maker_Info{$class}) |
89
|
|
|
|
|
|
|
{ |
90
|
0
|
|
|
|
|
0
|
foreach my $type (keys %{$Method_Maker_Info{$class}}) |
|
0
|
|
|
|
|
0
|
|
91
|
|
|
|
|
|
|
{ |
92
|
0
|
|
|
|
|
0
|
delete @{$Method_Maker_Info{$class}{$type}{'args'}}{@_}; |
|
0
|
|
|
|
|
0
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
7
|
$orig_delete_method->($class, @_); |
97
|
|
|
|
|
|
|
}; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
285
|
|
|
285
|
0
|
2802
|
sub init_auto_method_types { shift->default_auto_method_types } |
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
|
|
|
|
|
|
|
{ |
108
|
1475
|
|
|
1475
|
0
|
2596
|
my($class) = shift; |
109
|
|
|
|
|
|
|
|
110
|
1475
|
|
|
|
|
2521
|
my $info = $Method_Maker_Info{$class}; |
111
|
|
|
|
|
|
|
|
112
|
1475
|
100
|
66
|
|
|
5045
|
unless($info && %$info) |
113
|
|
|
|
|
|
|
{ |
114
|
64
|
|
|
|
|
131
|
my @parents = ($class); |
115
|
|
|
|
|
|
|
|
116
|
64
|
|
|
|
|
158
|
while(my $parent = shift(@parents)) |
117
|
|
|
|
|
|
|
{ |
118
|
61
|
|
|
61
|
|
515
|
no strict 'refs'; |
|
61
|
|
|
|
|
196
|
|
|
61
|
|
|
|
|
116025
|
|
119
|
275
|
|
|
|
|
3004
|
foreach my $subclass (@{$parent . '::ISA'}) |
|
275
|
|
|
|
|
1032
|
|
120
|
|
|
|
|
|
|
{ |
121
|
211
|
|
|
|
|
391
|
push(@parents, $subclass); |
122
|
|
|
|
|
|
|
|
123
|
211
|
100
|
|
|
|
1026
|
next unless($subclass->can('init_method_maker_info')); |
124
|
|
|
|
|
|
|
|
125
|
83
|
|
|
|
|
228
|
my $subclass_info = $subclass->init_method_maker_info; |
126
|
|
|
|
|
|
|
|
127
|
83
|
|
50
|
|
|
345
|
$info ||= $Method_Maker_Info{$class} ||= {}; |
|
|
|
66
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
83
|
|
|
|
|
245
|
foreach my $type ($subclass->available_method_types) |
130
|
|
|
|
|
|
|
{ |
131
|
152
|
50
|
|
|
|
8438
|
next unless($subclass_info->{$type}); |
132
|
|
|
|
|
|
|
|
133
|
152
|
|
|
|
|
271
|
foreach my $attr (qw(class type interface)) |
134
|
|
|
|
|
|
|
{ |
135
|
|
|
|
|
|
|
next if(!$subclass_info->{$type}{$attr} || |
136
|
456
|
100
|
100
|
|
|
1455
|
defined $info->{$type}{$attr}); |
137
|
|
|
|
|
|
|
|
138
|
194
|
|
|
|
|
875
|
$info->{$type}{$attr} = Clone::clone($subclass_info->{$type}{$attr}); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# Args come from an already-inherited set |
142
|
152
|
|
|
|
|
503
|
$info->{$type}{'args'} = [ $class->common_method_maker_argument_names ]; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
1475
|
|
|
|
|
2549
|
return $info; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub method_maker_info |
152
|
|
|
|
|
|
|
{ |
153
|
186
|
|
|
186
|
0
|
593
|
my($class) = shift; |
154
|
|
|
|
|
|
|
|
155
|
186
|
50
|
|
|
|
805
|
$class = ref $class if(ref $class); |
156
|
|
|
|
|
|
|
|
157
|
186
|
|
|
|
|
715
|
while(@_) |
158
|
|
|
|
|
|
|
{ |
159
|
817
|
|
|
|
|
1390
|
my $type = shift; |
160
|
817
|
|
|
|
|
1279
|
my $info = shift; |
161
|
|
|
|
|
|
|
|
162
|
817
|
50
|
33
|
|
|
4420
|
Carp::confess "Method maker info must be passed in type/hashref pairs" |
|
|
|
33
|
|
|
|
|
163
|
|
|
|
|
|
|
unless(defined $type && ref $info && ref $info eq 'HASH'); |
164
|
|
|
|
|
|
|
|
165
|
817
|
|
50
|
|
|
3543
|
my $mm_info = $Method_Maker_Info{$class}{$type} ||= {}; |
166
|
|
|
|
|
|
|
|
167
|
817
|
|
|
|
|
2678
|
while(my($key, $value) = each(%$info)) |
168
|
|
|
|
|
|
|
{ |
169
|
2207
|
|
|
|
|
6815
|
$mm_info->{$key} = $value; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
186
|
|
|
|
|
1413
|
$class->init_method_maker_info; |
174
|
186
|
|
|
|
|
505
|
return $Method_Maker_Info{$class}; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub add_method_maker_argument_names |
178
|
|
|
|
|
|
|
{ |
179
|
0
|
|
|
0
|
0
|
0
|
my($class) = shift; |
180
|
|
|
|
|
|
|
|
181
|
0
|
0
|
|
|
|
0
|
$class = ref $class if(ref $class); |
182
|
|
|
|
|
|
|
|
183
|
0
|
|
|
|
|
0
|
while(@_) |
184
|
|
|
|
|
|
|
{ |
185
|
0
|
|
|
|
|
0
|
my $type = shift; |
186
|
0
|
|
|
|
|
0
|
my $new_names = shift; |
187
|
|
|
|
|
|
|
|
188
|
0
|
0
|
0
|
|
|
0
|
Carp::confess "Method maker argument names must be passed in type/arrayref pairs" |
|
|
|
0
|
|
|
|
|
189
|
|
|
|
|
|
|
unless(defined $type && ref $new_names && ref $new_names eq 'ARRAY'); |
190
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
0
|
my $names = $class->method_maker_argument_names($type); |
192
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
0
|
push(@$names, @$new_names); |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
0
|
|
|
|
|
0
|
return; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub method_maker_argument_names |
200
|
|
|
|
|
|
|
{ |
201
|
374
|
|
|
374
|
0
|
684
|
my($class, $type) = (shift, shift); |
202
|
|
|
|
|
|
|
|
203
|
374
|
50
|
|
|
|
706
|
Carp::confess "Missing required type argument" unless(defined $type); |
204
|
|
|
|
|
|
|
|
205
|
374
|
50
|
|
|
|
822
|
$class = ref $class if(ref $class); |
206
|
374
|
|
|
|
|
903
|
$class->init_method_maker_info; |
207
|
|
|
|
|
|
|
|
208
|
374
|
|
50
|
|
|
923
|
my $mm_info = $Method_Maker_Info{$class}{$type} ||= {}; |
209
|
|
|
|
|
|
|
|
210
|
374
|
50
|
|
|
|
813
|
if(@_) |
211
|
|
|
|
|
|
|
{ |
212
|
0
|
0
|
0
|
|
|
0
|
if(@_ == 1 && ref $_[0] && ref $_[0] eq 'ARRAY') |
|
|
|
0
|
|
|
|
|
213
|
|
|
|
|
|
|
{ |
214
|
0
|
|
|
|
|
0
|
$mm_info->{'args'} = $_[0]; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
else |
217
|
|
|
|
|
|
|
{ |
218
|
0
|
|
|
|
|
0
|
$mm_info->{'args'} = [ @_ ]; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
374
|
100
|
|
|
|
952
|
unless(defined $mm_info->{'args'}) |
223
|
|
|
|
|
|
|
{ |
224
|
15
|
|
50
|
|
|
61
|
$mm_info->{'args'} = $class->common_method_maker_argument_names || []; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
374
|
|
|
|
|
1784
|
return wantarray ? @{$mm_info->{'args'}} : |
228
|
374
|
50
|
|
|
|
1818
|
$mm_info->{'args'}; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub method_maker_class |
232
|
|
|
|
|
|
|
{ |
233
|
389
|
|
|
389
|
0
|
823
|
my($class, $type) = (shift, shift); |
234
|
|
|
|
|
|
|
|
235
|
389
|
50
|
|
|
|
881
|
Carp::confess "Missing required type argument" unless(defined $type); |
236
|
|
|
|
|
|
|
|
237
|
389
|
100
|
|
|
|
984
|
$class = ref $class if(ref $class); |
238
|
|
|
|
|
|
|
|
239
|
389
|
|
|
|
|
1282
|
$class->init_method_maker_info; |
240
|
|
|
|
|
|
|
|
241
|
389
|
100
|
|
|
|
817
|
if(@_) |
242
|
|
|
|
|
|
|
{ |
243
|
15
|
|
|
|
|
44
|
return $Method_Maker_Info{$class}{$type}{'class'} = shift; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
374
|
|
|
|
|
1216
|
return $Method_Maker_Info{$class}{$type}{'class'}; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub method_maker_type |
250
|
|
|
|
|
|
|
{ |
251
|
443
|
|
|
443
|
0
|
927
|
my($class, $type) = (shift, shift); |
252
|
|
|
|
|
|
|
|
253
|
443
|
50
|
|
|
|
881
|
Carp::confess "Missing required type argument" unless(defined $type); |
254
|
|
|
|
|
|
|
|
255
|
443
|
100
|
|
|
|
1089
|
$class = ref $class if(ref $class); |
256
|
443
|
|
|
|
|
1193
|
$class->init_method_maker_info; |
257
|
|
|
|
|
|
|
|
258
|
443
|
100
|
|
|
|
1008
|
if(@_) |
259
|
|
|
|
|
|
|
{ |
260
|
69
|
|
|
|
|
203
|
return $Method_Maker_Info{$class}{$type}{'type'} = shift; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
374
|
|
|
|
|
1120
|
return $Method_Maker_Info{$class}{$type}{'type'}; |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
sub available_method_types |
267
|
|
|
|
|
|
|
{ |
268
|
106
|
|
|
106
|
0
|
182
|
my($class) = shift; |
269
|
106
|
50
|
|
|
|
223
|
$class = ref $class if(ref $class); |
270
|
|
|
|
|
|
|
|
271
|
106
|
100
|
100
|
|
|
318
|
if($Method_Maker_Info{$class} && %{$Method_Maker_Info{$class}}) |
|
51
|
|
|
|
|
157
|
|
272
|
|
|
|
|
|
|
{ |
273
|
50
|
|
50
|
|
|
73
|
return sort keys %{$Method_Maker_Info{$class} ||= {}}; |
|
50
|
|
|
|
|
366
|
|
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
|
276
|
56
|
|
|
|
|
169
|
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
|
154
|
|
|
154
|
0
|
489
|
sub hash_key { shift->name } |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
sub methods |
303
|
|
|
|
|
|
|
{ |
304
|
7
|
|
|
7
|
0
|
64
|
my($self) = shift; |
305
|
|
|
|
|
|
|
|
306
|
7
|
50
|
|
|
|
17
|
my %args = (@_ == 1) ? %{$_[0]} : @_; |
|
7
|
|
|
|
|
43
|
|
307
|
|
|
|
|
|
|
|
308
|
7
|
|
|
|
|
52
|
$self->add_auto_method_types(keys %args); |
309
|
|
|
|
|
|
|
|
310
|
7
|
|
|
|
|
199
|
while(my($type, $name) = each(%args)) |
311
|
|
|
|
|
|
|
{ |
312
|
21
|
50
|
|
|
|
53
|
$self->method_name($type => $name) if(defined $name); |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
7
|
|
|
|
|
24
|
return; |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
sub method_name |
319
|
|
|
|
|
|
|
{ |
320
|
2565
|
|
|
2565
|
0
|
4784
|
my($self, $type) = (shift, shift); |
321
|
|
|
|
|
|
|
|
322
|
2565
|
50
|
|
|
|
5080
|
Carp::confess "Missing required type argument" unless(defined $type); |
323
|
|
|
|
|
|
|
|
324
|
2565
|
100
|
|
|
|
4879
|
if(@_) |
325
|
|
|
|
|
|
|
{ |
326
|
424
|
|
|
|
|
1489
|
return $self->{'method_name'}{$type} = shift; |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
|
329
|
2141
|
|
|
|
|
8697
|
return $self->{'method_name'}{$type}; |
330
|
|
|
|
|
|
|
} |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
sub method_uses_formatted_key |
333
|
|
|
|
|
|
|
{ |
334
|
286
|
|
|
286
|
0
|
542
|
my($self, $type) = @_; |
335
|
286
|
|
|
|
|
632
|
return 0; |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
sub method_should_set |
339
|
|
|
|
|
|
|
{ |
340
|
0
|
|
|
0
|
0
|
0
|
my($self, $type, $args) = @_; |
341
|
|
|
|
|
|
|
|
342
|
0
|
0
|
|
|
|
0
|
return 1 if($type eq 'set'); |
343
|
0
|
0
|
|
|
|
0
|
return 0 if($type eq 'get'); |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
# $args is a reference to the method args *including* the invocant |
346
|
0
|
0
|
|
|
|
0
|
return @$args > 1 ? 1 : 0; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
0
|
|
|
0
|
0
|
0
|
sub build_method_name_for_type { Carp::confess "Override in subclass" } |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
sub defined_method_types |
352
|
|
|
|
|
|
|
{ |
353
|
0
|
|
|
0
|
0
|
0
|
my($self) = shift; |
354
|
|
|
|
|
|
|
|
355
|
0
|
|
0
|
|
|
0
|
my @types = sort keys %{$self->{'method_name'} ||= {}}; |
|
0
|
|
|
|
|
0
|
|
356
|
0
|
0
|
|
|
|
0
|
return wantarray ? @types : \@types; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
sub method_maker_arguments |
360
|
|
|
|
|
|
|
{ |
361
|
374
|
|
|
374
|
0
|
638
|
my($self, $type) = @_; |
362
|
|
|
|
|
|
|
|
363
|
374
|
|
|
|
|
676
|
my $class = ref $self; |
364
|
|
|
|
|
|
|
|
365
|
374
|
50
|
|
|
|
753
|
Carp::confess "Missing required type argument" unless(defined $type); |
366
|
|
|
|
|
|
|
|
367
|
374
|
|
|
|
|
855
|
my %opts = map { $_ => scalar $self->$_() } grep { defined scalar $self->$_() } |
|
2245
|
|
|
|
|
13717
|
|
|
4654
|
|
|
|
|
25303
|
|
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
|
374
|
|
50
|
|
|
1853
|
my $mm_info = $Method_Maker_Info{$class}{$type} ||= {}; |
374
|
|
|
|
|
|
|
|
375
|
374
|
100
|
|
|
|
1061
|
$opts{'interface'} = $mm_info->{'interface'} if(exists $mm_info->{'interface'}); |
376
|
|
|
|
|
|
|
|
377
|
374
|
100
|
|
|
|
1845
|
return wantarray ? %opts : \%opts; |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
sub make_methods |
381
|
|
|
|
|
|
|
{ |
382
|
271
|
|
|
271
|
0
|
737
|
my($self, %args) = @_; |
383
|
|
|
|
|
|
|
|
384
|
271
|
|
50
|
|
|
1077
|
my $options = $args{'options'} || {}; |
385
|
|
|
|
|
|
|
|
386
|
271
|
100
|
|
|
|
664
|
if(exists $args{'preserve_existing'}) |
387
|
|
|
|
|
|
|
{ |
388
|
44
|
|
|
|
|
136
|
$options->{'preserve_existing'} = $args{'preserve_existing'}; |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
|
391
|
271
|
50
|
|
|
|
680
|
if(exists $args{'replace_existing'}) |
392
|
|
|
|
|
|
|
{ |
393
|
0
|
0
|
|
|
|
0
|
if($options->{'preserve_existing'}) |
394
|
|
|
|
|
|
|
{ |
395
|
0
|
|
|
|
|
0
|
Carp::croak "Cannot specify true values for both the ", |
396
|
|
|
|
|
|
|
"'replace_existing' and 'preserve_existing' ", |
397
|
|
|
|
|
|
|
"options"; |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
|
400
|
0
|
|
|
|
|
0
|
$options->{'override_existing'} = $args{'replace_existing'}; |
401
|
|
|
|
|
|
|
} |
402
|
|
|
|
|
|
|
|
403
|
271
|
|
33
|
|
|
1511
|
$options->{'target_class'} ||= $args{'target_class'} || (caller)[0]; |
|
|
|
33
|
|
|
|
|
404
|
|
|
|
|
|
|
|
405
|
271
|
|
50
|
|
|
991
|
my $types = $args{'types'} || [ $self->auto_method_types ]; |
406
|
|
|
|
|
|
|
|
407
|
271
|
|
|
|
|
3491
|
foreach my $type (@$types) |
408
|
|
|
|
|
|
|
{ |
409
|
374
|
50
|
|
|
|
965
|
my $method_maker_class = $self->method_maker_class($type) |
410
|
|
|
|
|
|
|
or Carp::croak "No method maker class defined for method type '$type'"; |
411
|
|
|
|
|
|
|
|
412
|
374
|
50
|
|
|
|
904
|
my $method_maker_type = $self->method_maker_type($type) |
413
|
|
|
|
|
|
|
or Carp::croak "No method maker type defined for method type '$type'"; |
414
|
|
|
|
|
|
|
|
415
|
374
|
50
|
|
|
|
860
|
my $method_name = $self->method_name($type) |
416
|
|
|
|
|
|
|
or Carp::croak "No method name defined for method type '$type'"; |
417
|
|
|
|
|
|
|
|
418
|
374
|
50
|
|
|
|
2450
|
if(Rose::DB::Object->can($method_name)) |
419
|
|
|
|
|
|
|
{ |
420
|
0
|
|
|
|
|
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
|
374
|
|
|
|
|
1304
|
$options, |
427
|
|
|
|
|
|
|
$method_maker_type => |
428
|
|
|
|
|
|
|
[ |
429
|
|
|
|
|
|
|
$method_name => { $self->method_maker_arguments($type) } |
430
|
|
|
|
|
|
|
]); |
431
|
|
|
|
|
|
|
|
432
|
373
|
|
|
|
|
15801
|
$self->made_method_type($type => $method_name); |
433
|
|
|
|
|
|
|
|
434
|
373
|
100
|
|
|
|
1560
|
if($self->can('method_code')) |
435
|
|
|
|
|
|
|
{ |
436
|
297
|
|
|
|
|
813
|
$self->method_code($type => undef); |
437
|
|
|
|
|
|
|
} |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
|
440
|
270
|
|
|
|
|
953
|
return; |
441
|
|
|
|
|
|
|
} |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
76
|
0
|
|
sub made_method_type { } |
444
|
|
|
|
0
|
0
|
|
sub made_method_types { } |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
1; |