line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
341
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
push(@::bean_desc, { |
4
|
|
|
|
|
|
|
bean_opt => { |
5
|
|
|
|
|
|
|
abstract => 'Unique, ordered MULTI bean attribute information', |
6
|
|
|
|
|
|
|
package => 'PerlBean::Attribute::Multi::Unique::Ordered', |
7
|
|
|
|
|
|
|
use_perl_version => 5.005, |
8
|
|
|
|
|
|
|
base => [ qw(PerlBean::Attribute::Multi)], |
9
|
|
|
|
|
|
|
description => <
|
10
|
|
|
|
|
|
|
C contains unique ordered MULTI bean attribute information. It is a subclass of C. The code generation and documentation methods from C are implemented.` |
11
|
|
|
|
|
|
|
EOF |
12
|
|
|
|
|
|
|
short_description => 'contains unique ordered MULTI bean attribute information', |
13
|
|
|
|
|
|
|
synopsis => &get_syn(), |
14
|
|
|
|
|
|
|
}, |
15
|
|
|
|
|
|
|
attr_opt => [ |
16
|
|
|
|
|
|
|
], |
17
|
|
|
|
|
|
|
meth_opt => [ |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
method_name => 'create_method_exists', |
20
|
|
|
|
|
|
|
documented => 0, |
21
|
|
|
|
|
|
|
body => <<'THE_EOF', |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
25
|
|
|
|
|
|
|
my $op = &{$MOF}('exists'); |
26
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
27
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
28
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Make body |
31
|
|
|
|
|
|
|
my $body = <
|
32
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
${IND}# Count occurrences |
35
|
|
|
|
|
|
|
${IND}my \$count${AO}=${AO}0; |
36
|
|
|
|
|
|
|
${IND}foreach my \$val (\@_)${PBOC[1]}{ |
37
|
|
|
|
|
|
|
${IND}${IND}\$count${AO}+=${AO}exists${BFP}(${ACS}\$self->{$pkg_us}{$an}{HASH}{\$val}${ACS}); |
38
|
|
|
|
|
|
|
${IND}} |
39
|
|
|
|
|
|
|
${IND}return${BFP}(\$count); |
40
|
|
|
|
|
|
|
EOF |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Create and return the method |
43
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
44
|
|
|
|
|
|
|
method_name => "$op$mb", |
45
|
|
|
|
|
|
|
parameter_description => 'ARRAY', |
46
|
|
|
|
|
|
|
documented => $self->is_documented(), |
47
|
|
|
|
|
|
|
volatile => 1, |
48
|
|
|
|
|
|
|
description => <
|
49
|
|
|
|
|
|
|
Returns the count of items in C that are in ${desc}. |
50
|
|
|
|
|
|
|
EOF |
51
|
|
|
|
|
|
|
body => $body, |
52
|
|
|
|
|
|
|
} ) ); |
53
|
|
|
|
|
|
|
THE_EOF |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
{ |
56
|
|
|
|
|
|
|
method_name => 'create_method_get', |
57
|
|
|
|
|
|
|
documented => 0, |
58
|
|
|
|
|
|
|
body => <<'THE_EOF', |
59
|
|
|
|
|
|
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
62
|
|
|
|
|
|
|
my $op = &{$MOF}('get'); |
63
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
64
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
65
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Make body |
68
|
|
|
|
|
|
|
my $body = <
|
69
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
${IND}if${BCP}(${ACS}scalar${BFP}(\@_)${ACS})${PBOC[1]}{ |
72
|
|
|
|
|
|
|
${IND}${IND}my \@ret${AO}=${AO}(); |
73
|
|
|
|
|
|
|
${IND}${IND}foreach my \$i (\@_)${PBOC[2]}{ |
74
|
|
|
|
|
|
|
${IND}${IND}${IND}push${BFP}(${ACS}\@ret,${AC}\$self->{$pkg_us}{$an}{ARRAY}[${ACS}int${BFP}(\$i)${ACS}]${ACS}); |
75
|
|
|
|
|
|
|
${IND}${IND}} |
76
|
|
|
|
|
|
|
${IND}${IND}return${BFP}(\@ret); |
77
|
|
|
|
|
|
|
${IND}}${PBCC[1]}else${PBOC[1]}{ |
78
|
|
|
|
|
|
|
${IND}${IND}# Return the list |
79
|
|
|
|
|
|
|
${IND}${IND}return${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}{ARRAY}${ACS}}${ACS}); |
80
|
|
|
|
|
|
|
${IND}} |
81
|
|
|
|
|
|
|
EOF |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Create and return the method |
84
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
85
|
|
|
|
|
|
|
method_name => "$op$mb", |
86
|
|
|
|
|
|
|
parameter_description => "${ACS}\[${ACS}INDEX_ARRAY${ACS}\]${ACS}", |
87
|
|
|
|
|
|
|
documented => $self->is_documented(), |
88
|
|
|
|
|
|
|
volatile => 1, |
89
|
|
|
|
|
|
|
description => <
|
90
|
|
|
|
|
|
|
Returns an C containing ${desc}. C is an optional list of indexes which when specified causes only the indexed elements in the ordered list to be returned. If not specified, all elements are returned. |
91
|
|
|
|
|
|
|
EOF |
92
|
|
|
|
|
|
|
body => $body, |
93
|
|
|
|
|
|
|
} ) ); |
94
|
|
|
|
|
|
|
THE_EOF |
95
|
|
|
|
|
|
|
}, |
96
|
|
|
|
|
|
|
{ |
97
|
|
|
|
|
|
|
method_name => 'create_method_pop', |
98
|
|
|
|
|
|
|
documented => 0, |
99
|
|
|
|
|
|
|
body => <<'THE_EOF', |
100
|
|
|
|
|
|
|
my $self = shift; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
103
|
|
|
|
|
|
|
my $an_esc = $self->_esc_apos($an); |
104
|
|
|
|
|
|
|
my $op = &{$MOF}('pop'); |
105
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
106
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
107
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
108
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
109
|
|
|
|
|
|
|
my $desc = defined($self->get_short_description()) ? $self->get_short_description() : 'not described option'; |
110
|
|
|
|
|
|
|
my $empt = $self->is_allow_empty() ? '' : ' After popping at least one element must remain.'; |
111
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Make body |
114
|
|
|
|
|
|
|
my $body = <
|
115
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
EOF |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# Check if list value is allowed to be empty |
120
|
|
|
|
|
|
|
if ( ! $self->is_allow_empty() ) { |
121
|
|
|
|
|
|
|
$body .= <
|
122
|
|
|
|
|
|
|
${IND}# List value for $an_esc is not allowed to be empty |
123
|
|
|
|
|
|
|
${IND}(${ACS}scalar${BFP}(\@_)${AO}>${AO}1)${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, list value may not be empty."); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
EOF |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Method tail |
129
|
|
|
|
|
|
|
$body .= <
|
130
|
|
|
|
|
|
|
${IND}# Pop value |
131
|
|
|
|
|
|
|
${IND}my \$val${AO}=${AO}pop${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}{ARRAY}${ACS}}${ACS}); |
132
|
|
|
|
|
|
|
${IND}delete${BFP}(${ACS}\$self->{$pkg_us}{$an}{HASH}{\$val}${ACS}); |
133
|
|
|
|
|
|
|
${IND}return${BFP}(\$val); |
134
|
|
|
|
|
|
|
EOF |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# Create and return the method |
137
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
138
|
|
|
|
|
|
|
method_name => "$op$mb", |
139
|
|
|
|
|
|
|
documented => $self->is_documented(), |
140
|
|
|
|
|
|
|
volatile => 1, |
141
|
|
|
|
|
|
|
description => <
|
142
|
|
|
|
|
|
|
Pop and return an element off ${desc}.${empt}${exc} |
143
|
|
|
|
|
|
|
EOF |
144
|
|
|
|
|
|
|
body => $body, |
145
|
|
|
|
|
|
|
} ) ); |
146
|
|
|
|
|
|
|
THE_EOF |
147
|
|
|
|
|
|
|
}, |
148
|
|
|
|
|
|
|
{ |
149
|
|
|
|
|
|
|
method_name => 'create_method_push', |
150
|
|
|
|
|
|
|
documented => 0, |
151
|
|
|
|
|
|
|
body => <<'THE_EOF', |
152
|
|
|
|
|
|
|
my $self = shift; |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
155
|
|
|
|
|
|
|
my $an_esc = $self->_esc_apos($an); |
156
|
|
|
|
|
|
|
my $op = &{$MOF}('push'); |
157
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
158
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
159
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
160
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
161
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
162
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
# Make body |
165
|
|
|
|
|
|
|
my $body = <
|
166
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
EOF |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
# Check if isas/refs/rxs/values are allowed |
171
|
|
|
|
|
|
|
$body .= <
|
172
|
|
|
|
|
|
|
${IND}# Check if isas/refs/rxs/values are allowed |
173
|
|
|
|
|
|
|
${IND}\&_value_is_allowed${BFP}(${ACS}$an_esc,${AC}\@_${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, one or more specified value(s) '\@_' is/are not allowed."); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
EOF |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
# Method tail |
178
|
|
|
|
|
|
|
$body .= <
|
179
|
|
|
|
|
|
|
${IND}# Push values |
180
|
|
|
|
|
|
|
${IND}foreach my \$val (\@_)${PBOC[1]}{ |
181
|
|
|
|
|
|
|
${IND}${IND}next if${BCP}(${ACS}exists${BFP}(${ACS}\$self->{$pkg_us}{$an}{HASH}{\$val}${ACS})${ACS}); |
182
|
|
|
|
|
|
|
${IND}${IND}push${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}{ARRAY}${ACS}},${AC}\$val${ACS}); |
183
|
|
|
|
|
|
|
${IND}${IND}\$self->{$pkg_us}{$an}{HASH}{\$val}${AO}=${AO}\$val; |
184
|
|
|
|
|
|
|
${IND}} |
185
|
|
|
|
|
|
|
EOF |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
# Make description |
188
|
|
|
|
|
|
|
my $description = <
|
189
|
|
|
|
|
|
|
Push additional values on ${desc}. C is the list value. The push may not yield to multiple identical elements in the list. Hence, multiple occurrences of the same element are ignored.${exc} |
190
|
|
|
|
|
|
|
EOF |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
# Add clauses to the description |
193
|
|
|
|
|
|
|
my $clauses = $self->mk_doc_clauses(); |
194
|
|
|
|
|
|
|
if ($clauses) { |
195
|
|
|
|
|
|
|
$description .= "\n" . $clauses; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
# Create and return the method |
199
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
200
|
|
|
|
|
|
|
method_name => "$op$mb", |
201
|
|
|
|
|
|
|
parameter_description => 'ARRAY', |
202
|
|
|
|
|
|
|
documented => $self->is_documented(), |
203
|
|
|
|
|
|
|
volatile => 1, |
204
|
|
|
|
|
|
|
description => $description, |
205
|
|
|
|
|
|
|
body => $body, |
206
|
|
|
|
|
|
|
} ) ); |
207
|
|
|
|
|
|
|
THE_EOF |
208
|
|
|
|
|
|
|
}, |
209
|
|
|
|
|
|
|
{ |
210
|
|
|
|
|
|
|
method_name => 'create_method_set', |
211
|
|
|
|
|
|
|
documented => 0, |
212
|
|
|
|
|
|
|
body => <<'THE_EOF', |
213
|
|
|
|
|
|
|
my $self = shift; |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
216
|
|
|
|
|
|
|
my $an_esc = $self->_esc_apos($an); |
217
|
|
|
|
|
|
|
my $op = &{$MOF}('set'); |
218
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
219
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
220
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
221
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
222
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
223
|
|
|
|
|
|
|
my $def = defined( $self->get_default_value() ) ? ' Default value at initialization is C<' . join( ', ', $self->_esc_aq ( @{ $self->get_default_value() } ) ) . '>.' : ''; |
224
|
|
|
|
|
|
|
my $empt = $self->is_allow_empty() ? '' : ' C must at least have one element.'; |
225
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
226
|
|
|
|
|
|
|
my $attr_overl = $self->_get_overloaded_attribute(); |
227
|
|
|
|
|
|
|
my $overl = defined($attr_overl) ? " B Methods B> are overloaded from package C<". $attr_overl->get_package() .'>.': ''; |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
# Make body |
230
|
|
|
|
|
|
|
my $body = <
|
231
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
EOF |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
# Check if list value is allowed to be empty |
236
|
|
|
|
|
|
|
if ( ! $self->is_allow_empty() ) { |
237
|
|
|
|
|
|
|
$body .= <
|
238
|
|
|
|
|
|
|
${IND}# List value for $an_esc is not allowed to be empty |
239
|
|
|
|
|
|
|
${IND}scalar${BFP}(\@_)${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, list value may not be empty."); |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
EOF |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
# Check if isas/refs/rxs/values are allowed |
245
|
|
|
|
|
|
|
# Empty the list |
246
|
|
|
|
|
|
|
$body .= <
|
247
|
|
|
|
|
|
|
${IND}# Check if isas/refs/rxs/values are allowed |
248
|
|
|
|
|
|
|
${IND}\&_value_is_allowed${BFP}(${ACS}$an_esc,${AC}\@_${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, one or more specified value(s) '\@_' is/are not allowed."); |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
${IND}# Empty list |
251
|
|
|
|
|
|
|
${IND}\$self->{$pkg_us}{$an}{ARRAY}${AO}=${AO}\[]; |
252
|
|
|
|
|
|
|
${IND}\$self->{$pkg_us}{$an}{HASH}${AO}=${AO}\{}; |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
EOF |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
# Method tail |
257
|
|
|
|
|
|
|
$body .= <
|
258
|
|
|
|
|
|
|
${IND}# Push values |
259
|
|
|
|
|
|
|
${IND}foreach my \$val (\@_)${PBOC[1]}{ |
260
|
|
|
|
|
|
|
${IND}${IND}next if${BCP}(${ACS}exists${BFP}(${ACS}\$self->{$pkg_us}{$an}{HASH}{\$val}${ACS})${ACS}); |
261
|
|
|
|
|
|
|
${IND}${IND}push${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}{ARRAY}${ACS}},${AC}\$val${ACS}); |
262
|
|
|
|
|
|
|
${IND}${IND}\$self->{$pkg_us}{$an}{HASH}{\$val}${AO}=${AO}\$val; |
263
|
|
|
|
|
|
|
${IND}} |
264
|
|
|
|
|
|
|
EOF |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
# Make description |
267
|
|
|
|
|
|
|
my $description = <
|
268
|
|
|
|
|
|
|
Set ${desc} absolutely. C is the list value. Each element in the list is allowed to occur only once. Multiple occurrences of the same element yield in the first occurring element to be inserted and the rest to be ignored.${def}${empt}${exc}${overl} |
269
|
|
|
|
|
|
|
EOF |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
# Add clauses to the description |
272
|
|
|
|
|
|
|
my $clauses = $self->mk_doc_clauses(); |
273
|
|
|
|
|
|
|
if ($clauses) { |
274
|
|
|
|
|
|
|
$description .= "\n" . $clauses; |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
# Create and return the method |
278
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
279
|
|
|
|
|
|
|
method_name => "$op$mb", |
280
|
|
|
|
|
|
|
parameter_description => 'ARRAY', |
281
|
|
|
|
|
|
|
documented => $self->is_documented(), |
282
|
|
|
|
|
|
|
volatile => 1, |
283
|
|
|
|
|
|
|
description => $description, |
284
|
|
|
|
|
|
|
body => $body, |
285
|
|
|
|
|
|
|
} ) ); |
286
|
|
|
|
|
|
|
THE_EOF |
287
|
|
|
|
|
|
|
}, |
288
|
|
|
|
|
|
|
{ |
289
|
|
|
|
|
|
|
method_name => 'create_method_shift', |
290
|
|
|
|
|
|
|
documented => 0, |
291
|
|
|
|
|
|
|
body => <<'THE_EOF', |
292
|
|
|
|
|
|
|
my $self = shift; |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
295
|
|
|
|
|
|
|
my $an_esc = $self->_esc_apos($an); |
296
|
|
|
|
|
|
|
my $op = &{$MOF}('shift'); |
297
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
298
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
299
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
300
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
301
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
302
|
|
|
|
|
|
|
my $empt = $self->is_allow_empty() ? '' : ' After shifting at least one element must remain.'; |
303
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# Make body |
306
|
|
|
|
|
|
|
my $body = <
|
307
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
EOF |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
# Check if list value is allowed to be empty |
312
|
|
|
|
|
|
|
if ( ! $self->is_allow_empty() ) { |
313
|
|
|
|
|
|
|
$body .= <
|
314
|
|
|
|
|
|
|
${IND}# List value for $an_esc is not allowed to be empty |
315
|
|
|
|
|
|
|
${IND}(${ACS}scalar${BFP}(\@_)${AO}>${AO}1${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, list value may not be empty."); |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
EOF |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
# Method tail |
321
|
|
|
|
|
|
|
$body .= <
|
322
|
|
|
|
|
|
|
${IND}# Shift value |
323
|
|
|
|
|
|
|
${IND}my \$val${AO}=${AO}shift${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}{ARRAY}${ACS}}${ACS}); |
324
|
|
|
|
|
|
|
${IND}delete${BFP}(${ACS}\$self->{$pkg_us}{$an}{HASH}{\$val}${ACS}); |
325
|
|
|
|
|
|
|
${IND}return${BFP}(\$val); |
326
|
|
|
|
|
|
|
EOF |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
# Create and return the method |
329
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
330
|
|
|
|
|
|
|
method_name => "$op$mb", |
331
|
|
|
|
|
|
|
documented => $self->is_documented(), |
332
|
|
|
|
|
|
|
volatile => 1, |
333
|
|
|
|
|
|
|
description => <
|
334
|
|
|
|
|
|
|
Shift and return an element off ${desc}.${empt}${exc} |
335
|
|
|
|
|
|
|
EOF |
336
|
|
|
|
|
|
|
body => $body, |
337
|
|
|
|
|
|
|
} ) ); |
338
|
|
|
|
|
|
|
THE_EOF |
339
|
|
|
|
|
|
|
}, |
340
|
|
|
|
|
|
|
{ |
341
|
|
|
|
|
|
|
method_name => 'create_method_unshift', |
342
|
|
|
|
|
|
|
documented => 0, |
343
|
|
|
|
|
|
|
body => <<'THE_EOF', |
344
|
|
|
|
|
|
|
my $self = shift; |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
my $an = $self->get_method_factory_name(); |
347
|
|
|
|
|
|
|
my $an_esc = $self->_esc_apos($an); |
348
|
|
|
|
|
|
|
my $op = &{$MOF}('unshift'); |
349
|
|
|
|
|
|
|
my $mb = $self->get_method_base(); |
350
|
|
|
|
|
|
|
my $ec = $self->get_exception_class(); |
351
|
|
|
|
|
|
|
my $pkg = $self->get_package(); |
352
|
|
|
|
|
|
|
my $pkg_us = $self->get_package_us(); |
353
|
|
|
|
|
|
|
my $desc = defined( $self->get_short_description() ) ? $self->get_short_description() : 'not described option'; |
354
|
|
|
|
|
|
|
my $exc = ' On error an exception C<' . $self->get_exception_class() . '> is thrown.'; |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
# Make body |
357
|
|
|
|
|
|
|
my $body = <
|
358
|
|
|
|
|
|
|
${IND}my \$self${AO}=${AO}shift; |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
EOF |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
# Check if isas/refs/rxs/values are allowed |
363
|
|
|
|
|
|
|
$body .= <
|
364
|
|
|
|
|
|
|
${IND}# Check if isas/refs/rxs/values are allowed |
365
|
|
|
|
|
|
|
${IND}\&_value_is_allowed${BFP}(${ACS}$an_esc,${AC}\@_${ACS})${AO}||${AO}throw $ec${BFP}("ERROR: ${pkg}::$op$mb, one or more specified value(s) '\@_' is/are not allowed."); |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
EOF |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
# Method tail |
370
|
|
|
|
|
|
|
$body .= <
|
371
|
|
|
|
|
|
|
${IND}# Unshift values |
372
|
|
|
|
|
|
|
${IND}foreach my \$val (${ACS}reverse${BFP}(\@_)${ACS})${PBOC[1]}{ |
373
|
|
|
|
|
|
|
${IND}${IND}next if${BCP}(${ACS}exists${BFP}(${ACS}\$self->{$pkg_us}{$an}{HASH}{\$val}${ACS})${ACS}); |
374
|
|
|
|
|
|
|
${IND}${IND}unshift${BFP}(${ACS}\@{${ACS}\$self->{$pkg_us}{$an}{ARRAY}${ACS}},${AC}\$val${ACS}); |
375
|
|
|
|
|
|
|
${IND}${IND}\$self->{$pkg_us}{$an}{HASH}{\$val}${AO}=${AO}\$val; |
376
|
|
|
|
|
|
|
${IND}} |
377
|
|
|
|
|
|
|
EOF |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
# Make description |
380
|
|
|
|
|
|
|
my $description = <
|
381
|
|
|
|
|
|
|
Unshift additional values on ${desc}. C is the list value. The push may not yield to multiple identical elements in the list. Hence, multiple occurrences of the same element are ignored.${exc} |
382
|
|
|
|
|
|
|
EOF |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
# Add clauses to the description |
385
|
|
|
|
|
|
|
my $clauses = $self->mk_doc_clauses(); |
386
|
|
|
|
|
|
|
if ($clauses) { |
387
|
|
|
|
|
|
|
$description .= "\n" . $clauses; |
388
|
|
|
|
|
|
|
} |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
# Create and return the method |
391
|
|
|
|
|
|
|
return( PerlBean::Method->new( { |
392
|
|
|
|
|
|
|
method_name => "$op$mb", |
393
|
|
|
|
|
|
|
parameter_description => 'ARRAY', |
394
|
|
|
|
|
|
|
documented => $self->is_documented(), |
395
|
|
|
|
|
|
|
volatile => 1, |
396
|
|
|
|
|
|
|
description => $description, |
397
|
|
|
|
|
|
|
body => $body, |
398
|
|
|
|
|
|
|
} ) ); |
399
|
|
|
|
|
|
|
THE_EOF |
400
|
|
|
|
|
|
|
}, |
401
|
|
|
|
|
|
|
{ |
402
|
|
|
|
|
|
|
method_name => 'create_methods', |
403
|
|
|
|
|
|
|
description => <
|
404
|
|
|
|
|
|
|
__SUPER_POD__ Access methods are B, B, B, B, B, B and B. |
405
|
|
|
|
|
|
|
EOF |
406
|
|
|
|
|
|
|
body => <<'EOF', |
407
|
|
|
|
|
|
|
my $self = shift; |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
return( |
410
|
|
|
|
|
|
|
$self->create_method_exists(), |
411
|
|
|
|
|
|
|
$self->create_method_get(), |
412
|
|
|
|
|
|
|
$self->create_method_pop(), |
413
|
|
|
|
|
|
|
$self->create_method_push(), |
414
|
|
|
|
|
|
|
$self->create_method_set(), |
415
|
|
|
|
|
|
|
$self->create_method_shift(), |
416
|
|
|
|
|
|
|
$self->create_method_unshift(), |
417
|
|
|
|
|
|
|
); |
418
|
|
|
|
|
|
|
EOF |
419
|
|
|
|
|
|
|
}, |
420
|
|
|
|
|
|
|
], |
421
|
|
|
|
|
|
|
sym_opt => [ |
422
|
|
|
|
|
|
|
], |
423
|
|
|
|
|
|
|
use_opt => [ |
424
|
|
|
|
|
|
|
{ |
425
|
|
|
|
|
|
|
dependency_name => 'PerlBean::Style', |
426
|
|
|
|
|
|
|
import_list => [ 'qw(:codegen)' ], |
427
|
|
|
|
|
|
|
}, |
428
|
|
|
|
|
|
|
], |
429
|
|
|
|
|
|
|
} ); |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
sub get_syn { |
432
|
1
|
|
|
1
|
|
7
|
use IO::File; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
225
|
|
433
|
|
|
|
|
|
|
my $fh = IO::File->new('< syn-PerlBean_Attribute_Multi_Unique_Ordered.pl'); |
434
|
|
|
|
|
|
|
$fh = IO::File->new('< gen/syn-PerlBean_Attribute_Multi_Unique_Ordered.pl') if (! defined($fh)); |
435
|
|
|
|
|
|
|
my $syn = ''; |
436
|
|
|
|
|
|
|
my $prev_line = $fh->getline (); |
437
|
|
|
|
|
|
|
while (my $line = $fh->getline ()) { |
438
|
|
|
|
|
|
|
$syn .= ' ' . $prev_line; |
439
|
|
|
|
|
|
|
$prev_line = $line; |
440
|
|
|
|
|
|
|
} |
441
|
|
|
|
|
|
|
return($syn); |
442
|
|
|
|
|
|
|
} |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
1; |