line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Check; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
300
|
use 5.018; |
|
14
|
|
|
|
|
50
|
|
4
|
|
|
|
|
|
|
|
5
|
14
|
|
|
14
|
|
95
|
use strict; |
|
14
|
|
|
|
|
34
|
|
|
14
|
|
|
|
|
309
|
|
6
|
14
|
|
|
14
|
|
424
|
use warnings; |
|
14
|
|
|
|
|
33
|
|
|
14
|
|
|
|
|
510
|
|
7
|
|
|
|
|
|
|
|
8
|
14
|
|
|
14
|
|
89
|
use Venus::Class 'attr', 'base', 'with'; |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
114
|
|
9
|
|
|
|
|
|
|
|
10
|
14
|
|
|
14
|
|
111
|
use Venus::Type; |
|
14
|
|
|
|
|
32
|
|
|
14
|
|
|
|
|
271
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
base 'Venus::Kind::Utility'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Venus::Role::Buildable'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# ATTRIBUTES |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
attr 'on_eval'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# BUILDERS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub build_arg { |
23
|
0
|
|
|
0
|
0
|
0
|
my ($self, $data) = @_; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return { |
26
|
0
|
0
|
|
|
|
0
|
on_eval => ref $data eq 'ARRAY' ? $data : [$data], |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub build_args { |
31
|
879
|
|
|
879
|
0
|
2074
|
my ($self, $data) = @_; |
32
|
|
|
|
|
|
|
|
33
|
879
|
50
|
|
|
|
3194
|
$data->{on_eval} = [] if !$data->{on_eval}; |
34
|
|
|
|
|
|
|
|
35
|
879
|
|
|
|
|
2339
|
return $data; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# METHODS |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub any { |
41
|
11
|
|
|
11
|
1
|
39
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
11
|
|
|
|
|
38
|
push @{$self->on_eval}, sub { |
44
|
13
|
|
|
13
|
|
44
|
my ($source, $value) = @_; |
45
|
13
|
|
|
|
|
68
|
return $source->pass($value, { |
46
|
|
|
|
|
|
|
from => 'any', |
47
|
|
|
|
|
|
|
}); |
48
|
11
|
|
|
|
|
26
|
}; |
49
|
|
|
|
|
|
|
|
50
|
11
|
|
|
|
|
74
|
return $self; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub accept { |
54
|
622
|
|
|
622
|
1
|
1396
|
my ($self, $name, @args) = @_; |
55
|
|
|
|
|
|
|
|
56
|
622
|
50
|
|
|
|
1289
|
if (!$name) { |
57
|
0
|
|
|
|
|
0
|
return $self; |
58
|
|
|
|
|
|
|
} |
59
|
622
|
100
|
|
|
|
2298
|
if ($self->can($name)) { |
60
|
551
|
|
|
|
|
1725
|
return $self->$name(@args); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
else { |
63
|
71
|
|
|
|
|
233
|
return $self->identity($name, @args); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub array { |
68
|
4
|
|
|
4
|
1
|
18
|
my ($self, @code) = @_; |
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
21
|
return $self->arrayref(@code); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub arrayref { |
74
|
8
|
|
|
8
|
1
|
38
|
my ($self, @code) = @_; |
75
|
|
|
|
|
|
|
|
76
|
8
|
|
|
|
|
30
|
push @{$self->on_eval}, sub { |
77
|
14
|
|
|
14
|
|
34
|
my ($source, $value) = @_; |
78
|
14
|
100
|
|
|
|
54
|
if ($source->coded($value, 'array')) { |
79
|
4
|
|
|
|
|
40
|
return $source->pass($value, { |
80
|
|
|
|
|
|
|
from => 'arrayref', |
81
|
|
|
|
|
|
|
}); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
else { |
84
|
10
|
|
|
|
|
68
|
return $source->fail($value, { |
85
|
|
|
|
|
|
|
from => 'arrayref', |
86
|
|
|
|
|
|
|
expected => 'arrayref', |
87
|
|
|
|
|
|
|
received => $source->type($value), |
88
|
|
|
|
|
|
|
with => 'error_on_coded', |
89
|
|
|
|
|
|
|
}); |
90
|
|
|
|
|
|
|
} |
91
|
8
|
|
|
|
|
17
|
}, @code; |
92
|
|
|
|
|
|
|
|
93
|
8
|
|
|
|
|
89
|
return $self; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub attributes { |
97
|
7
|
|
|
7
|
1
|
29
|
my ($self, @pairs) = @_; |
98
|
|
|
|
|
|
|
|
99
|
7
|
|
|
|
|
37
|
push @{$self->on_eval}, sub { |
100
|
7
|
|
|
7
|
|
19
|
my ($source, $value) = @_; |
101
|
7
|
100
|
|
|
|
31
|
if ($source->coded($value, 'object')) { |
102
|
6
|
|
|
|
|
84
|
return $source->pass($value, { |
103
|
|
|
|
|
|
|
from => 'attributes', |
104
|
|
|
|
|
|
|
}); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
else { |
107
|
1
|
|
|
|
|
7
|
return $source->fail($value, { |
108
|
|
|
|
|
|
|
from => 'attributes', |
109
|
|
|
|
|
|
|
expected => 'object', |
110
|
|
|
|
|
|
|
received => $source->type($value), |
111
|
|
|
|
|
|
|
with => 'error_on_coded', |
112
|
|
|
|
|
|
|
}); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
}, sub { |
115
|
6
|
|
|
6
|
|
40
|
my ($source, $value) = @_; |
116
|
6
|
100
|
|
|
|
23
|
if (@pairs % 2) { |
117
|
1
|
|
|
|
|
15
|
return $source->fail($value, { |
118
|
|
|
|
|
|
|
from => 'attributes', |
119
|
|
|
|
|
|
|
args => [@pairs], |
120
|
|
|
|
|
|
|
with => 'error_on_pairs', |
121
|
|
|
|
|
|
|
}); |
122
|
|
|
|
|
|
|
} |
123
|
5
|
|
|
|
|
23
|
my $result = true; |
124
|
5
|
|
|
|
|
40
|
for (my $i = 0; $i < @pairs;) { |
125
|
5
|
|
|
|
|
34
|
my ($key, $data) = (map $pairs[$_], $i++, $i++); |
126
|
5
|
100
|
|
|
|
32
|
if (!$value->can($key)) { |
127
|
1
|
|
|
|
|
10
|
$result = $source->fail($value, { |
128
|
|
|
|
|
|
|
from => 'attributes', |
129
|
|
|
|
|
|
|
name => $key, |
130
|
|
|
|
|
|
|
with => 'error_on_missing', |
131
|
|
|
|
|
|
|
}); |
132
|
1
|
|
|
|
|
4
|
last; |
133
|
|
|
|
|
|
|
} |
134
|
4
|
50
|
|
|
|
34
|
my ($match, @args) = (ref $data) ? (@{$data}) : ($data); |
|
0
|
|
|
|
|
0
|
|
135
|
4
|
|
|
|
|
27
|
my $check = $source->branch($key)->accept($match, @args); |
136
|
4
|
100
|
|
|
|
19
|
if (!$check->eval($value->$key)) { |
137
|
|
|
|
|
|
|
$result = $source->fail($value, { |
138
|
|
|
|
|
|
|
branch => $check->{'$branch'}, |
139
|
2
|
|
|
|
|
12
|
%{$check->{'$result'}}, |
|
2
|
|
|
|
|
18
|
|
140
|
|
|
|
|
|
|
from => 'attributes', |
141
|
|
|
|
|
|
|
}); |
142
|
2
|
|
|
|
|
10
|
last; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
} |
145
|
5
|
100
|
|
|
|
23
|
if (!$result) { |
146
|
3
|
|
|
|
|
20
|
return $result; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
else { |
149
|
2
|
|
|
|
|
10
|
return $source->pass($value, { |
150
|
|
|
|
|
|
|
from => 'attributes', |
151
|
|
|
|
|
|
|
}); |
152
|
|
|
|
|
|
|
} |
153
|
7
|
|
|
|
|
24
|
}; |
154
|
|
|
|
|
|
|
|
155
|
7
|
|
|
|
|
88
|
return $self; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub bool { |
159
|
48
|
|
|
48
|
1
|
155
|
my ($self, @code) = @_; |
160
|
|
|
|
|
|
|
|
161
|
48
|
|
|
|
|
160
|
return $self->boolean(@code); |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub boolean { |
165
|
53
|
|
|
53
|
1
|
121
|
my ($self, @code) = @_; |
166
|
|
|
|
|
|
|
|
167
|
53
|
|
|
|
|
135
|
push @{$self->on_eval}, sub { |
168
|
149
|
|
|
149
|
|
290
|
my ($source, $value) = @_; |
169
|
149
|
100
|
|
|
|
352
|
if ($source->coded($value, 'boolean')) { |
170
|
6
|
|
|
|
|
51
|
return $source->pass($value, { |
171
|
|
|
|
|
|
|
from => 'boolean', |
172
|
|
|
|
|
|
|
}); |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
else { |
175
|
143
|
|
|
|
|
481
|
return $source->fail($value, { |
176
|
|
|
|
|
|
|
from => 'boolean', |
177
|
|
|
|
|
|
|
expected => 'boolean', |
178
|
|
|
|
|
|
|
received => $source->type($value), |
179
|
|
|
|
|
|
|
with => 'error_on_coded', |
180
|
|
|
|
|
|
|
}); |
181
|
|
|
|
|
|
|
} |
182
|
53
|
|
|
|
|
90
|
}, @code; |
183
|
|
|
|
|
|
|
|
184
|
53
|
|
|
|
|
224
|
return $self; |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub branch { |
188
|
176
|
|
|
176
|
1
|
402
|
my ($self, @args) = @_; |
189
|
|
|
|
|
|
|
|
190
|
176
|
|
|
|
|
540
|
my $source = $self->new; |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
$source->{'$branch'} = [ |
193
|
176
|
100
|
|
|
|
773
|
($self->{'$branch'} ? @{$self->{'$branch'}} : ()), @args |
|
8
|
|
|
|
|
32
|
|
194
|
|
|
|
|
|
|
]; |
195
|
|
|
|
|
|
|
|
196
|
176
|
|
|
|
|
663
|
return $source; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub clear { |
200
|
6
|
|
|
6
|
1
|
18
|
my ($self) = @_; |
201
|
|
|
|
|
|
|
|
202
|
6
|
|
|
|
|
15
|
@{$self->on_eval} = (); |
|
6
|
|
|
|
|
20
|
|
203
|
|
|
|
|
|
|
|
204
|
6
|
|
|
|
|
21
|
delete $self->{'$branch'}; |
205
|
6
|
|
|
|
|
18
|
delete $self->{'$result'}; |
206
|
|
|
|
|
|
|
|
207
|
6
|
|
|
|
|
22
|
return $self; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub code { |
211
|
4
|
|
|
4
|
1
|
14
|
my ($self, @code) = @_; |
212
|
|
|
|
|
|
|
|
213
|
4
|
|
|
|
|
16
|
return $self->coderef(@code); |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
sub coded { |
217
|
1275
|
|
|
1275
|
1
|
2542
|
my ($self, $data, $name) = @_; |
218
|
|
|
|
|
|
|
|
219
|
1275
|
|
|
|
|
4380
|
require Venus::Type; |
220
|
|
|
|
|
|
|
|
221
|
1275
|
100
|
|
|
|
4959
|
return Venus::Type->new($data)->coded($name) ? true : false; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
sub coderef { |
225
|
13
|
|
|
13
|
1
|
33
|
my ($self, @code) = @_; |
226
|
|
|
|
|
|
|
|
227
|
13
|
|
|
|
|
41
|
push @{$self->on_eval}, sub { |
228
|
21
|
|
|
21
|
|
53
|
my ($source, $value) = @_; |
229
|
21
|
100
|
|
|
|
54
|
if ($source->coded($value, 'code')) { |
230
|
6
|
|
|
|
|
51
|
return $source->pass($value, { |
231
|
|
|
|
|
|
|
from => 'coderef', |
232
|
|
|
|
|
|
|
}); |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
else { |
235
|
15
|
|
|
|
|
85
|
return $source->fail($value, { |
236
|
|
|
|
|
|
|
from => 'coderef', |
237
|
|
|
|
|
|
|
expected => 'coderef', |
238
|
|
|
|
|
|
|
received => $source->type($value), |
239
|
|
|
|
|
|
|
with => 'error_on_coded', |
240
|
|
|
|
|
|
|
}); |
241
|
|
|
|
|
|
|
} |
242
|
13
|
|
|
|
|
25
|
}, @code; |
243
|
|
|
|
|
|
|
|
244
|
13
|
|
|
|
|
141
|
return $self; |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
sub consumes { |
248
|
5
|
|
|
5
|
1
|
24
|
my ($self, $role) = @_; |
249
|
|
|
|
|
|
|
|
250
|
5
|
|
|
|
|
23
|
push @{$self->on_eval}, sub { |
251
|
9
|
|
|
9
|
|
26
|
my ($source, $value) = @_; |
252
|
9
|
100
|
|
|
|
33
|
if ($source->coded($value, 'object')) { |
253
|
5
|
|
|
|
|
39
|
return $source->pass($value, { |
254
|
|
|
|
|
|
|
from => 'consumes', |
255
|
|
|
|
|
|
|
}); |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
else { |
258
|
4
|
|
|
|
|
22
|
return $source->fail($value, { |
259
|
|
|
|
|
|
|
from => 'consumes', |
260
|
|
|
|
|
|
|
expected => 'object', |
261
|
|
|
|
|
|
|
received => $source->type($value), |
262
|
|
|
|
|
|
|
with => 'error_on_coded', |
263
|
|
|
|
|
|
|
}); |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
}, sub { |
266
|
5
|
|
|
5
|
|
18
|
my ($source, $value) = @_; |
267
|
5
|
100
|
66
|
|
|
68
|
if ($value->can('DOES') && $value->DOES($role)) { |
268
|
2
|
|
|
|
|
12
|
return $source->pass($value, { |
269
|
|
|
|
|
|
|
from => 'consumes', |
270
|
|
|
|
|
|
|
}); |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
else { |
273
|
3
|
|
|
|
|
27
|
return $source->fail($value, { |
274
|
|
|
|
|
|
|
from => 'consumes', |
275
|
|
|
|
|
|
|
role => $role, |
276
|
|
|
|
|
|
|
with => 'error_on_consumes', |
277
|
|
|
|
|
|
|
}); |
278
|
|
|
|
|
|
|
} |
279
|
5
|
|
|
|
|
13
|
}; |
280
|
|
|
|
|
|
|
|
281
|
5
|
|
|
|
|
63
|
return $self; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub defined { |
285
|
4
|
|
|
4
|
1
|
14
|
my ($self, @code) = @_; |
286
|
|
|
|
|
|
|
|
287
|
4
|
|
|
|
|
16
|
push @{$self->on_eval}, sub { |
288
|
8
|
|
|
8
|
|
14
|
my ($source, $value) = @_; |
289
|
8
|
100
|
|
|
|
22
|
if (CORE::defined($value)) { |
290
|
5
|
|
|
|
|
28
|
return $source->pass($value, { |
291
|
|
|
|
|
|
|
from => 'defined', |
292
|
|
|
|
|
|
|
}); |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
else { |
295
|
3
|
|
|
|
|
20
|
return $source->fail($value, { |
296
|
|
|
|
|
|
|
from => 'defined', |
297
|
|
|
|
|
|
|
with => 'error_on_defined', |
298
|
|
|
|
|
|
|
}); |
299
|
|
|
|
|
|
|
} |
300
|
4
|
|
|
|
|
7
|
}, @code; |
301
|
|
|
|
|
|
|
|
302
|
4
|
|
|
|
|
42
|
return $self; |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
sub either { |
306
|
34
|
|
|
34
|
1
|
130
|
my ($self, @data) = @_; |
307
|
|
|
|
|
|
|
|
308
|
34
|
|
|
|
|
133
|
push @{$self->on_eval}, sub { |
309
|
59
|
|
|
59
|
|
155
|
my ($source, $value) = @_; |
310
|
59
|
|
|
|
|
182
|
my $returns; |
311
|
|
|
|
|
|
|
my @errors; |
312
|
59
|
|
|
|
|
0
|
my @results; |
313
|
59
|
|
|
|
|
203
|
for (my $i = 0; $i < @data; $i++) { |
314
|
107
|
100
|
|
|
|
388
|
my ($match, @args) = (ref $data[$i]) ? (@{$data[$i]}) : ($data[$i]); |
|
19
|
|
|
|
|
61
|
|
315
|
107
|
|
|
|
|
310
|
my $check = $source->branch->do('accept', $match, @args); |
316
|
107
|
100
|
|
|
|
338
|
if ($check->eval($value)) { |
317
|
|
|
|
|
|
|
$returns = $source->pass($value, { |
318
|
|
|
|
|
|
|
from => 'either', |
319
|
|
|
|
|
|
|
($check->{'$branch'} ? (branch => $check->{'$branch'}) : ()), |
320
|
37
|
50
|
|
|
|
160
|
%{$check->{'$result'}}, |
|
37
|
|
|
|
|
237
|
|
321
|
|
|
|
|
|
|
}); |
322
|
37
|
|
|
|
|
146
|
push @results, $source->{'$result'}; |
323
|
37
|
|
|
|
|
157
|
last; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
else { |
326
|
|
|
|
|
|
|
$returns = $source->fail($value, { |
327
|
|
|
|
|
|
|
from => 'either', |
328
|
|
|
|
|
|
|
($check->{'$branch'} ? (branch => $check->{'$branch'}) : ()), |
329
|
70
|
50
|
|
|
|
282
|
%{$check->{'$result'}}, |
|
70
|
|
|
|
|
480
|
|
330
|
|
|
|
|
|
|
}); |
331
|
70
|
|
|
|
|
318
|
push @results, $source->{'$result'}; |
332
|
70
|
|
|
|
|
314
|
push @errors, $source->catch('result')->render; |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
} |
335
|
59
|
100
|
|
|
|
207
|
if ($returns) { |
336
|
37
|
|
|
|
|
223
|
return $returns; |
337
|
|
|
|
|
|
|
} |
338
|
|
|
|
|
|
|
else { |
339
|
22
|
|
|
|
|
220
|
return $self->fail($value, { |
340
|
|
|
|
|
|
|
from => 'either', |
341
|
|
|
|
|
|
|
with => 'error_on_either', |
342
|
|
|
|
|
|
|
results => [@results], |
343
|
|
|
|
|
|
|
errors => [@errors], |
344
|
|
|
|
|
|
|
}); |
345
|
|
|
|
|
|
|
} |
346
|
34
|
|
|
|
|
70
|
}; |
347
|
|
|
|
|
|
|
|
348
|
34
|
|
|
|
|
152
|
return $self; |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
sub enum { |
352
|
5
|
|
|
5
|
1
|
41
|
my ($self, @data) = @_; |
353
|
|
|
|
|
|
|
|
354
|
5
|
|
|
|
|
23
|
push @{$self->on_eval}, sub { |
355
|
8
|
|
|
8
|
|
17
|
my ($source, $value) = @_; |
356
|
8
|
100
|
|
|
|
26
|
if (CORE::defined($value)) { |
357
|
7
|
|
|
|
|
41
|
return $source->pass($value, { |
358
|
|
|
|
|
|
|
from => 'enum', |
359
|
|
|
|
|
|
|
}); |
360
|
|
|
|
|
|
|
} |
361
|
|
|
|
|
|
|
else { |
362
|
1
|
|
|
|
|
10
|
return $source->fail($value, { |
363
|
|
|
|
|
|
|
from => 'enum', |
364
|
|
|
|
|
|
|
with => 'error_on_defined', |
365
|
|
|
|
|
|
|
}); |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
}, sub { |
368
|
7
|
|
|
7
|
|
19
|
my ($source, $value) = @_; |
369
|
7
|
|
|
|
|
14
|
my $result; |
370
|
7
|
|
|
|
|
19
|
for my $item (@data) { |
371
|
16
|
100
|
|
|
|
37
|
if ($value eq $item) { |
372
|
4
|
|
|
|
|
15
|
$result = $source->pass($value, { |
373
|
|
|
|
|
|
|
from => 'enum', |
374
|
|
|
|
|
|
|
}); |
375
|
4
|
|
|
|
|
12
|
last; |
376
|
|
|
|
|
|
|
} |
377
|
|
|
|
|
|
|
else { |
378
|
12
|
|
|
|
|
59
|
$result = $source->fail($value, { |
379
|
|
|
|
|
|
|
from => 'enum', |
380
|
|
|
|
|
|
|
with => 'error_on_enum', |
381
|
|
|
|
|
|
|
enum => [@data], |
382
|
|
|
|
|
|
|
}); |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
} |
385
|
7
|
|
|
|
|
24
|
return $result; |
386
|
5
|
|
|
|
|
14
|
}; |
387
|
|
|
|
|
|
|
|
388
|
5
|
|
|
|
|
61
|
return $self; |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
sub eval { |
392
|
1495
|
|
|
1495
|
1
|
48001
|
my ($self, $data) = @_; |
393
|
|
|
|
|
|
|
|
394
|
1495
|
|
|
|
|
3943
|
delete $self->{'$result'}; |
395
|
|
|
|
|
|
|
|
396
|
1495
|
|
|
|
|
3909
|
my $result = false; |
397
|
|
|
|
|
|
|
|
398
|
1495
|
|
|
|
|
2621
|
for my $callback (@{$self->on_eval}) { |
|
1495
|
|
|
|
|
4064
|
|
399
|
1856
|
|
|
|
|
3397
|
local $_ = $data; |
400
|
1856
|
100
|
|
|
|
4679
|
$result = $self->$callback($data) ? true : false; |
401
|
1856
|
100
|
|
|
|
5926
|
last if !$result; |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
|
404
|
1495
|
|
|
|
|
5902
|
return $result; |
405
|
|
|
|
|
|
|
} |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
sub evaled { |
408
|
2
|
|
|
2
|
1
|
9
|
my ($self) = @_; |
409
|
|
|
|
|
|
|
|
410
|
2
|
|
|
|
|
11
|
my $passed = $self->passed; |
411
|
2
|
|
|
|
|
13
|
my $failed = $self->failed; |
412
|
|
|
|
|
|
|
|
413
|
2
|
100
|
66
|
|
|
19
|
return !$passed && !$failed ? false : true; |
414
|
|
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
sub evaler { |
417
|
2
|
|
|
2
|
1
|
10
|
my ($self, @args) = @_; |
418
|
|
|
|
|
|
|
|
419
|
2
|
|
|
|
|
29
|
return $self->defer('eval', @args); |
420
|
|
|
|
|
|
|
} |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
sub fail { |
423
|
1102
|
|
|
1102
|
1
|
2643
|
my ($self, $data, $meta) = @_; |
424
|
|
|
|
|
|
|
|
425
|
1102
|
|
50
|
|
|
2690
|
my $from = $meta->{from} || 'callback'; |
426
|
1102
|
|
|
|
|
1922
|
my $with = $meta->{with}; |
427
|
1102
|
|
|
|
|
2871
|
my $okay = false; |
428
|
|
|
|
|
|
|
|
429
|
1102
|
|
|
|
|
7189
|
$self->{'$result'} = { |
430
|
|
|
|
|
|
|
%$meta, |
431
|
|
|
|
|
|
|
data => $data, |
432
|
|
|
|
|
|
|
from => $from, |
433
|
|
|
|
|
|
|
okay => $okay, |
434
|
|
|
|
|
|
|
with => $with, |
435
|
|
|
|
|
|
|
}; |
436
|
|
|
|
|
|
|
|
437
|
1102
|
|
|
|
|
5506
|
return $okay; |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
sub failed { |
441
|
5
|
|
|
5
|
1
|
13
|
my ($self) = @_; |
442
|
|
|
|
|
|
|
|
443
|
5
|
|
|
|
|
12
|
my $result = $self->{'$result'}; |
444
|
|
|
|
|
|
|
|
445
|
5
|
100
|
|
|
|
29
|
return $result ? ($result->{okay} ? false : true) : false; |
|
|
100
|
|
|
|
|
|
446
|
|
|
|
|
|
|
} |
447
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
sub float { |
449
|
85
|
|
|
85
|
1
|
254
|
my ($self, @code) = @_; |
450
|
|
|
|
|
|
|
|
451
|
85
|
|
|
|
|
286
|
push @{$self->on_eval}, sub { |
452
|
185
|
|
|
185
|
|
395
|
my ($source, $value) = @_; |
453
|
185
|
100
|
|
|
|
524
|
if ($source->coded($value, 'float')) { |
454
|
35
|
|
|
|
|
238
|
return $source->pass($value, { |
455
|
|
|
|
|
|
|
from => 'float', |
456
|
|
|
|
|
|
|
}); |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
else { |
459
|
150
|
|
|
|
|
581
|
return $source->fail($value, { |
460
|
|
|
|
|
|
|
from => 'float', |
461
|
|
|
|
|
|
|
expected => 'float', |
462
|
|
|
|
|
|
|
received => $source->type($value), |
463
|
|
|
|
|
|
|
with => 'error_on_coded', |
464
|
|
|
|
|
|
|
}); |
465
|
|
|
|
|
|
|
} |
466
|
85
|
|
|
|
|
157
|
}, @code; |
467
|
|
|
|
|
|
|
|
468
|
85
|
|
|
|
|
288
|
return $self; |
469
|
|
|
|
|
|
|
} |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
sub hash { |
472
|
4
|
|
|
4
|
1
|
12
|
my ($self, @code) = @_; |
473
|
|
|
|
|
|
|
|
474
|
4
|
|
|
|
|
17
|
return $self->hashref(@code); |
475
|
|
|
|
|
|
|
} |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
sub hashkeys { |
478
|
33
|
|
|
33
|
1
|
93
|
my ($self, @pairs) = @_; |
479
|
|
|
|
|
|
|
|
480
|
33
|
|
|
|
|
138
|
push @{$self->on_eval}, sub { |
481
|
32
|
|
|
32
|
|
65
|
my ($source, $value) = @_; |
482
|
32
|
100
|
|
|
|
82
|
if (CORE::defined($value)) { |
483
|
27
|
|
|
|
|
111
|
return $source->pass($value, { |
484
|
|
|
|
|
|
|
from => 'hashkeys', |
485
|
|
|
|
|
|
|
}); |
486
|
|
|
|
|
|
|
} |
487
|
|
|
|
|
|
|
else { |
488
|
5
|
|
|
|
|
28
|
return $source->fail($value, { |
489
|
|
|
|
|
|
|
from => 'hashkeys', |
490
|
|
|
|
|
|
|
with => 'error_on_defined', |
491
|
|
|
|
|
|
|
}); |
492
|
|
|
|
|
|
|
} |
493
|
|
|
|
|
|
|
}, sub { |
494
|
27
|
|
|
27
|
|
59
|
my ($source, $value) = @_; |
495
|
27
|
100
|
|
|
|
91
|
if (UNIVERSAL::isa($value, 'HASH')) { |
496
|
26
|
|
|
|
|
90
|
return $source->pass($value, { |
497
|
|
|
|
|
|
|
from => 'hashkeys', |
498
|
|
|
|
|
|
|
}); |
499
|
|
|
|
|
|
|
} |
500
|
|
|
|
|
|
|
else { |
501
|
1
|
|
|
|
|
8
|
return $source->fail($value, { |
502
|
|
|
|
|
|
|
from => 'hashkeys', |
503
|
|
|
|
|
|
|
with => 'error_on_hashref', |
504
|
|
|
|
|
|
|
}); |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
}, sub { |
507
|
26
|
|
|
26
|
|
59
|
my ($source, $value) = @_; |
508
|
26
|
100
|
|
|
|
46
|
if ((CORE::keys %{$value}) > 0) { |
|
26
|
|
|
|
|
91
|
|
509
|
16
|
|
|
|
|
55
|
return $source->pass($value, { |
510
|
|
|
|
|
|
|
from => 'hashkeys', |
511
|
|
|
|
|
|
|
}); |
512
|
|
|
|
|
|
|
} |
513
|
|
|
|
|
|
|
else { |
514
|
10
|
|
|
|
|
45
|
return $source->fail($value, { |
515
|
|
|
|
|
|
|
from => 'hashkeys', |
516
|
|
|
|
|
|
|
with => 'error_on_hashref_empty', |
517
|
|
|
|
|
|
|
}); |
518
|
|
|
|
|
|
|
} |
519
|
|
|
|
|
|
|
}, sub { |
520
|
16
|
|
|
16
|
|
33
|
my ($source, $value) = @_; |
521
|
16
|
100
|
|
|
|
53
|
if (@pairs % 2) { |
522
|
1
|
|
|
|
|
10
|
return $source->fail($value, { |
523
|
|
|
|
|
|
|
from => 'hashkeys', |
524
|
|
|
|
|
|
|
args => [@pairs], |
525
|
|
|
|
|
|
|
with => 'error_on_pairs', |
526
|
|
|
|
|
|
|
}); |
527
|
|
|
|
|
|
|
} |
528
|
15
|
|
|
|
|
35
|
my $result = true; |
529
|
15
|
|
|
|
|
51
|
for (my $i = 0; $i < @pairs;) { |
530
|
27
|
|
|
|
|
128
|
my ($key, $data) = (map $pairs[$_], $i++, $i++); |
531
|
27
|
100
|
|
|
|
78
|
if (!exists $value->{$key}) { |
532
|
1
|
|
|
|
|
9
|
$result = $source->fail($value, { |
533
|
|
|
|
|
|
|
from => 'hashkeys', |
534
|
|
|
|
|
|
|
name => $key, |
535
|
|
|
|
|
|
|
with => 'error_on_missing', |
536
|
|
|
|
|
|
|
}); |
537
|
1
|
|
|
|
|
4
|
last; |
538
|
|
|
|
|
|
|
} |
539
|
26
|
100
|
|
|
|
69
|
my ($match, @args) = (ref $data) ? (@{$data}) : ($data); |
|
8
|
|
|
|
|
26
|
|
540
|
26
|
|
|
|
|
71
|
my $check = $source->branch($key)->accept($match, @args); |
541
|
26
|
100
|
|
|
|
75
|
if (!$check->eval($value->{$key})) { |
542
|
|
|
|
|
|
|
$result = $source->fail($value, { |
543
|
|
|
|
|
|
|
branch => $check->{'$branch'}, |
544
|
4
|
|
|
|
|
10
|
%{$check->{'$result'}}, |
|
4
|
|
|
|
|
32
|
|
545
|
|
|
|
|
|
|
from => 'hashkeys', |
546
|
|
|
|
|
|
|
}); |
547
|
4
|
|
|
|
|
17
|
last; |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
} |
550
|
15
|
100
|
|
|
|
37
|
if (!$result) { |
551
|
5
|
|
|
|
|
21
|
return $result; |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
else { |
554
|
10
|
|
|
|
|
39
|
return $source->pass($value, { |
555
|
|
|
|
|
|
|
from => 'hashkeys', |
556
|
|
|
|
|
|
|
}); |
557
|
|
|
|
|
|
|
} |
558
|
33
|
|
|
|
|
56
|
}; |
559
|
|
|
|
|
|
|
|
560
|
33
|
|
|
|
|
173
|
return $self; |
561
|
|
|
|
|
|
|
} |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
sub hashref { |
564
|
55
|
|
|
55
|
1
|
145
|
my ($self, @code) = @_; |
565
|
|
|
|
|
|
|
|
566
|
55
|
|
|
|
|
145
|
push @{$self->on_eval}, sub { |
567
|
152
|
|
|
152
|
|
260
|
my ($source, $value) = @_; |
568
|
152
|
100
|
|
|
|
420
|
if ($source->coded($value, 'hash')) { |
569
|
4
|
|
|
|
|
32
|
return $source->pass($value, { |
570
|
|
|
|
|
|
|
from => 'hashref', |
571
|
|
|
|
|
|
|
}); |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
else { |
574
|
148
|
|
|
|
|
539
|
return $source->fail($value, { |
575
|
|
|
|
|
|
|
from => 'hashref', |
576
|
|
|
|
|
|
|
expected => 'hashref', |
577
|
|
|
|
|
|
|
received => $source->type($value), |
578
|
|
|
|
|
|
|
with => 'error_on_coded', |
579
|
|
|
|
|
|
|
}); |
580
|
|
|
|
|
|
|
} |
581
|
55
|
|
|
|
|
90
|
}, @code; |
582
|
|
|
|
|
|
|
|
583
|
55
|
|
|
|
|
232
|
return $self; |
584
|
|
|
|
|
|
|
} |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
sub includes { |
587
|
4
|
|
|
4
|
1
|
20
|
my ($self, @data) = @_; |
588
|
|
|
|
|
|
|
|
589
|
4
|
|
|
|
|
18
|
push @{$self->on_eval}, sub { |
590
|
6
|
|
|
6
|
|
15
|
my ($source, $value) = @_; |
591
|
6
|
|
|
|
|
17
|
my $returns; |
592
|
|
|
|
|
|
|
my @errors; |
593
|
6
|
|
|
|
|
0
|
my @results; |
594
|
6
|
|
|
|
|
27
|
for (my $i = 0; $i < @data; $i++) { |
595
|
9
|
50
|
|
|
|
35
|
my ($match, @args) = (ref $data[$i]) ? (@{$data[$i]}) : ($data[$i]); |
|
0
|
|
|
|
|
0
|
|
596
|
9
|
|
|
|
|
33
|
my $check = $source->branch->do('accept', $match, @args); |
597
|
9
|
100
|
|
|
|
34
|
if ($check->eval($value)) { |
598
|
|
|
|
|
|
|
$returns = $source->pass($value, { |
599
|
|
|
|
|
|
|
from => 'either', |
600
|
|
|
|
|
|
|
($check->{'$branch'} ? (branch => $check->{'$branch'}) : ()), |
601
|
6
|
50
|
|
|
|
23
|
%{$check->{'$result'}}, |
|
6
|
|
|
|
|
37
|
|
602
|
|
|
|
|
|
|
}); |
603
|
6
|
|
|
|
|
34
|
push @results, $source->{'$result'}; |
604
|
|
|
|
|
|
|
} |
605
|
|
|
|
|
|
|
else { |
606
|
|
|
|
|
|
|
$returns = $source->fail($value, { |
607
|
|
|
|
|
|
|
from => 'either', |
608
|
|
|
|
|
|
|
($check->{'$branch'} ? (branch => $check->{'$branch'}) : ()), |
609
|
3
|
50
|
|
|
|
19
|
%{$check->{'$result'}}, |
|
3
|
|
|
|
|
29
|
|
610
|
|
|
|
|
|
|
}); |
611
|
3
|
|
|
|
|
14
|
push @results, $source->{'$result'}; |
612
|
3
|
|
|
|
|
21
|
push @errors, $source->catch('result')->render; |
613
|
3
|
|
|
|
|
16
|
last; |
614
|
|
|
|
|
|
|
} |
615
|
|
|
|
|
|
|
} |
616
|
6
|
100
|
|
|
|
22
|
if (@errors) { |
617
|
3
|
|
|
|
|
30
|
return $self->fail($value, { |
618
|
|
|
|
|
|
|
from => 'includes', |
619
|
|
|
|
|
|
|
with => 'error_on_includes', |
620
|
|
|
|
|
|
|
results => [@results], |
621
|
|
|
|
|
|
|
errors => [@errors], |
622
|
|
|
|
|
|
|
}); |
623
|
|
|
|
|
|
|
} |
624
|
|
|
|
|
|
|
else { |
625
|
3
|
|
|
|
|
18
|
return $returns; |
626
|
|
|
|
|
|
|
} |
627
|
4
|
|
|
|
|
10
|
}; |
628
|
|
|
|
|
|
|
|
629
|
4
|
|
|
|
|
79
|
return $self; |
630
|
|
|
|
|
|
|
} |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
sub identity { |
633
|
78
|
|
|
78
|
1
|
168
|
my ($self, $name) = @_; |
634
|
|
|
|
|
|
|
|
635
|
78
|
|
|
|
|
229
|
push @{$self->on_eval}, sub { |
636
|
134
|
|
|
134
|
|
264
|
my ($source, $value) = @_; |
637
|
134
|
100
|
|
|
|
371
|
if ($source->coded($value, 'object')) { |
638
|
109
|
|
|
|
|
475
|
return $source->pass($value, { |
639
|
|
|
|
|
|
|
from => 'identity', |
640
|
|
|
|
|
|
|
}); |
641
|
|
|
|
|
|
|
} |
642
|
|
|
|
|
|
|
else { |
643
|
25
|
|
|
|
|
126
|
return $source->fail($value, { |
644
|
|
|
|
|
|
|
from => 'identity', |
645
|
|
|
|
|
|
|
expected => 'object', |
646
|
|
|
|
|
|
|
received => $source->type($value), |
647
|
|
|
|
|
|
|
with => 'error_on_coded', |
648
|
|
|
|
|
|
|
}); |
649
|
|
|
|
|
|
|
} |
650
|
|
|
|
|
|
|
}, sub { |
651
|
109
|
|
|
109
|
|
251
|
my ($source, $value) = @_; |
652
|
109
|
100
|
|
|
|
427
|
if ($value->isa($name)) { |
653
|
103
|
|
|
|
|
360
|
return $source->pass($value, { |
654
|
|
|
|
|
|
|
from => 'identity', |
655
|
|
|
|
|
|
|
}); |
656
|
|
|
|
|
|
|
} |
657
|
|
|
|
|
|
|
else { |
658
|
6
|
|
|
|
|
49
|
return $source->fail($value, { |
659
|
|
|
|
|
|
|
from => 'identity', |
660
|
|
|
|
|
|
|
with => 'error_on_identity', |
661
|
|
|
|
|
|
|
name => $name, |
662
|
|
|
|
|
|
|
}); |
663
|
|
|
|
|
|
|
} |
664
|
78
|
|
|
|
|
125
|
}; |
665
|
|
|
|
|
|
|
|
666
|
78
|
|
|
|
|
264
|
return $self; |
667
|
|
|
|
|
|
|
} |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
sub inherits { |
670
|
5
|
|
|
5
|
1
|
22
|
my ($self, $name) = @_; |
671
|
|
|
|
|
|
|
|
672
|
5
|
|
|
|
|
23
|
push @{$self->on_eval}, sub { |
673
|
9
|
|
|
9
|
|
24
|
my ($source, $value) = @_; |
674
|
9
|
100
|
|
|
|
33
|
if ($source->coded($value, 'object')) { |
675
|
5
|
|
|
|
|
35
|
return $source->pass($value, { |
676
|
|
|
|
|
|
|
from => 'inherits', |
677
|
|
|
|
|
|
|
}); |
678
|
|
|
|
|
|
|
} |
679
|
|
|
|
|
|
|
else { |
680
|
4
|
|
|
|
|
20
|
return $source->fail($value, { |
681
|
|
|
|
|
|
|
from => 'inherits', |
682
|
|
|
|
|
|
|
expected => 'object', |
683
|
|
|
|
|
|
|
received => $source->type($value), |
684
|
|
|
|
|
|
|
with => 'error_on_coded', |
685
|
|
|
|
|
|
|
}); |
686
|
|
|
|
|
|
|
} |
687
|
|
|
|
|
|
|
}, sub { |
688
|
5
|
|
|
5
|
|
14
|
my ($source, $value) = @_; |
689
|
5
|
100
|
|
|
|
38
|
if ($value->isa($name)) { |
690
|
2
|
|
|
|
|
11
|
return $source->pass($value, { |
691
|
|
|
|
|
|
|
from => 'inherits', |
692
|
|
|
|
|
|
|
}); |
693
|
|
|
|
|
|
|
} |
694
|
|
|
|
|
|
|
else { |
695
|
3
|
|
|
|
|
24
|
return $source->fail($value, { |
696
|
|
|
|
|
|
|
from => 'inherits', |
697
|
|
|
|
|
|
|
with => 'error_on_inherits', |
698
|
|
|
|
|
|
|
name => $name, |
699
|
|
|
|
|
|
|
}); |
700
|
|
|
|
|
|
|
} |
701
|
5
|
|
|
|
|
10
|
}; |
702
|
|
|
|
|
|
|
|
703
|
5
|
|
|
|
|
71
|
return $self; |
704
|
|
|
|
|
|
|
} |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
sub integrates { |
707
|
5
|
|
|
5
|
1
|
16
|
my ($self, $role) = @_; |
708
|
|
|
|
|
|
|
|
709
|
5
|
|
|
|
|
19
|
push @{$self->on_eval}, sub { |
710
|
9
|
|
|
9
|
|
22
|
my ($source, $value) = @_; |
711
|
9
|
100
|
|
|
|
25
|
if ($source->coded($value, 'object')) { |
712
|
5
|
|
|
|
|
29
|
return $source->pass($value, { |
713
|
|
|
|
|
|
|
from => 'integrates', |
714
|
|
|
|
|
|
|
}); |
715
|
|
|
|
|
|
|
} |
716
|
|
|
|
|
|
|
else { |
717
|
4
|
|
|
|
|
20
|
return $source->fail($value, { |
718
|
|
|
|
|
|
|
from => 'integrates', |
719
|
|
|
|
|
|
|
expected => 'object', |
720
|
|
|
|
|
|
|
received => $source->type($value), |
721
|
|
|
|
|
|
|
with => 'error_on_coded', |
722
|
|
|
|
|
|
|
}); |
723
|
|
|
|
|
|
|
} |
724
|
|
|
|
|
|
|
}, sub { |
725
|
5
|
|
|
5
|
|
16
|
my ($source, $value) = @_; |
726
|
5
|
100
|
66
|
|
|
59
|
if ($value->can('DOES') && $value->DOES($role)) { |
727
|
2
|
|
|
|
|
12
|
return $source->pass($value, { |
728
|
|
|
|
|
|
|
from => 'integrates', |
729
|
|
|
|
|
|
|
}); |
730
|
|
|
|
|
|
|
} |
731
|
|
|
|
|
|
|
else { |
732
|
3
|
|
|
|
|
18
|
return $source->fail($value, { |
733
|
|
|
|
|
|
|
from => 'integrates', |
734
|
|
|
|
|
|
|
role => $role, |
735
|
|
|
|
|
|
|
with => 'error_on_consumes', |
736
|
|
|
|
|
|
|
}); |
737
|
|
|
|
|
|
|
} |
738
|
5
|
|
|
|
|
10
|
}; |
739
|
|
|
|
|
|
|
|
740
|
5
|
|
|
|
|
56
|
return $self; |
741
|
|
|
|
|
|
|
} |
742
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
sub maybe { |
744
|
5
|
|
|
5
|
1
|
22
|
my ($self, $match, @args) = @_; |
745
|
|
|
|
|
|
|
|
746
|
5
|
50
|
|
|
|
43
|
$self->either('undef', ($match ? [$match, @args] : ())); |
747
|
|
|
|
|
|
|
|
748
|
5
|
|
|
|
|
58
|
return $self; |
749
|
|
|
|
|
|
|
} |
750
|
|
|
|
|
|
|
|
751
|
|
|
|
|
|
|
sub number { |
752
|
106
|
|
|
106
|
1
|
301
|
my ($self, @code) = @_; |
753
|
|
|
|
|
|
|
|
754
|
106
|
|
|
|
|
298
|
push @{$self->on_eval}, sub { |
755
|
216
|
|
|
216
|
|
522
|
my ($source, $value) = @_; |
756
|
216
|
100
|
|
|
|
564
|
if ($source->coded($value, 'number')) { |
757
|
53
|
|
|
|
|
361
|
return $source->pass($value, { |
758
|
|
|
|
|
|
|
from => 'number', |
759
|
|
|
|
|
|
|
}); |
760
|
|
|
|
|
|
|
} |
761
|
|
|
|
|
|
|
else { |
762
|
163
|
|
|
|
|
603
|
return $source->fail($value, { |
763
|
|
|
|
|
|
|
from => 'number', |
764
|
|
|
|
|
|
|
expected => 'number', |
765
|
|
|
|
|
|
|
received => $source->type($value), |
766
|
|
|
|
|
|
|
with => 'error_on_coded', |
767
|
|
|
|
|
|
|
}); |
768
|
|
|
|
|
|
|
} |
769
|
106
|
|
|
|
|
202
|
}, @code; |
770
|
|
|
|
|
|
|
|
771
|
106
|
|
|
|
|
358
|
return $self; |
772
|
|
|
|
|
|
|
} |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
sub object { |
775
|
8
|
|
|
8
|
1
|
30
|
my ($self, @code) = @_; |
776
|
|
|
|
|
|
|
|
777
|
8
|
|
|
|
|
41
|
push @{$self->on_eval}, sub { |
778
|
21
|
|
|
21
|
|
59
|
my ($source, $value) = @_; |
779
|
21
|
100
|
|
|
|
62
|
if ($source->coded($value, 'object')) { |
780
|
8
|
|
|
|
|
52
|
return $source->pass($value, { |
781
|
|
|
|
|
|
|
from => 'object', |
782
|
|
|
|
|
|
|
}); |
783
|
|
|
|
|
|
|
} |
784
|
|
|
|
|
|
|
else { |
785
|
13
|
|
|
|
|
65
|
return $source->fail($value, { |
786
|
|
|
|
|
|
|
from => 'object', |
787
|
|
|
|
|
|
|
expected => 'object', |
788
|
|
|
|
|
|
|
received => $source->type($value), |
789
|
|
|
|
|
|
|
with => 'error_on_coded', |
790
|
|
|
|
|
|
|
}); |
791
|
|
|
|
|
|
|
} |
792
|
8
|
|
|
|
|
17
|
}, @code; |
793
|
|
|
|
|
|
|
|
794
|
8
|
|
|
|
|
64
|
return $self; |
795
|
|
|
|
|
|
|
} |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
sub package { |
798
|
6
|
|
|
6
|
1
|
30
|
my ($self, @code) = @_; |
799
|
|
|
|
|
|
|
|
800
|
6
|
|
|
|
|
28
|
push @{$self->on_eval}, sub { |
801
|
9
|
|
|
9
|
|
26
|
my ($source, $value) = @_; |
802
|
9
|
100
|
|
|
|
38
|
if ($source->coded($value, 'string')) { |
803
|
6
|
|
|
|
|
40
|
return $source->pass($value, { |
804
|
|
|
|
|
|
|
from => 'package', |
805
|
|
|
|
|
|
|
}); |
806
|
|
|
|
|
|
|
} |
807
|
|
|
|
|
|
|
else { |
808
|
3
|
|
|
|
|
36
|
return $source->fail($value, { |
809
|
|
|
|
|
|
|
from => 'package', |
810
|
|
|
|
|
|
|
expected => 'string', |
811
|
|
|
|
|
|
|
received => $source->type($value), |
812
|
|
|
|
|
|
|
with => 'error_on_coded', |
813
|
|
|
|
|
|
|
}); |
814
|
|
|
|
|
|
|
} |
815
|
|
|
|
|
|
|
}, sub { |
816
|
6
|
|
|
6
|
|
18
|
my ($source, $value) = @_; |
817
|
6
|
100
|
|
|
|
68
|
if ($value =~ /^[A-Z](?:(?:\w|::)*[a-zA-Z0-9])?$/) { |
818
|
5
|
|
|
|
|
26
|
return $source->pass($value, { |
819
|
|
|
|
|
|
|
from => 'package', |
820
|
|
|
|
|
|
|
}); |
821
|
|
|
|
|
|
|
} |
822
|
|
|
|
|
|
|
else { |
823
|
1
|
|
|
|
|
10
|
return $source->fail($value, { |
824
|
|
|
|
|
|
|
from => 'package', |
825
|
|
|
|
|
|
|
with => 'error_on_package', |
826
|
|
|
|
|
|
|
}); |
827
|
|
|
|
|
|
|
} |
828
|
|
|
|
|
|
|
}, sub { |
829
|
5
|
|
|
5
|
|
17
|
my ($source, $value) = @_; |
830
|
5
|
|
|
|
|
21
|
require Venus::Space; |
831
|
5
|
100
|
|
|
|
47
|
if (Venus::Space->new($value)->loaded) { |
832
|
2
|
|
|
|
|
13
|
return $source->pass($value, { |
833
|
|
|
|
|
|
|
from => 'package', |
834
|
|
|
|
|
|
|
}); |
835
|
|
|
|
|
|
|
} |
836
|
|
|
|
|
|
|
else { |
837
|
3
|
|
|
|
|
26
|
return $source->fail($value, { |
838
|
|
|
|
|
|
|
from => 'package', |
839
|
|
|
|
|
|
|
with => 'error_on_package_loaded', |
840
|
|
|
|
|
|
|
}); |
841
|
|
|
|
|
|
|
} |
842
|
6
|
|
|
|
|
17
|
}, @code; |
843
|
|
|
|
|
|
|
|
844
|
6
|
|
|
|
|
72
|
return $self; |
845
|
|
|
|
|
|
|
} |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
sub pass { |
848
|
838
|
|
|
838
|
1
|
1900
|
my ($self, $data, $meta) = @_; |
849
|
|
|
|
|
|
|
|
850
|
838
|
|
50
|
|
|
2231
|
my $from = $meta->{from} || 'callback'; |
851
|
838
|
|
|
|
|
1517
|
my $with = $meta->{with}; |
852
|
838
|
|
|
|
|
1777
|
my $okay = true; |
853
|
|
|
|
|
|
|
|
854
|
838
|
|
|
|
|
4998
|
$self->{'$result'} = { |
855
|
|
|
|
|
|
|
%$meta, |
856
|
|
|
|
|
|
|
data => $data, |
857
|
|
|
|
|
|
|
from => $from, |
858
|
|
|
|
|
|
|
okay => $okay, |
859
|
|
|
|
|
|
|
with => $with, |
860
|
|
|
|
|
|
|
}; |
861
|
|
|
|
|
|
|
|
862
|
838
|
|
|
|
|
4211
|
return $okay; |
863
|
|
|
|
|
|
|
} |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
sub passed { |
866
|
5
|
|
|
5
|
1
|
22
|
my ($self) = @_; |
867
|
|
|
|
|
|
|
|
868
|
5
|
|
|
|
|
25
|
my $result = $self->{'$result'}; |
869
|
|
|
|
|
|
|
|
870
|
5
|
100
|
|
|
|
39
|
return $result ? ($result->{okay} ? true : false) : false; |
|
|
100
|
|
|
|
|
|
871
|
|
|
|
|
|
|
} |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
sub reference { |
874
|
5
|
|
|
5
|
1
|
27
|
my ($self, @code) = @_; |
875
|
|
|
|
|
|
|
|
876
|
5
|
|
|
|
|
20
|
push @{$self->on_eval}, sub { |
877
|
11
|
|
|
11
|
|
26
|
my ($source, $value) = @_; |
878
|
11
|
100
|
|
|
|
30
|
if (CORE::defined($value)) { |
879
|
10
|
|
|
|
|
42
|
return $source->pass($value, { |
880
|
|
|
|
|
|
|
from => 'reference', |
881
|
|
|
|
|
|
|
}); |
882
|
|
|
|
|
|
|
} |
883
|
|
|
|
|
|
|
else { |
884
|
1
|
|
|
|
|
10
|
return $source->fail($value, { |
885
|
|
|
|
|
|
|
from => 'reference', |
886
|
|
|
|
|
|
|
with => 'error_on_defined', |
887
|
|
|
|
|
|
|
}); |
888
|
|
|
|
|
|
|
} |
889
|
|
|
|
|
|
|
}, sub { |
890
|
10
|
|
|
10
|
|
22
|
my ($source, $value) = @_; |
891
|
10
|
100
|
|
|
|
26
|
if (ref($value)) { |
892
|
5
|
|
|
|
|
18
|
return $source->pass($value, { |
893
|
|
|
|
|
|
|
from => 'reference', |
894
|
|
|
|
|
|
|
}); |
895
|
|
|
|
|
|
|
} |
896
|
|
|
|
|
|
|
else { |
897
|
5
|
|
|
|
|
26
|
return $source->fail($value, { |
898
|
|
|
|
|
|
|
from => 'reference', |
899
|
|
|
|
|
|
|
with => 'error_on_reference', |
900
|
|
|
|
|
|
|
}); |
901
|
|
|
|
|
|
|
} |
902
|
5
|
|
|
|
|
11
|
}, @code; |
903
|
|
|
|
|
|
|
|
904
|
5
|
|
|
|
|
50
|
return $self; |
905
|
|
|
|
|
|
|
} |
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
sub regexp { |
908
|
4
|
|
|
4
|
1
|
25
|
my ($self, @code) = @_; |
909
|
|
|
|
|
|
|
|
910
|
4
|
|
|
|
|
21
|
push @{$self->on_eval}, sub { |
911
|
10
|
|
|
10
|
|
24
|
my ($source, $value) = @_; |
912
|
10
|
100
|
|
|
|
40
|
if ($source->coded($value, 'regexp')) { |
913
|
2
|
|
|
|
|
21
|
return $source->pass($value, { |
914
|
|
|
|
|
|
|
from => 'regexp', |
915
|
|
|
|
|
|
|
}); |
916
|
|
|
|
|
|
|
} |
917
|
|
|
|
|
|
|
else { |
918
|
8
|
|
|
|
|
58
|
return $source->fail($value, { |
919
|
|
|
|
|
|
|
from => 'regexp', |
920
|
|
|
|
|
|
|
expected => 'regexp', |
921
|
|
|
|
|
|
|
received => $source->type($value), |
922
|
|
|
|
|
|
|
with => 'error_on_coded', |
923
|
|
|
|
|
|
|
}); |
924
|
|
|
|
|
|
|
} |
925
|
4
|
|
|
|
|
10
|
}, @code; |
926
|
|
|
|
|
|
|
|
927
|
4
|
|
|
|
|
49
|
return $self; |
928
|
|
|
|
|
|
|
} |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
sub result { |
931
|
202
|
|
|
202
|
1
|
22004
|
my ($self, @data) = @_; |
932
|
|
|
|
|
|
|
|
933
|
202
|
100
|
|
|
|
1014
|
my $eval = $self->eval(@data) if @data; |
934
|
|
|
|
|
|
|
|
935
|
202
|
|
|
|
|
669
|
my $result = $self->{'$result'}; |
936
|
|
|
|
|
|
|
|
937
|
202
|
50
|
|
|
|
755
|
return undef if !defined $result; |
938
|
|
|
|
|
|
|
|
939
|
202
|
|
|
|
|
443
|
my $data = $result->{data}; |
940
|
202
|
|
66
|
|
|
843
|
my $okay = $result->{okay} || $eval; |
941
|
202
|
|
100
|
|
|
716
|
my $with = $result->{with} || 'error_on_unknown'; |
942
|
|
|
|
|
|
|
|
943
|
202
|
100
|
|
|
|
695
|
return $okay ? $data : $self->error({%{$result}, throw => $with}); |
|
165
|
|
|
|
|
1453
|
|
944
|
|
|
|
|
|
|
} |
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
sub routines { |
947
|
5
|
|
|
5
|
1
|
30
|
my ($self, @data) = @_; |
948
|
|
|
|
|
|
|
|
949
|
5
|
|
|
|
|
30
|
push @{$self->on_eval}, sub { |
950
|
10
|
|
|
10
|
|
25
|
my ($source, $value) = @_; |
951
|
10
|
100
|
|
|
|
46
|
if ($source->coded($value, 'object')) { |
952
|
5
|
|
|
|
|
54
|
return $source->pass($value, { |
953
|
|
|
|
|
|
|
from => 'routines', |
954
|
|
|
|
|
|
|
}); |
955
|
|
|
|
|
|
|
} |
956
|
|
|
|
|
|
|
else { |
957
|
5
|
|
|
|
|
23
|
return $source->fail($value, { |
958
|
|
|
|
|
|
|
from => 'routines', |
959
|
|
|
|
|
|
|
expected => 'object', |
960
|
|
|
|
|
|
|
received => $source->type($value), |
961
|
|
|
|
|
|
|
with => 'error_on_coded', |
962
|
|
|
|
|
|
|
}); |
963
|
|
|
|
|
|
|
} |
964
|
|
|
|
|
|
|
}, sub { |
965
|
5
|
|
|
5
|
|
24
|
my ($source, $value) = @_; |
966
|
5
|
|
|
|
|
12
|
my $result; |
967
|
5
|
|
|
|
|
14
|
for my $item (@data) { |
968
|
5
|
100
|
|
|
|
45
|
if ($value->can($item)) { |
969
|
2
|
|
|
|
|
15
|
$result = $source->pass($value, { |
970
|
|
|
|
|
|
|
from => 'routines', |
971
|
|
|
|
|
|
|
}); |
972
|
|
|
|
|
|
|
} |
973
|
|
|
|
|
|
|
else { |
974
|
3
|
|
|
|
|
27
|
$result = $source->fail($value, { |
975
|
|
|
|
|
|
|
from => 'routines', |
976
|
|
|
|
|
|
|
name => $item, |
977
|
|
|
|
|
|
|
with => 'error_on_missing', |
978
|
|
|
|
|
|
|
}); |
979
|
3
|
|
|
|
|
10
|
last; |
980
|
|
|
|
|
|
|
} |
981
|
|
|
|
|
|
|
} |
982
|
5
|
|
|
|
|
31
|
return $result; |
983
|
5
|
|
|
|
|
12
|
}; |
984
|
|
|
|
|
|
|
|
985
|
5
|
|
|
|
|
61
|
return $self; |
986
|
|
|
|
|
|
|
} |
987
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
sub scalar { |
989
|
4
|
|
|
4
|
1
|
15
|
my ($self, @code) = @_; |
990
|
|
|
|
|
|
|
|
991
|
4
|
|
|
|
|
22
|
return $self->scalarref(@code); |
992
|
|
|
|
|
|
|
} |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
sub scalarref { |
995
|
8
|
|
|
8
|
1
|
31
|
my ($self, @code) = @_; |
996
|
|
|
|
|
|
|
|
997
|
8
|
|
|
|
|
38
|
push @{$self->on_eval}, sub { |
998
|
18
|
|
|
18
|
|
50
|
my ($source, $value) = @_; |
999
|
18
|
100
|
|
|
|
75
|
if ($source->coded($value, 'scalar')) { |
1000
|
6
|
|
|
|
|
45
|
return $source->pass($value, { |
1001
|
|
|
|
|
|
|
from => 'scalarref', |
1002
|
|
|
|
|
|
|
}); |
1003
|
|
|
|
|
|
|
} |
1004
|
|
|
|
|
|
|
else { |
1005
|
12
|
|
|
|
|
59
|
return $source->fail($value, { |
1006
|
|
|
|
|
|
|
from => 'scalarref', |
1007
|
|
|
|
|
|
|
expected => 'scalarref', |
1008
|
|
|
|
|
|
|
received => $source->type($value), |
1009
|
|
|
|
|
|
|
with => 'error_on_coded', |
1010
|
|
|
|
|
|
|
}); |
1011
|
|
|
|
|
|
|
} |
1012
|
8
|
|
|
|
|
20
|
}, @code; |
1013
|
|
|
|
|
|
|
|
1014
|
8
|
|
|
|
|
103
|
return $self; |
1015
|
|
|
|
|
|
|
} |
1016
|
|
|
|
|
|
|
|
1017
|
|
|
|
|
|
|
sub string { |
1018
|
190
|
|
|
190
|
1
|
506
|
my ($self, @code) = @_; |
1019
|
|
|
|
|
|
|
|
1020
|
190
|
|
|
|
|
559
|
push @{$self->on_eval}, sub { |
1021
|
281
|
|
|
281
|
|
695
|
my ($source, $value) = @_; |
1022
|
281
|
100
|
|
|
|
857
|
if ($source->coded($value, 'string')) { |
1023
|
123
|
|
|
|
|
827
|
return $source->pass($value, { |
1024
|
|
|
|
|
|
|
from => 'string', |
1025
|
|
|
|
|
|
|
}); |
1026
|
|
|
|
|
|
|
} |
1027
|
|
|
|
|
|
|
else { |
1028
|
158
|
|
|
|
|
704
|
return $source->fail($value, { |
1029
|
|
|
|
|
|
|
from => 'string', |
1030
|
|
|
|
|
|
|
expected => 'string', |
1031
|
|
|
|
|
|
|
received => $source->type($value), |
1032
|
|
|
|
|
|
|
with => 'error_on_coded', |
1033
|
|
|
|
|
|
|
}); |
1034
|
|
|
|
|
|
|
} |
1035
|
190
|
|
|
|
|
318
|
}, @code; |
1036
|
|
|
|
|
|
|
|
1037
|
190
|
|
|
|
|
698
|
return $self; |
1038
|
|
|
|
|
|
|
} |
1039
|
|
|
|
|
|
|
|
1040
|
|
|
|
|
|
|
sub tuple { |
1041
|
6
|
|
|
6
|
1
|
31
|
my ($self, @data) = @_; |
1042
|
|
|
|
|
|
|
|
1043
|
6
|
|
|
|
|
32
|
push @{$self->on_eval}, sub { |
1044
|
15
|
|
|
15
|
|
34
|
my ($source, $value) = @_; |
1045
|
15
|
100
|
|
|
|
49
|
if (CORE::defined($value)) { |
1046
|
14
|
|
|
|
|
69
|
return $source->pass($value, { |
1047
|
|
|
|
|
|
|
from => 'tuple', |
1048
|
|
|
|
|
|
|
}); |
1049
|
|
|
|
|
|
|
} |
1050
|
|
|
|
|
|
|
else { |
1051
|
1
|
|
|
|
|
11
|
return $source->fail($value, { |
1052
|
|
|
|
|
|
|
from => 'tuple', |
1053
|
|
|
|
|
|
|
with => 'error_on_defined', |
1054
|
|
|
|
|
|
|
}); |
1055
|
|
|
|
|
|
|
} |
1056
|
|
|
|
|
|
|
}, sub { |
1057
|
14
|
|
|
14
|
|
71
|
my ($source, $value) = @_; |
1058
|
14
|
100
|
|
|
|
72
|
if (UNIVERSAL::isa($value, 'ARRAY')) { |
1059
|
9
|
|
|
|
|
40
|
return $source->pass($value, { |
1060
|
|
|
|
|
|
|
from => 'tuple', |
1061
|
|
|
|
|
|
|
}); |
1062
|
|
|
|
|
|
|
} |
1063
|
|
|
|
|
|
|
else { |
1064
|
5
|
|
|
|
|
26
|
return $source->fail($value, { |
1065
|
|
|
|
|
|
|
from => 'tuple', |
1066
|
|
|
|
|
|
|
with => 'error_on_arrayref', |
1067
|
|
|
|
|
|
|
}); |
1068
|
|
|
|
|
|
|
} |
1069
|
|
|
|
|
|
|
}, sub { |
1070
|
9
|
|
|
9
|
|
21
|
my ($source, $value) = @_; |
1071
|
9
|
100
|
|
|
|
19
|
if (@data == @{$value}) { |
|
9
|
|
|
|
|
37
|
|
1072
|
6
|
|
|
|
|
27
|
return $source->pass($value, { |
1073
|
|
|
|
|
|
|
from => 'tuple', |
1074
|
|
|
|
|
|
|
}); |
1075
|
|
|
|
|
|
|
} |
1076
|
|
|
|
|
|
|
else { |
1077
|
3
|
|
|
|
|
17
|
return $source->fail($value, { |
1078
|
|
|
|
|
|
|
from => 'tuple', |
1079
|
|
|
|
|
|
|
with => 'error_on_arrayref_count', |
1080
|
|
|
|
|
|
|
}); |
1081
|
|
|
|
|
|
|
} |
1082
|
|
|
|
|
|
|
}, sub { |
1083
|
6
|
|
|
6
|
|
18
|
my ($source, $value) = @_; |
1084
|
6
|
|
|
|
|
14
|
my $result = true; |
1085
|
6
|
|
|
|
|
28
|
for (my $i = 0; $i < @data; $i++) { |
1086
|
12
|
50
|
|
|
|
48
|
my ($match, @args) = (ref $data[$i]) ? (@{$data[$i]}) : ($data[$i]); |
|
0
|
|
|
|
|
0
|
|
1087
|
12
|
|
|
|
|
36
|
my $check = $source->branch($i)->accept($match, @args); |
1088
|
12
|
100
|
|
|
|
44
|
if (!$check->eval($value->[$i])) { |
1089
|
|
|
|
|
|
|
$result = $source->fail($value, { |
1090
|
|
|
|
|
|
|
branch => $check->{'$branch'}, |
1091
|
3
|
|
|
|
|
10
|
%{$check->{'$result'}}, |
|
3
|
|
|
|
|
25
|
|
1092
|
|
|
|
|
|
|
from => 'tuple', |
1093
|
|
|
|
|
|
|
}); |
1094
|
3
|
|
|
|
|
13
|
last; |
1095
|
|
|
|
|
|
|
} |
1096
|
|
|
|
|
|
|
} |
1097
|
6
|
100
|
|
|
|
24
|
if (!$result) { |
1098
|
3
|
|
|
|
|
13
|
return $result; |
1099
|
|
|
|
|
|
|
} |
1100
|
|
|
|
|
|
|
else { |
1101
|
3
|
|
|
|
|
14
|
return $self->pass($value, { |
1102
|
|
|
|
|
|
|
from => 'tuple', |
1103
|
|
|
|
|
|
|
}); |
1104
|
|
|
|
|
|
|
} |
1105
|
6
|
|
|
|
|
15
|
}; |
1106
|
|
|
|
|
|
|
|
1107
|
6
|
|
|
|
|
95
|
return $self; |
1108
|
|
|
|
|
|
|
} |
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
sub type { |
1111
|
886
|
|
|
886
|
1
|
1773
|
my ($self, $value) = @_; |
1112
|
|
|
|
|
|
|
|
1113
|
886
|
|
|
|
|
4575
|
my $aliases = { |
1114
|
|
|
|
|
|
|
array => 'arrayref', |
1115
|
|
|
|
|
|
|
code => 'coderef', |
1116
|
|
|
|
|
|
|
hash => 'hashref', |
1117
|
|
|
|
|
|
|
regexp => 'regexpref', |
1118
|
|
|
|
|
|
|
scalar => 'scalarref', |
1119
|
|
|
|
|
|
|
scalar => 'scalarref', |
1120
|
|
|
|
|
|
|
}; |
1121
|
|
|
|
|
|
|
|
1122
|
886
|
|
|
|
|
2907
|
my $identity = lc(Venus::Type->new(value => $value)->identify); |
1123
|
|
|
|
|
|
|
|
1124
|
886
|
|
66
|
|
|
3081
|
return $aliases->{$identity} || $identity; |
1125
|
|
|
|
|
|
|
} |
1126
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
sub undef { |
1128
|
14
|
|
|
14
|
1
|
47
|
my ($self, @code) = @_; |
1129
|
|
|
|
|
|
|
|
1130
|
14
|
|
|
|
|
57
|
push @{$self->on_eval}, sub { |
1131
|
19
|
|
|
19
|
|
63
|
my ($source, $value) = @_; |
1132
|
19
|
100
|
|
|
|
81
|
if ($source->coded($value, 'undef')) { |
1133
|
3
|
|
|
|
|
20
|
return $source->pass($value, { |
1134
|
|
|
|
|
|
|
from => 'undef', |
1135
|
|
|
|
|
|
|
}); |
1136
|
|
|
|
|
|
|
} |
1137
|
|
|
|
|
|
|
else { |
1138
|
16
|
|
|
|
|
86
|
return $source->fail($value, { |
1139
|
|
|
|
|
|
|
from => 'undef', |
1140
|
|
|
|
|
|
|
expected => 'undef', |
1141
|
|
|
|
|
|
|
received => $source->type($value), |
1142
|
|
|
|
|
|
|
with => 'error_on_coded', |
1143
|
|
|
|
|
|
|
}); |
1144
|
|
|
|
|
|
|
} |
1145
|
14
|
|
|
|
|
39
|
}, @code; |
1146
|
|
|
|
|
|
|
|
1147
|
14
|
|
|
|
|
82
|
return $self; |
1148
|
|
|
|
|
|
|
} |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
sub value { |
1151
|
7
|
|
|
7
|
1
|
41
|
my ($self, @code) = @_; |
1152
|
|
|
|
|
|
|
|
1153
|
7
|
|
|
|
|
31
|
push @{$self->on_eval}, sub { |
1154
|
13
|
|
|
13
|
|
43
|
my ($source, $value) = @_; |
1155
|
13
|
100
|
|
|
|
42
|
if (CORE::defined($value)) { |
1156
|
12
|
|
|
|
|
76
|
return $source->pass($value, { |
1157
|
|
|
|
|
|
|
from => 'value', |
1158
|
|
|
|
|
|
|
}); |
1159
|
|
|
|
|
|
|
} |
1160
|
|
|
|
|
|
|
else { |
1161
|
1
|
|
|
|
|
11
|
return $source->fail($value, { |
1162
|
|
|
|
|
|
|
from => 'value', |
1163
|
|
|
|
|
|
|
with => 'error_on_defined', |
1164
|
|
|
|
|
|
|
}); |
1165
|
|
|
|
|
|
|
} |
1166
|
|
|
|
|
|
|
}, sub { |
1167
|
12
|
|
|
12
|
|
39
|
my ($source, $value) = @_; |
1168
|
12
|
100
|
|
|
|
37
|
if (!CORE::ref($value)) { |
1169
|
7
|
|
|
|
|
29
|
return $source->pass($value, { |
1170
|
|
|
|
|
|
|
from => 'value', |
1171
|
|
|
|
|
|
|
}); |
1172
|
|
|
|
|
|
|
} |
1173
|
|
|
|
|
|
|
else { |
1174
|
5
|
|
|
|
|
30
|
return $source->fail($value, { |
1175
|
|
|
|
|
|
|
from => 'value', |
1176
|
|
|
|
|
|
|
with => 'error_on_value', |
1177
|
|
|
|
|
|
|
}); |
1178
|
|
|
|
|
|
|
} |
1179
|
7
|
|
|
|
|
18
|
}, @code; |
1180
|
|
|
|
|
|
|
|
1181
|
7
|
|
|
|
|
96
|
return $self; |
1182
|
|
|
|
|
|
|
} |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
sub within { |
1185
|
30
|
|
|
30
|
1
|
106
|
my ($self, $type, @next) = @_; |
1186
|
|
|
|
|
|
|
|
1187
|
30
|
50
|
|
|
|
93
|
if (!$type) { |
1188
|
0
|
|
|
|
|
0
|
return $self; |
1189
|
|
|
|
|
|
|
} |
1190
|
|
|
|
|
|
|
|
1191
|
30
|
|
|
|
|
88
|
my $where = $self->new; |
1192
|
|
|
|
|
|
|
|
1193
|
30
|
100
|
66
|
|
|
648
|
if (lc($type) eq 'hash' || lc($type) eq 'hashref') { |
|
|
50
|
33
|
|
|
|
|
1194
|
13
|
|
|
|
|
55
|
push @{$self->on_eval}, sub { |
1195
|
9
|
|
|
9
|
|
31
|
my ($source, $value) = @_; |
1196
|
9
|
100
|
|
|
|
32
|
if (CORE::defined($value)) { |
1197
|
8
|
|
|
|
|
46
|
return $source->pass($value, { |
1198
|
|
|
|
|
|
|
from => 'within', |
1199
|
|
|
|
|
|
|
}); |
1200
|
|
|
|
|
|
|
} |
1201
|
|
|
|
|
|
|
else { |
1202
|
1
|
|
|
|
|
9
|
return $source->fail($value, { |
1203
|
|
|
|
|
|
|
from => 'within', |
1204
|
|
|
|
|
|
|
with => 'error_on_defined', |
1205
|
|
|
|
|
|
|
}); |
1206
|
|
|
|
|
|
|
} |
1207
|
|
|
|
|
|
|
}, sub { |
1208
|
8
|
|
|
8
|
|
26
|
my ($source, $value) = @_; |
1209
|
8
|
100
|
|
|
|
41
|
if (UNIVERSAL::isa($value, 'HASH')) { |
1210
|
7
|
|
|
|
|
32
|
return $source->pass($value, { |
1211
|
|
|
|
|
|
|
from => 'within', |
1212
|
|
|
|
|
|
|
}); |
1213
|
|
|
|
|
|
|
} |
1214
|
|
|
|
|
|
|
else { |
1215
|
1
|
|
|
|
|
10
|
return $source->fail($value, { |
1216
|
|
|
|
|
|
|
from => 'within', |
1217
|
|
|
|
|
|
|
with => 'error_on_hashref', |
1218
|
|
|
|
|
|
|
}); |
1219
|
|
|
|
|
|
|
} |
1220
|
|
|
|
|
|
|
}, sub { |
1221
|
7
|
|
|
7
|
|
21
|
my ($source, $value) = @_; |
1222
|
7
|
100
|
|
|
|
14
|
if ((CORE::keys %{$value}) > 0) { |
|
7
|
|
|
|
|
29
|
|
1223
|
5
|
|
|
|
|
21
|
return $source->pass($value, { |
1224
|
|
|
|
|
|
|
from => 'within', |
1225
|
|
|
|
|
|
|
}); |
1226
|
|
|
|
|
|
|
} |
1227
|
|
|
|
|
|
|
else { |
1228
|
2
|
|
|
|
|
19
|
return $source->fail($value, { |
1229
|
|
|
|
|
|
|
from => 'within', |
1230
|
|
|
|
|
|
|
with => 'error_on_hashref_empty', |
1231
|
|
|
|
|
|
|
}); |
1232
|
|
|
|
|
|
|
} |
1233
|
|
|
|
|
|
|
}, sub { |
1234
|
5
|
|
|
5
|
|
11
|
my ($source, $value) = @_; |
1235
|
5
|
|
|
|
|
16
|
my $result = true; |
1236
|
5
|
|
|
|
|
14
|
for my $key (CORE::keys %{$value}) { |
|
5
|
|
|
|
|
18
|
|
1237
|
5
|
|
|
|
|
25
|
my $check = $where->branch($key); |
1238
|
5
|
|
|
|
|
22
|
$check->on_eval($where->on_eval); |
1239
|
5
|
100
|
|
|
|
25
|
if (!$check->eval($value->{$key})) { |
1240
|
|
|
|
|
|
|
$result = $source->fail($value, { |
1241
|
|
|
|
|
|
|
branch => $check->{'$branch'}, |
1242
|
2
|
|
|
|
|
10
|
%{$check->{'$result'}}, |
|
2
|
|
|
|
|
16
|
|
1243
|
|
|
|
|
|
|
from => 'within', |
1244
|
|
|
|
|
|
|
}); |
1245
|
2
|
|
|
|
|
11
|
last; |
1246
|
|
|
|
|
|
|
} |
1247
|
|
|
|
|
|
|
} |
1248
|
5
|
100
|
|
|
|
24
|
if (!$result) { |
1249
|
2
|
|
|
|
|
11
|
return $result; |
1250
|
|
|
|
|
|
|
} |
1251
|
|
|
|
|
|
|
else { |
1252
|
3
|
|
|
|
|
14
|
return $self->pass($value, { |
1253
|
|
|
|
|
|
|
from => 'within', |
1254
|
|
|
|
|
|
|
}); |
1255
|
|
|
|
|
|
|
} |
1256
|
13
|
|
|
|
|
42
|
}; |
1257
|
|
|
|
|
|
|
} |
1258
|
|
|
|
|
|
|
elsif (lc($type) eq 'array' || lc($type) eq 'arrayref') { |
1259
|
17
|
|
|
|
|
58
|
push @{$self->on_eval}, sub { |
1260
|
28
|
|
|
28
|
|
63
|
my ($source, $value) = @_; |
1261
|
28
|
100
|
|
|
|
68
|
if (CORE::defined($value)) { |
1262
|
26
|
|
|
|
|
121
|
return $source->pass($value, { |
1263
|
|
|
|
|
|
|
from => 'within', |
1264
|
|
|
|
|
|
|
}); |
1265
|
|
|
|
|
|
|
} |
1266
|
|
|
|
|
|
|
else { |
1267
|
2
|
|
|
|
|
16
|
return $source->fail($value, { |
1268
|
|
|
|
|
|
|
from => 'within', |
1269
|
|
|
|
|
|
|
with => 'error_on_defined', |
1270
|
|
|
|
|
|
|
}); |
1271
|
|
|
|
|
|
|
} |
1272
|
|
|
|
|
|
|
}, sub { |
1273
|
26
|
|
|
26
|
|
57
|
my ($source, $value) = @_; |
1274
|
26
|
100
|
|
|
|
105
|
if (UNIVERSAL::isa($value, 'ARRAY')) { |
1275
|
17
|
|
|
|
|
63
|
return $source->pass($value, { |
1276
|
|
|
|
|
|
|
from => 'within', |
1277
|
|
|
|
|
|
|
}); |
1278
|
|
|
|
|
|
|
} |
1279
|
|
|
|
|
|
|
else { |
1280
|
9
|
|
|
|
|
44
|
return $source->fail($value, { |
1281
|
|
|
|
|
|
|
from => 'within', |
1282
|
|
|
|
|
|
|
with => 'error_on_arrayref', |
1283
|
|
|
|
|
|
|
}); |
1284
|
|
|
|
|
|
|
} |
1285
|
|
|
|
|
|
|
}, sub { |
1286
|
17
|
|
|
17
|
|
55
|
my ($source, $value) = @_; |
1287
|
17
|
100
|
|
|
|
32
|
if (@{$value} > 0) { |
|
17
|
|
|
|
|
57
|
|
1288
|
12
|
|
|
|
|
40
|
return $source->pass($value, { |
1289
|
|
|
|
|
|
|
from => 'within', |
1290
|
|
|
|
|
|
|
}); |
1291
|
|
|
|
|
|
|
} |
1292
|
|
|
|
|
|
|
else { |
1293
|
5
|
|
|
|
|
27
|
return $source->fail($value, { |
1294
|
|
|
|
|
|
|
from => 'within', |
1295
|
|
|
|
|
|
|
with => 'error_on_arrayref_count', |
1296
|
|
|
|
|
|
|
}); |
1297
|
|
|
|
|
|
|
} |
1298
|
|
|
|
|
|
|
}, sub { |
1299
|
12
|
|
|
12
|
|
35
|
my ($source, $value) = @_; |
1300
|
12
|
|
|
|
|
29
|
my $result = true; |
1301
|
12
|
|
|
|
|
30
|
my $key = 0; |
1302
|
12
|
|
|
|
|
21
|
for my $item (@{$value}) { |
|
12
|
|
|
|
|
29
|
|
1303
|
12
|
|
|
|
|
44
|
my $check = $where->branch($key++); |
1304
|
12
|
|
|
|
|
41
|
$check->on_eval($where->on_eval); |
1305
|
12
|
100
|
|
|
|
47
|
if (!$check->eval($item)) { |
1306
|
|
|
|
|
|
|
$result = $source->fail($value, { |
1307
|
|
|
|
|
|
|
branch => $check->{'$branch'}, |
1308
|
6
|
|
|
|
|
20
|
%{$check->{'$result'}}, |
|
6
|
|
|
|
|
82
|
|
1309
|
|
|
|
|
|
|
from => 'within', |
1310
|
|
|
|
|
|
|
}); |
1311
|
6
|
|
|
|
|
45
|
last; |
1312
|
|
|
|
|
|
|
} |
1313
|
|
|
|
|
|
|
} |
1314
|
12
|
100
|
|
|
|
60
|
if (!$result) { |
1315
|
6
|
|
|
|
|
36
|
return $result; |
1316
|
|
|
|
|
|
|
} |
1317
|
|
|
|
|
|
|
else { |
1318
|
6
|
|
|
|
|
33
|
return $self->pass($value, { |
1319
|
|
|
|
|
|
|
from => 'within', |
1320
|
|
|
|
|
|
|
}); |
1321
|
|
|
|
|
|
|
} |
1322
|
17
|
|
|
|
|
39
|
}; |
1323
|
|
|
|
|
|
|
} |
1324
|
|
|
|
|
|
|
else { |
1325
|
0
|
|
|
|
|
0
|
return $self->error({ |
1326
|
|
|
|
|
|
|
throw => 'error_on_within', |
1327
|
|
|
|
|
|
|
type => $type, |
1328
|
|
|
|
|
|
|
args => [@next] |
1329
|
|
|
|
|
|
|
}); |
1330
|
|
|
|
|
|
|
} |
1331
|
|
|
|
|
|
|
|
1332
|
30
|
100
|
|
|
|
281
|
$where->accept(map +(ref($_) ? @$_ : $_), $next[0]) if @next; |
|
|
50
|
|
|
|
|
|
1333
|
|
|
|
|
|
|
|
1334
|
30
|
|
|
|
|
384
|
return $where; |
1335
|
|
|
|
|
|
|
} |
1336
|
|
|
|
|
|
|
|
1337
|
|
|
|
|
|
|
sub yesno { |
1338
|
8
|
|
|
8
|
1
|
43
|
my ($self, @code) = @_; |
1339
|
|
|
|
|
|
|
|
1340
|
8
|
|
|
|
|
39
|
push @{$self->on_eval}, sub { |
1341
|
16
|
|
|
16
|
|
50
|
my ($source, $value) = @_; |
1342
|
16
|
100
|
|
|
|
44
|
if (CORE::defined($value)) { |
1343
|
14
|
|
|
|
|
67
|
return $source->pass($value, { |
1344
|
|
|
|
|
|
|
from => 'yesno', |
1345
|
|
|
|
|
|
|
}); |
1346
|
|
|
|
|
|
|
} |
1347
|
|
|
|
|
|
|
else { |
1348
|
2
|
|
|
|
|
18
|
return $source->fail($value, { |
1349
|
|
|
|
|
|
|
from => 'yesno', |
1350
|
|
|
|
|
|
|
with => 'error_on_defined', |
1351
|
|
|
|
|
|
|
}); |
1352
|
|
|
|
|
|
|
} |
1353
|
|
|
|
|
|
|
}, sub { |
1354
|
14
|
|
|
14
|
|
40
|
my ($source, $value) = @_; |
1355
|
14
|
100
|
|
|
|
98
|
if ($value =~ /^(?:1|y(?:es)?|0|n(?:o)?)$/i) { |
1356
|
11
|
|
|
|
|
42
|
return $source->pass($value, { |
1357
|
|
|
|
|
|
|
from => 'yesno', |
1358
|
|
|
|
|
|
|
}); |
1359
|
|
|
|
|
|
|
} |
1360
|
|
|
|
|
|
|
else { |
1361
|
3
|
|
|
|
|
36
|
return $source->fail($value, { |
1362
|
|
|
|
|
|
|
from => 'yesno', |
1363
|
|
|
|
|
|
|
with => 'error_on_yesno', |
1364
|
|
|
|
|
|
|
}); |
1365
|
|
|
|
|
|
|
} |
1366
|
8
|
|
|
|
|
17
|
}, @code; |
1367
|
|
|
|
|
|
|
|
1368
|
8
|
|
|
|
|
71
|
return $self; |
1369
|
|
|
|
|
|
|
} |
1370
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
# ERRORS |
1372
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
sub error { |
1374
|
186
|
|
|
186
|
0
|
533
|
my ($self, $data) = @_; |
1375
|
|
|
|
|
|
|
|
1376
|
186
|
|
|
|
|
486
|
delete $data->{okay}; |
1377
|
186
|
|
|
|
|
393
|
delete $data->{with}; |
1378
|
|
|
|
|
|
|
|
1379
|
|
|
|
|
|
|
$data->{at} = $data->{'branch'} |
1380
|
186
|
100
|
100
|
|
|
844
|
? join('.', '', @{$data->{'branch'}}) || '.' : '.'; |
1381
|
|
|
|
|
|
|
|
1382
|
186
|
|
|
|
|
1033
|
return $self->SUPER::error($data); |
1383
|
|
|
|
|
|
|
} |
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
sub error_on_arrayref { |
1386
|
8
|
|
|
8
|
1
|
28
|
my ($self, $data) = @_; |
1387
|
|
|
|
|
|
|
|
1388
|
8
|
|
|
|
|
24
|
my $message = join ', ', |
1389
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1390
|
|
|
|
|
|
|
'value provided is not an arrayref or arrayref derived', |
1391
|
|
|
|
|
|
|
'at {{at}}'; |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
my $stash = { |
1394
|
8
|
|
|
|
|
18
|
%{$data}, |
|
8
|
|
|
|
|
40
|
|
1395
|
|
|
|
|
|
|
}; |
1396
|
|
|
|
|
|
|
|
1397
|
8
|
|
|
|
|
34
|
my $result = { |
1398
|
|
|
|
|
|
|
name => 'on.arrayref', |
1399
|
|
|
|
|
|
|
raise => true, |
1400
|
|
|
|
|
|
|
stash => $stash, |
1401
|
|
|
|
|
|
|
message => $message, |
1402
|
|
|
|
|
|
|
}; |
1403
|
|
|
|
|
|
|
|
1404
|
8
|
|
|
|
|
28
|
return $result; |
1405
|
|
|
|
|
|
|
} |
1406
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
sub error_on_arrayref_count { |
1408
|
4
|
|
|
4
|
1
|
17
|
my ($self, $data) = @_; |
1409
|
|
|
|
|
|
|
|
1410
|
4
|
|
|
|
|
12
|
my $message = join ', ', |
1411
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1412
|
|
|
|
|
|
|
'incorrect item count in arrayref or arrayref derived object', |
1413
|
|
|
|
|
|
|
'at {{at}}'; |
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
my $stash = { |
1416
|
4
|
|
|
|
|
10
|
%{$data}, |
|
4
|
|
|
|
|
23
|
|
1417
|
|
|
|
|
|
|
}; |
1418
|
|
|
|
|
|
|
|
1419
|
4
|
|
|
|
|
19
|
my $result = { |
1420
|
|
|
|
|
|
|
name => 'on.arrayref.count', |
1421
|
|
|
|
|
|
|
raise => true, |
1422
|
|
|
|
|
|
|
stash => $stash, |
1423
|
|
|
|
|
|
|
message => $message, |
1424
|
|
|
|
|
|
|
}; |
1425
|
|
|
|
|
|
|
|
1426
|
4
|
|
|
|
|
16
|
return $result; |
1427
|
|
|
|
|
|
|
} |
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
sub error_on_coded { |
1430
|
115
|
|
|
115
|
1
|
305
|
my ($self, $data) = @_; |
1431
|
|
|
|
|
|
|
|
1432
|
115
|
|
|
|
|
278
|
my $message = join ', ', |
1433
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1434
|
|
|
|
|
|
|
'expected {{expected}}', |
1435
|
|
|
|
|
|
|
'received {{received}}', |
1436
|
|
|
|
|
|
|
'at {{at}}'; |
1437
|
|
|
|
|
|
|
|
1438
|
|
|
|
|
|
|
my $stash = { |
1439
|
115
|
|
|
|
|
201
|
%{$data}, |
|
115
|
|
|
|
|
679
|
|
1440
|
|
|
|
|
|
|
}; |
1441
|
|
|
|
|
|
|
|
1442
|
115
|
|
|
|
|
489
|
my $result = { |
1443
|
|
|
|
|
|
|
name => 'on.coded', |
1444
|
|
|
|
|
|
|
raise => true, |
1445
|
|
|
|
|
|
|
stash => $stash, |
1446
|
|
|
|
|
|
|
message => $message, |
1447
|
|
|
|
|
|
|
}; |
1448
|
|
|
|
|
|
|
|
1449
|
115
|
|
|
|
|
442
|
return $result; |
1450
|
|
|
|
|
|
|
} |
1451
|
|
|
|
|
|
|
|
1452
|
|
|
|
|
|
|
sub error_on_consumes { |
1453
|
3
|
|
|
3
|
1
|
15
|
my ($self, $data) = @_; |
1454
|
|
|
|
|
|
|
|
1455
|
3
|
|
|
|
|
11
|
my $message = join ', ', |
1456
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1457
|
|
|
|
|
|
|
'object does not consume the role "{{role}}"', |
1458
|
|
|
|
|
|
|
'at {{at}}'; |
1459
|
|
|
|
|
|
|
|
1460
|
|
|
|
|
|
|
my $stash = { |
1461
|
3
|
|
|
|
|
9
|
%{$data}, |
|
3
|
|
|
|
|
18
|
|
1462
|
|
|
|
|
|
|
}; |
1463
|
|
|
|
|
|
|
|
1464
|
3
|
|
|
|
|
16
|
my $result = { |
1465
|
|
|
|
|
|
|
name => 'on.consumes', |
1466
|
|
|
|
|
|
|
raise => true, |
1467
|
|
|
|
|
|
|
stash => $stash, |
1468
|
|
|
|
|
|
|
message => $message, |
1469
|
|
|
|
|
|
|
}; |
1470
|
|
|
|
|
|
|
|
1471
|
3
|
|
|
|
|
11
|
return $result; |
1472
|
|
|
|
|
|
|
} |
1473
|
|
|
|
|
|
|
|
1474
|
|
|
|
|
|
|
sub error_on_defined { |
1475
|
13
|
|
|
13
|
1
|
53
|
my ($self, $data) = @_; |
1476
|
|
|
|
|
|
|
|
1477
|
13
|
|
|
|
|
50
|
my $message = join ', ', |
1478
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1479
|
|
|
|
|
|
|
'value provided is undefined', |
1480
|
|
|
|
|
|
|
'at {{at}}'; |
1481
|
|
|
|
|
|
|
|
1482
|
|
|
|
|
|
|
my $stash = { |
1483
|
13
|
|
|
|
|
32
|
%{$data}, |
|
13
|
|
|
|
|
109
|
|
1484
|
|
|
|
|
|
|
}; |
1485
|
|
|
|
|
|
|
|
1486
|
13
|
|
|
|
|
71
|
my $result = { |
1487
|
|
|
|
|
|
|
name => 'on.defined', |
1488
|
|
|
|
|
|
|
raise => true, |
1489
|
|
|
|
|
|
|
stash => $stash, |
1490
|
|
|
|
|
|
|
message => $message, |
1491
|
|
|
|
|
|
|
}; |
1492
|
|
|
|
|
|
|
|
1493
|
13
|
|
|
|
|
70
|
return $result; |
1494
|
|
|
|
|
|
|
} |
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
sub error_on_either { |
1497
|
5
|
|
|
5
|
1
|
22
|
my ($self, $data) = @_; |
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
my $message = join "\n\n", |
1500
|
|
|
|
|
|
|
'Failed checking either-or condition:', |
1501
|
5
|
|
|
|
|
17
|
@{$data->{errors}}; |
|
5
|
|
|
|
|
32
|
|
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
my $stash = { |
1504
|
5
|
|
|
|
|
13
|
%{$data}, |
|
5
|
|
|
|
|
28
|
|
1505
|
|
|
|
|
|
|
}; |
1506
|
|
|
|
|
|
|
|
1507
|
5
|
|
|
|
|
29
|
my $result = { |
1508
|
|
|
|
|
|
|
name => 'on.either', |
1509
|
|
|
|
|
|
|
raise => true, |
1510
|
|
|
|
|
|
|
stash => $stash, |
1511
|
|
|
|
|
|
|
message => $message, |
1512
|
|
|
|
|
|
|
}; |
1513
|
|
|
|
|
|
|
|
1514
|
5
|
|
|
|
|
27
|
return $result; |
1515
|
|
|
|
|
|
|
} |
1516
|
|
|
|
|
|
|
|
1517
|
|
|
|
|
|
|
sub error_on_enum { |
1518
|
2
|
|
|
2
|
1
|
8
|
my ($self, $data) = @_; |
1519
|
|
|
|
|
|
|
|
1520
|
2
|
|
|
|
|
7
|
my $message = join ', ', |
1521
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1522
|
|
|
|
|
|
|
'received {{data}}', |
1523
|
|
|
|
|
|
|
'valid options are {{options}}', |
1524
|
|
|
|
|
|
|
'at {{at}}'; |
1525
|
|
|
|
|
|
|
|
1526
|
|
|
|
|
|
|
my $stash = { |
1527
|
2
|
|
|
|
|
11
|
%{$data}, |
1528
|
2
|
|
|
|
|
4
|
options => (join ', ', @{$data->{enum}}), |
|
2
|
|
|
|
|
13
|
|
1529
|
|
|
|
|
|
|
}; |
1530
|
|
|
|
|
|
|
|
1531
|
2
|
|
|
|
|
12
|
my $result = { |
1532
|
|
|
|
|
|
|
name => 'on.enum', |
1533
|
|
|
|
|
|
|
raise => true, |
1534
|
|
|
|
|
|
|
stash => $stash, |
1535
|
|
|
|
|
|
|
message => $message, |
1536
|
|
|
|
|
|
|
}; |
1537
|
|
|
|
|
|
|
|
1538
|
2
|
|
|
|
|
9
|
return $result; |
1539
|
|
|
|
|
|
|
} |
1540
|
|
|
|
|
|
|
|
1541
|
|
|
|
|
|
|
sub error_on_hashref { |
1542
|
3
|
|
|
3
|
1
|
12
|
my ($self, $data) = @_; |
1543
|
|
|
|
|
|
|
|
1544
|
3
|
|
|
|
|
11
|
my $message = join ', ', |
1545
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1546
|
|
|
|
|
|
|
'value provided is not a hashref or hashref derived', |
1547
|
|
|
|
|
|
|
'at {{at}}'; |
1548
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
my $stash = { |
1550
|
3
|
|
|
|
|
9
|
%{$data}, |
|
3
|
|
|
|
|
18
|
|
1551
|
|
|
|
|
|
|
}; |
1552
|
|
|
|
|
|
|
|
1553
|
3
|
|
|
|
|
18
|
my $result = { |
1554
|
|
|
|
|
|
|
name => 'on.hashref', |
1555
|
|
|
|
|
|
|
raise => true, |
1556
|
|
|
|
|
|
|
stash => $stash, |
1557
|
|
|
|
|
|
|
message => $message, |
1558
|
|
|
|
|
|
|
}; |
1559
|
|
|
|
|
|
|
|
1560
|
3
|
|
|
|
|
11
|
return $result; |
1561
|
|
|
|
|
|
|
} |
1562
|
|
|
|
|
|
|
|
1563
|
|
|
|
|
|
|
sub error_on_hashref_empty { |
1564
|
8
|
|
|
8
|
1
|
19
|
my ($self, $data) = @_; |
1565
|
|
|
|
|
|
|
|
1566
|
8
|
|
|
|
|
21
|
my $message = join ', ', |
1567
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1568
|
|
|
|
|
|
|
'no items found in hashref or hashref derived object', |
1569
|
|
|
|
|
|
|
'at {{at}}'; |
1570
|
|
|
|
|
|
|
|
1571
|
|
|
|
|
|
|
my $stash = { |
1572
|
8
|
|
|
|
|
16
|
%{$data}, |
|
8
|
|
|
|
|
36
|
|
1573
|
|
|
|
|
|
|
}; |
1574
|
|
|
|
|
|
|
|
1575
|
8
|
|
|
|
|
33
|
my $result = { |
1576
|
|
|
|
|
|
|
name => 'on.hashref.empty', |
1577
|
|
|
|
|
|
|
raise => true, |
1578
|
|
|
|
|
|
|
stash => $stash, |
1579
|
|
|
|
|
|
|
message => $message, |
1580
|
|
|
|
|
|
|
}; |
1581
|
|
|
|
|
|
|
|
1582
|
8
|
|
|
|
|
24
|
return $result; |
1583
|
|
|
|
|
|
|
} |
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
sub error_on_includes { |
1586
|
2
|
|
|
2
|
1
|
8
|
my ($self, $data) = @_; |
1587
|
|
|
|
|
|
|
|
1588
|
|
|
|
|
|
|
my $message = join "\n\n", |
1589
|
|
|
|
|
|
|
'Failed checking union-includes condition:', |
1590
|
2
|
|
|
|
|
5
|
@{$data->{errors}}; |
|
2
|
|
|
|
|
11
|
|
1591
|
|
|
|
|
|
|
|
1592
|
|
|
|
|
|
|
my $stash = { |
1593
|
2
|
|
|
|
|
6
|
%{$data}, |
|
2
|
|
|
|
|
10
|
|
1594
|
|
|
|
|
|
|
}; |
1595
|
|
|
|
|
|
|
|
1596
|
2
|
|
|
|
|
12
|
my $result = { |
1597
|
|
|
|
|
|
|
name => 'on.includes', |
1598
|
|
|
|
|
|
|
raise => true, |
1599
|
|
|
|
|
|
|
stash => $stash, |
1600
|
|
|
|
|
|
|
message => $message, |
1601
|
|
|
|
|
|
|
}; |
1602
|
|
|
|
|
|
|
|
1603
|
2
|
|
|
|
|
9
|
return $result; |
1604
|
|
|
|
|
|
|
} |
1605
|
|
|
|
|
|
|
|
1606
|
|
|
|
|
|
|
sub error_on_identity { |
1607
|
2
|
|
|
2
|
1
|
9
|
my ($self, $data) = @_; |
1608
|
|
|
|
|
|
|
|
1609
|
2
|
|
|
|
|
7
|
my $message = join ', ', |
1610
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1611
|
|
|
|
|
|
|
'object is not a {{name}} or derived object', |
1612
|
|
|
|
|
|
|
'at {{at}}'; |
1613
|
|
|
|
|
|
|
|
1614
|
|
|
|
|
|
|
my $stash = { |
1615
|
2
|
|
|
|
|
4
|
%{$data}, |
|
2
|
|
|
|
|
14
|
|
1616
|
|
|
|
|
|
|
}; |
1617
|
|
|
|
|
|
|
|
1618
|
2
|
|
|
|
|
11
|
my $result = { |
1619
|
|
|
|
|
|
|
name => 'on.identity', |
1620
|
|
|
|
|
|
|
raise => true, |
1621
|
|
|
|
|
|
|
stash => $stash, |
1622
|
|
|
|
|
|
|
message => $message, |
1623
|
|
|
|
|
|
|
}; |
1624
|
|
|
|
|
|
|
|
1625
|
2
|
|
|
|
|
8
|
return $result; |
1626
|
|
|
|
|
|
|
} |
1627
|
|
|
|
|
|
|
|
1628
|
|
|
|
|
|
|
sub error_on_inherits { |
1629
|
2
|
|
|
2
|
1
|
10
|
my ($self, $data) = @_; |
1630
|
|
|
|
|
|
|
|
1631
|
2
|
|
|
|
|
7
|
my $message = join ', ', |
1632
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1633
|
|
|
|
|
|
|
'object is not a {{name}} derived object', |
1634
|
|
|
|
|
|
|
'at {{at}}'; |
1635
|
|
|
|
|
|
|
|
1636
|
|
|
|
|
|
|
my $stash = { |
1637
|
2
|
|
|
|
|
5
|
%{$data}, |
|
2
|
|
|
|
|
13
|
|
1638
|
|
|
|
|
|
|
}; |
1639
|
|
|
|
|
|
|
|
1640
|
2
|
|
|
|
|
11
|
my $result = { |
1641
|
|
|
|
|
|
|
name => 'on.inherits', |
1642
|
|
|
|
|
|
|
raise => true, |
1643
|
|
|
|
|
|
|
stash => $stash, |
1644
|
|
|
|
|
|
|
message => $message, |
1645
|
|
|
|
|
|
|
}; |
1646
|
|
|
|
|
|
|
|
1647
|
2
|
|
|
|
|
7
|
return $result; |
1648
|
|
|
|
|
|
|
} |
1649
|
|
|
|
|
|
|
|
1650
|
|
|
|
|
|
|
sub error_on_missing { |
1651
|
4
|
|
|
4
|
1
|
12
|
my ($self, $data) = @_; |
1652
|
|
|
|
|
|
|
|
1653
|
4
|
|
|
|
|
12
|
my $message = join ', ', |
1654
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1655
|
|
|
|
|
|
|
'"{{name}}" is missing', |
1656
|
|
|
|
|
|
|
'at {{at}}'; |
1657
|
|
|
|
|
|
|
|
1658
|
|
|
|
|
|
|
my $stash = { |
1659
|
4
|
|
|
|
|
12
|
%{$data}, |
|
4
|
|
|
|
|
24
|
|
1660
|
|
|
|
|
|
|
}; |
1661
|
|
|
|
|
|
|
|
1662
|
4
|
|
|
|
|
22
|
my $result = { |
1663
|
|
|
|
|
|
|
name => 'on.missing', |
1664
|
|
|
|
|
|
|
raise => true, |
1665
|
|
|
|
|
|
|
stash => $stash, |
1666
|
|
|
|
|
|
|
message => $message, |
1667
|
|
|
|
|
|
|
}; |
1668
|
|
|
|
|
|
|
|
1669
|
4
|
|
|
|
|
18
|
return $result; |
1670
|
|
|
|
|
|
|
} |
1671
|
|
|
|
|
|
|
|
1672
|
|
|
|
|
|
|
sub error_on_package { |
1673
|
2
|
|
|
2
|
1
|
8
|
my ($self, $data) = @_; |
1674
|
|
|
|
|
|
|
|
1675
|
2
|
|
|
|
|
6
|
my $message = join ', ', |
1676
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1677
|
|
|
|
|
|
|
'"{{data}}" is not a valid package name', |
1678
|
|
|
|
|
|
|
'at {{at}}'; |
1679
|
|
|
|
|
|
|
|
1680
|
|
|
|
|
|
|
my $stash = { |
1681
|
2
|
|
|
|
|
4
|
%{$data}, |
|
2
|
|
|
|
|
14
|
|
1682
|
|
|
|
|
|
|
}; |
1683
|
|
|
|
|
|
|
|
1684
|
2
|
|
|
|
|
11
|
my $result = { |
1685
|
|
|
|
|
|
|
name => 'on.package', |
1686
|
|
|
|
|
|
|
raise => true, |
1687
|
|
|
|
|
|
|
stash => $stash, |
1688
|
|
|
|
|
|
|
message => $message, |
1689
|
|
|
|
|
|
|
}; |
1690
|
|
|
|
|
|
|
|
1691
|
2
|
|
|
|
|
8
|
return $result; |
1692
|
|
|
|
|
|
|
} |
1693
|
|
|
|
|
|
|
|
1694
|
|
|
|
|
|
|
sub error_on_package_loaded { |
1695
|
2
|
|
|
2
|
1
|
8
|
my ($self, $data) = @_; |
1696
|
|
|
|
|
|
|
|
1697
|
2
|
|
|
|
|
7
|
my $message = join ', ', |
1698
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1699
|
|
|
|
|
|
|
'"{{data}}" is not loaded', |
1700
|
|
|
|
|
|
|
'at {{at}}'; |
1701
|
|
|
|
|
|
|
|
1702
|
|
|
|
|
|
|
my $stash = { |
1703
|
2
|
|
|
|
|
5
|
%{$data}, |
|
2
|
|
|
|
|
11
|
|
1704
|
|
|
|
|
|
|
}; |
1705
|
|
|
|
|
|
|
|
1706
|
2
|
|
|
|
|
13
|
my $result = { |
1707
|
|
|
|
|
|
|
name => 'on.package.loaded', |
1708
|
|
|
|
|
|
|
raise => true, |
1709
|
|
|
|
|
|
|
stash => $stash, |
1710
|
|
|
|
|
|
|
message => $message, |
1711
|
|
|
|
|
|
|
}; |
1712
|
|
|
|
|
|
|
|
1713
|
2
|
|
|
|
|
8
|
return $result; |
1714
|
|
|
|
|
|
|
} |
1715
|
|
|
|
|
|
|
|
1716
|
|
|
|
|
|
|
sub error_on_pairs { |
1717
|
3
|
|
|
3
|
1
|
13
|
my ($self, $data) = @_; |
1718
|
|
|
|
|
|
|
|
1719
|
3
|
|
|
|
|
9
|
my $message = join ', ', |
1720
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1721
|
|
|
|
|
|
|
'imblanced key/value pairs provided', |
1722
|
|
|
|
|
|
|
'at {{at}}'; |
1723
|
|
|
|
|
|
|
|
1724
|
|
|
|
|
|
|
my $stash = { |
1725
|
3
|
|
|
|
|
7
|
%{$data}, |
|
3
|
|
|
|
|
17
|
|
1726
|
|
|
|
|
|
|
}; |
1727
|
|
|
|
|
|
|
|
1728
|
3
|
|
|
|
|
16
|
my $result = { |
1729
|
|
|
|
|
|
|
name => 'on.pairs', |
1730
|
|
|
|
|
|
|
raise => true, |
1731
|
|
|
|
|
|
|
stash => $stash, |
1732
|
|
|
|
|
|
|
message => $message, |
1733
|
|
|
|
|
|
|
}; |
1734
|
|
|
|
|
|
|
|
1735
|
3
|
|
|
|
|
13
|
return $result; |
1736
|
|
|
|
|
|
|
} |
1737
|
|
|
|
|
|
|
|
1738
|
|
|
|
|
|
|
sub error_on_reference { |
1739
|
2
|
|
|
2
|
1
|
9
|
my ($self, $data) = @_; |
1740
|
|
|
|
|
|
|
|
1741
|
2
|
|
|
|
|
9
|
my $message = join ', ', |
1742
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1743
|
|
|
|
|
|
|
'value provided is not a reference', |
1744
|
|
|
|
|
|
|
'at {{at}}'; |
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
my $stash = { |
1747
|
2
|
|
|
|
|
5
|
%{$data}, |
|
2
|
|
|
|
|
14
|
|
1748
|
|
|
|
|
|
|
}; |
1749
|
|
|
|
|
|
|
|
1750
|
2
|
|
|
|
|
12
|
my $result = { |
1751
|
|
|
|
|
|
|
name => 'on.reference', |
1752
|
|
|
|
|
|
|
raise => true, |
1753
|
|
|
|
|
|
|
stash => $stash, |
1754
|
|
|
|
|
|
|
message => $message, |
1755
|
|
|
|
|
|
|
}; |
1756
|
|
|
|
|
|
|
|
1757
|
2
|
|
|
|
|
7
|
return $result; |
1758
|
|
|
|
|
|
|
} |
1759
|
|
|
|
|
|
|
|
1760
|
|
|
|
|
|
|
sub error_on_value { |
1761
|
2
|
|
|
2
|
1
|
8
|
my ($self, $data) = @_; |
1762
|
|
|
|
|
|
|
|
1763
|
2
|
|
|
|
|
7
|
my $message = join ', ', |
1764
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1765
|
|
|
|
|
|
|
'value provided is a reference', |
1766
|
|
|
|
|
|
|
'at {{at}}'; |
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
my $stash = { |
1769
|
2
|
|
|
|
|
6
|
%{$data}, |
|
2
|
|
|
|
|
10
|
|
1770
|
|
|
|
|
|
|
}; |
1771
|
|
|
|
|
|
|
|
1772
|
2
|
|
|
|
|
10
|
my $result = { |
1773
|
|
|
|
|
|
|
name => 'on.value', |
1774
|
|
|
|
|
|
|
raise => true, |
1775
|
|
|
|
|
|
|
stash => $stash, |
1776
|
|
|
|
|
|
|
message => $message, |
1777
|
|
|
|
|
|
|
}; |
1778
|
|
|
|
|
|
|
|
1779
|
2
|
|
|
|
|
9
|
return $result; |
1780
|
|
|
|
|
|
|
} |
1781
|
|
|
|
|
|
|
|
1782
|
|
|
|
|
|
|
sub error_on_within { |
1783
|
1
|
|
|
1
|
1
|
4
|
my ($self, $data) = @_; |
1784
|
|
|
|
|
|
|
|
1785
|
1
|
|
|
|
|
3
|
my $message = 'Invalid type "{{type}}" provided to the "within" method'; |
1786
|
|
|
|
|
|
|
|
1787
|
|
|
|
|
|
|
my $stash = { |
1788
|
1
|
|
|
|
|
3
|
%{$data}, |
|
1
|
|
|
|
|
5
|
|
1789
|
|
|
|
|
|
|
}; |
1790
|
|
|
|
|
|
|
|
1791
|
1
|
|
|
|
|
6
|
my $result = { |
1792
|
|
|
|
|
|
|
name => 'on.within', |
1793
|
|
|
|
|
|
|
raise => true, |
1794
|
|
|
|
|
|
|
stash => $stash, |
1795
|
|
|
|
|
|
|
message => $message, |
1796
|
|
|
|
|
|
|
}; |
1797
|
|
|
|
|
|
|
|
1798
|
1
|
|
|
|
|
5
|
return $result; |
1799
|
|
|
|
|
|
|
} |
1800
|
|
|
|
|
|
|
|
1801
|
|
|
|
|
|
|
sub error_on_unknown { |
1802
|
1
|
|
|
1
|
1
|
8
|
my ($self, $data) = @_; |
1803
|
|
|
|
|
|
|
|
1804
|
1
|
|
|
|
|
2
|
my $message = 'Failed performing check for unknown reason'; |
1805
|
|
|
|
|
|
|
|
1806
|
|
|
|
|
|
|
my $stash = { |
1807
|
1
|
|
|
|
|
3
|
%{$data}, |
|
1
|
|
|
|
|
5
|
|
1808
|
|
|
|
|
|
|
}; |
1809
|
|
|
|
|
|
|
|
1810
|
1
|
|
|
|
|
7
|
my $result = { |
1811
|
|
|
|
|
|
|
name => 'on.unknown', |
1812
|
|
|
|
|
|
|
raise => true, |
1813
|
|
|
|
|
|
|
stash => $stash, |
1814
|
|
|
|
|
|
|
message => $message, |
1815
|
|
|
|
|
|
|
}; |
1816
|
|
|
|
|
|
|
|
1817
|
1
|
|
|
|
|
8
|
return $result; |
1818
|
|
|
|
|
|
|
} |
1819
|
|
|
|
|
|
|
|
1820
|
|
|
|
|
|
|
|
1821
|
|
|
|
|
|
|
sub error_on_yesno { |
1822
|
2
|
|
|
2
|
1
|
10
|
my ($self, $data) = @_; |
1823
|
|
|
|
|
|
|
|
1824
|
2
|
|
|
|
|
6
|
my $message = join ', ', |
1825
|
|
|
|
|
|
|
'Failed checking {{from}}', |
1826
|
|
|
|
|
|
|
'value provided is not a recognized "yes" or "no" value', |
1827
|
|
|
|
|
|
|
'at {{at}}'; |
1828
|
|
|
|
|
|
|
|
1829
|
|
|
|
|
|
|
my $stash = { |
1830
|
2
|
|
|
|
|
19
|
%{$data}, |
|
2
|
|
|
|
|
11
|
|
1831
|
|
|
|
|
|
|
}; |
1832
|
|
|
|
|
|
|
|
1833
|
2
|
|
|
|
|
13
|
my $result = { |
1834
|
|
|
|
|
|
|
name => 'on.yesno', |
1835
|
|
|
|
|
|
|
raise => true, |
1836
|
|
|
|
|
|
|
stash => $stash, |
1837
|
|
|
|
|
|
|
message => $message, |
1838
|
|
|
|
|
|
|
}; |
1839
|
|
|
|
|
|
|
|
1840
|
2
|
|
|
|
|
11
|
return $result; |
1841
|
|
|
|
|
|
|
} |
1842
|
|
|
|
|
|
|
|
1843
|
|
|
|
|
|
|
1; |
1844
|
|
|
|
|
|
|
|
1845
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
|
1847
|
|
|
|
|
|
|
=head1 NAME |
1848
|
|
|
|
|
|
|
|
1849
|
|
|
|
|
|
|
Venus::Check - Check Class |
1850
|
|
|
|
|
|
|
|
1851
|
|
|
|
|
|
|
=cut |
1852
|
|
|
|
|
|
|
|
1853
|
|
|
|
|
|
|
=head1 ABSTRACT |
1854
|
|
|
|
|
|
|
|
1855
|
|
|
|
|
|
|
Check Class for Perl 5 |
1856
|
|
|
|
|
|
|
|
1857
|
|
|
|
|
|
|
=cut |
1858
|
|
|
|
|
|
|
|
1859
|
|
|
|
|
|
|
=head1 SYNOPSIS |
1860
|
|
|
|
|
|
|
|
1861
|
|
|
|
|
|
|
package main; |
1862
|
|
|
|
|
|
|
|
1863
|
|
|
|
|
|
|
use Venus::Check; |
1864
|
|
|
|
|
|
|
|
1865
|
|
|
|
|
|
|
my $check = Venus::Check->new; |
1866
|
|
|
|
|
|
|
|
1867
|
|
|
|
|
|
|
# $check->float; |
1868
|
|
|
|
|
|
|
|
1869
|
|
|
|
|
|
|
# my $result = $check->result(rand); |
1870
|
|
|
|
|
|
|
|
1871
|
|
|
|
|
|
|
# 0.1234567890 |
1872
|
|
|
|
|
|
|
|
1873
|
|
|
|
|
|
|
=cut |
1874
|
|
|
|
|
|
|
|
1875
|
|
|
|
|
|
|
=head1 DESCRIPTION |
1876
|
|
|
|
|
|
|
|
1877
|
|
|
|
|
|
|
This package provides a mechanism for performing runtime dynamic type checking |
1878
|
|
|
|
|
|
|
on data. |
1879
|
|
|
|
|
|
|
|
1880
|
|
|
|
|
|
|
=cut |
1881
|
|
|
|
|
|
|
|
1882
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
1883
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
This package has the following attributes: |
1885
|
|
|
|
|
|
|
|
1886
|
|
|
|
|
|
|
=cut |
1887
|
|
|
|
|
|
|
|
1888
|
|
|
|
|
|
|
=head2 on_eval |
1889
|
|
|
|
|
|
|
|
1890
|
|
|
|
|
|
|
on_eval(within[arrayref, coderef] $data) (within[arrayref, coderef]) |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
The on_eval attribute is read-write, accepts C<(ArrayRef[CodeRef])> values, and |
1893
|
|
|
|
|
|
|
is optional. |
1894
|
|
|
|
|
|
|
|
1895
|
|
|
|
|
|
|
I> |
1896
|
|
|
|
|
|
|
|
1897
|
|
|
|
|
|
|
=over 4 |
1898
|
|
|
|
|
|
|
|
1899
|
|
|
|
|
|
|
=item on_eval example 1 |
1900
|
|
|
|
|
|
|
|
1901
|
|
|
|
|
|
|
# given: synopsis |
1902
|
|
|
|
|
|
|
|
1903
|
|
|
|
|
|
|
package main; |
1904
|
|
|
|
|
|
|
|
1905
|
|
|
|
|
|
|
my $set_on_eval = $check->on_eval([sub{1}]); |
1906
|
|
|
|
|
|
|
|
1907
|
|
|
|
|
|
|
# [sub{1}] |
1908
|
|
|
|
|
|
|
|
1909
|
|
|
|
|
|
|
=back |
1910
|
|
|
|
|
|
|
|
1911
|
|
|
|
|
|
|
=over 4 |
1912
|
|
|
|
|
|
|
|
1913
|
|
|
|
|
|
|
=item on_eval example 2 |
1914
|
|
|
|
|
|
|
|
1915
|
|
|
|
|
|
|
# given: synopsis |
1916
|
|
|
|
|
|
|
|
1917
|
|
|
|
|
|
|
# given: example-1 on_eval |
1918
|
|
|
|
|
|
|
|
1919
|
|
|
|
|
|
|
package main; |
1920
|
|
|
|
|
|
|
|
1921
|
|
|
|
|
|
|
my $get_on_eval = $check->on_eval; |
1922
|
|
|
|
|
|
|
|
1923
|
|
|
|
|
|
|
# [sub{1}] |
1924
|
|
|
|
|
|
|
|
1925
|
|
|
|
|
|
|
=back |
1926
|
|
|
|
|
|
|
|
1927
|
|
|
|
|
|
|
=cut |
1928
|
|
|
|
|
|
|
|
1929
|
|
|
|
|
|
|
=head1 INHERITS |
1930
|
|
|
|
|
|
|
|
1931
|
|
|
|
|
|
|
This package inherits behaviors from: |
1932
|
|
|
|
|
|
|
|
1933
|
|
|
|
|
|
|
L |
1934
|
|
|
|
|
|
|
|
1935
|
|
|
|
|
|
|
=cut |
1936
|
|
|
|
|
|
|
|
1937
|
|
|
|
|
|
|
=head1 INTEGRATES |
1938
|
|
|
|
|
|
|
|
1939
|
|
|
|
|
|
|
This package integrates behaviors from: |
1940
|
|
|
|
|
|
|
|
1941
|
|
|
|
|
|
|
L |
1942
|
|
|
|
|
|
|
|
1943
|
|
|
|
|
|
|
=cut |
1944
|
|
|
|
|
|
|
|
1945
|
|
|
|
|
|
|
=head1 METHODS |
1946
|
|
|
|
|
|
|
|
1947
|
|
|
|
|
|
|
This package provides the following methods: |
1948
|
|
|
|
|
|
|
|
1949
|
|
|
|
|
|
|
=cut |
1950
|
|
|
|
|
|
|
|
1951
|
|
|
|
|
|
|
=head2 accept |
1952
|
|
|
|
|
|
|
|
1953
|
|
|
|
|
|
|
accept(string $name, string | within[arrayref, string] @args) (Venus::Check) |
1954
|
|
|
|
|
|
|
|
1955
|
|
|
|
|
|
|
The accept method configures the object to accept the conditions or identity |
1956
|
|
|
|
|
|
|
provided and returns the invocant. This method dispatches to the method(s) |
1957
|
|
|
|
|
|
|
specified, or to the L method otherwise. |
1958
|
|
|
|
|
|
|
|
1959
|
|
|
|
|
|
|
I> |
1960
|
|
|
|
|
|
|
|
1961
|
|
|
|
|
|
|
=over 4 |
1962
|
|
|
|
|
|
|
|
1963
|
|
|
|
|
|
|
=item accept example 1 |
1964
|
|
|
|
|
|
|
|
1965
|
|
|
|
|
|
|
# given: synopsis |
1966
|
|
|
|
|
|
|
|
1967
|
|
|
|
|
|
|
package main; |
1968
|
|
|
|
|
|
|
|
1969
|
|
|
|
|
|
|
$check = $check->accept('string'); |
1970
|
|
|
|
|
|
|
|
1971
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
1972
|
|
|
|
|
|
|
|
1973
|
|
|
|
|
|
|
# my $result = $check->eval('okay'); |
1974
|
|
|
|
|
|
|
|
1975
|
|
|
|
|
|
|
# true |
1976
|
|
|
|
|
|
|
|
1977
|
|
|
|
|
|
|
=back |
1978
|
|
|
|
|
|
|
|
1979
|
|
|
|
|
|
|
=over 4 |
1980
|
|
|
|
|
|
|
|
1981
|
|
|
|
|
|
|
=item accept example 2 |
1982
|
|
|
|
|
|
|
|
1983
|
|
|
|
|
|
|
# given: synopsis |
1984
|
|
|
|
|
|
|
|
1985
|
|
|
|
|
|
|
package main; |
1986
|
|
|
|
|
|
|
|
1987
|
|
|
|
|
|
|
$check = $check->accept('string'); |
1988
|
|
|
|
|
|
|
|
1989
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
1990
|
|
|
|
|
|
|
|
1991
|
|
|
|
|
|
|
# my $result = $check->eval(12345); |
1992
|
|
|
|
|
|
|
|
1993
|
|
|
|
|
|
|
# false |
1994
|
|
|
|
|
|
|
|
1995
|
|
|
|
|
|
|
=back |
1996
|
|
|
|
|
|
|
|
1997
|
|
|
|
|
|
|
=over 4 |
1998
|
|
|
|
|
|
|
|
1999
|
|
|
|
|
|
|
=item accept example 3 |
2000
|
|
|
|
|
|
|
|
2001
|
|
|
|
|
|
|
# given: synopsis |
2002
|
|
|
|
|
|
|
|
2003
|
|
|
|
|
|
|
package main; |
2004
|
|
|
|
|
|
|
|
2005
|
|
|
|
|
|
|
$check = $check->accept('string'); |
2006
|
|
|
|
|
|
|
|
2007
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2008
|
|
|
|
|
|
|
|
2009
|
|
|
|
|
|
|
# my $result = $check->result('okay'); |
2010
|
|
|
|
|
|
|
|
2011
|
|
|
|
|
|
|
# 'okay' |
2012
|
|
|
|
|
|
|
|
2013
|
|
|
|
|
|
|
=back |
2014
|
|
|
|
|
|
|
|
2015
|
|
|
|
|
|
|
=over 4 |
2016
|
|
|
|
|
|
|
|
2017
|
|
|
|
|
|
|
=item accept example 4 |
2018
|
|
|
|
|
|
|
|
2019
|
|
|
|
|
|
|
# given: synopsis |
2020
|
|
|
|
|
|
|
|
2021
|
|
|
|
|
|
|
package main; |
2022
|
|
|
|
|
|
|
|
2023
|
|
|
|
|
|
|
$check = $check->accept('string'); |
2024
|
|
|
|
|
|
|
|
2025
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2026
|
|
|
|
|
|
|
|
2027
|
|
|
|
|
|
|
# my $result = $check->result(12345); |
2028
|
|
|
|
|
|
|
|
2029
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2030
|
|
|
|
|
|
|
|
2031
|
|
|
|
|
|
|
=back |
2032
|
|
|
|
|
|
|
|
2033
|
|
|
|
|
|
|
=cut |
2034
|
|
|
|
|
|
|
|
2035
|
|
|
|
|
|
|
=head2 any |
2036
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
any() (Venus::Check) |
2038
|
|
|
|
|
|
|
|
2039
|
|
|
|
|
|
|
The any method configures the object to accept any value and returns the |
2040
|
|
|
|
|
|
|
invocant. |
2041
|
|
|
|
|
|
|
|
2042
|
|
|
|
|
|
|
I> |
2043
|
|
|
|
|
|
|
|
2044
|
|
|
|
|
|
|
=over 4 |
2045
|
|
|
|
|
|
|
|
2046
|
|
|
|
|
|
|
=item any example 1 |
2047
|
|
|
|
|
|
|
|
2048
|
|
|
|
|
|
|
# given: synopsis |
2049
|
|
|
|
|
|
|
|
2050
|
|
|
|
|
|
|
package main; |
2051
|
|
|
|
|
|
|
|
2052
|
|
|
|
|
|
|
$check = $check->any; |
2053
|
|
|
|
|
|
|
|
2054
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2055
|
|
|
|
|
|
|
|
2056
|
|
|
|
|
|
|
# my $result = $check->eval(1); |
2057
|
|
|
|
|
|
|
|
2058
|
|
|
|
|
|
|
# true |
2059
|
|
|
|
|
|
|
|
2060
|
|
|
|
|
|
|
=back |
2061
|
|
|
|
|
|
|
|
2062
|
|
|
|
|
|
|
=over 4 |
2063
|
|
|
|
|
|
|
|
2064
|
|
|
|
|
|
|
=item any example 2 |
2065
|
|
|
|
|
|
|
|
2066
|
|
|
|
|
|
|
# given: synopsis |
2067
|
|
|
|
|
|
|
|
2068
|
|
|
|
|
|
|
package main; |
2069
|
|
|
|
|
|
|
|
2070
|
|
|
|
|
|
|
$check = $check->any; |
2071
|
|
|
|
|
|
|
|
2072
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2073
|
|
|
|
|
|
|
|
2074
|
|
|
|
|
|
|
# my $result = $check->eval(bless{}); |
2075
|
|
|
|
|
|
|
|
2076
|
|
|
|
|
|
|
# true |
2077
|
|
|
|
|
|
|
|
2078
|
|
|
|
|
|
|
=back |
2079
|
|
|
|
|
|
|
|
2080
|
|
|
|
|
|
|
=cut |
2081
|
|
|
|
|
|
|
|
2082
|
|
|
|
|
|
|
=head2 array |
2083
|
|
|
|
|
|
|
|
2084
|
|
|
|
|
|
|
array(coderef @code) (Venus::Check) |
2085
|
|
|
|
|
|
|
|
2086
|
|
|
|
|
|
|
The array method configures the object to accept array references and returns |
2087
|
|
|
|
|
|
|
the invocant. |
2088
|
|
|
|
|
|
|
|
2089
|
|
|
|
|
|
|
I> |
2090
|
|
|
|
|
|
|
|
2091
|
|
|
|
|
|
|
=over 4 |
2092
|
|
|
|
|
|
|
|
2093
|
|
|
|
|
|
|
=item array example 1 |
2094
|
|
|
|
|
|
|
|
2095
|
|
|
|
|
|
|
# given: synopsis |
2096
|
|
|
|
|
|
|
|
2097
|
|
|
|
|
|
|
package main; |
2098
|
|
|
|
|
|
|
|
2099
|
|
|
|
|
|
|
$check = $check->array; |
2100
|
|
|
|
|
|
|
|
2101
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2102
|
|
|
|
|
|
|
|
2103
|
|
|
|
|
|
|
# my $result = $check->eval([]); |
2104
|
|
|
|
|
|
|
|
2105
|
|
|
|
|
|
|
# true |
2106
|
|
|
|
|
|
|
|
2107
|
|
|
|
|
|
|
=back |
2108
|
|
|
|
|
|
|
|
2109
|
|
|
|
|
|
|
=over 4 |
2110
|
|
|
|
|
|
|
|
2111
|
|
|
|
|
|
|
=item array example 2 |
2112
|
|
|
|
|
|
|
|
2113
|
|
|
|
|
|
|
# given: synopsis |
2114
|
|
|
|
|
|
|
|
2115
|
|
|
|
|
|
|
package main; |
2116
|
|
|
|
|
|
|
|
2117
|
|
|
|
|
|
|
$check = $check->array; |
2118
|
|
|
|
|
|
|
|
2119
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2120
|
|
|
|
|
|
|
|
2121
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
2122
|
|
|
|
|
|
|
|
2123
|
|
|
|
|
|
|
# false |
2124
|
|
|
|
|
|
|
|
2125
|
|
|
|
|
|
|
=back |
2126
|
|
|
|
|
|
|
|
2127
|
|
|
|
|
|
|
=over 4 |
2128
|
|
|
|
|
|
|
|
2129
|
|
|
|
|
|
|
=item array example 3 |
2130
|
|
|
|
|
|
|
|
2131
|
|
|
|
|
|
|
# given: synopsis |
2132
|
|
|
|
|
|
|
|
2133
|
|
|
|
|
|
|
package main; |
2134
|
|
|
|
|
|
|
|
2135
|
|
|
|
|
|
|
$check = $check->array; |
2136
|
|
|
|
|
|
|
|
2137
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2138
|
|
|
|
|
|
|
|
2139
|
|
|
|
|
|
|
# my $result = $check->result([1..4]); |
2140
|
|
|
|
|
|
|
|
2141
|
|
|
|
|
|
|
# [1..4] |
2142
|
|
|
|
|
|
|
|
2143
|
|
|
|
|
|
|
=back |
2144
|
|
|
|
|
|
|
|
2145
|
|
|
|
|
|
|
=over 4 |
2146
|
|
|
|
|
|
|
|
2147
|
|
|
|
|
|
|
=item array example 4 |
2148
|
|
|
|
|
|
|
|
2149
|
|
|
|
|
|
|
# given: synopsis |
2150
|
|
|
|
|
|
|
|
2151
|
|
|
|
|
|
|
package main; |
2152
|
|
|
|
|
|
|
|
2153
|
|
|
|
|
|
|
$check = $check->array; |
2154
|
|
|
|
|
|
|
|
2155
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2156
|
|
|
|
|
|
|
|
2157
|
|
|
|
|
|
|
# my $result = $check->result({1..4}); |
2158
|
|
|
|
|
|
|
|
2159
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2160
|
|
|
|
|
|
|
|
2161
|
|
|
|
|
|
|
=back |
2162
|
|
|
|
|
|
|
|
2163
|
|
|
|
|
|
|
=cut |
2164
|
|
|
|
|
|
|
|
2165
|
|
|
|
|
|
|
=head2 arrayref |
2166
|
|
|
|
|
|
|
|
2167
|
|
|
|
|
|
|
arrayref(coderef @code) (Venus::Check) |
2168
|
|
|
|
|
|
|
|
2169
|
|
|
|
|
|
|
The arrayref method configures the object to accept array references and returns |
2170
|
|
|
|
|
|
|
the invocant. |
2171
|
|
|
|
|
|
|
|
2172
|
|
|
|
|
|
|
I> |
2173
|
|
|
|
|
|
|
|
2174
|
|
|
|
|
|
|
=over 4 |
2175
|
|
|
|
|
|
|
|
2176
|
|
|
|
|
|
|
=item arrayref example 1 |
2177
|
|
|
|
|
|
|
|
2178
|
|
|
|
|
|
|
# given: synopsis |
2179
|
|
|
|
|
|
|
|
2180
|
|
|
|
|
|
|
package main; |
2181
|
|
|
|
|
|
|
|
2182
|
|
|
|
|
|
|
$check = $check->arrayref; |
2183
|
|
|
|
|
|
|
|
2184
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2185
|
|
|
|
|
|
|
|
2186
|
|
|
|
|
|
|
# my $result = $check->eval([]); |
2187
|
|
|
|
|
|
|
|
2188
|
|
|
|
|
|
|
# true |
2189
|
|
|
|
|
|
|
|
2190
|
|
|
|
|
|
|
=back |
2191
|
|
|
|
|
|
|
|
2192
|
|
|
|
|
|
|
=over 4 |
2193
|
|
|
|
|
|
|
|
2194
|
|
|
|
|
|
|
=item arrayref example 2 |
2195
|
|
|
|
|
|
|
|
2196
|
|
|
|
|
|
|
# given: synopsis |
2197
|
|
|
|
|
|
|
|
2198
|
|
|
|
|
|
|
package main; |
2199
|
|
|
|
|
|
|
|
2200
|
|
|
|
|
|
|
$check = $check->arrayref; |
2201
|
|
|
|
|
|
|
|
2202
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2203
|
|
|
|
|
|
|
|
2204
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
2205
|
|
|
|
|
|
|
|
2206
|
|
|
|
|
|
|
# false |
2207
|
|
|
|
|
|
|
|
2208
|
|
|
|
|
|
|
=back |
2209
|
|
|
|
|
|
|
|
2210
|
|
|
|
|
|
|
=over 4 |
2211
|
|
|
|
|
|
|
|
2212
|
|
|
|
|
|
|
=item arrayref example 3 |
2213
|
|
|
|
|
|
|
|
2214
|
|
|
|
|
|
|
# given: synopsis |
2215
|
|
|
|
|
|
|
|
2216
|
|
|
|
|
|
|
package main; |
2217
|
|
|
|
|
|
|
|
2218
|
|
|
|
|
|
|
$check = $check->arrayref; |
2219
|
|
|
|
|
|
|
|
2220
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2221
|
|
|
|
|
|
|
|
2222
|
|
|
|
|
|
|
# my $result = $check->result([1..4]); |
2223
|
|
|
|
|
|
|
|
2224
|
|
|
|
|
|
|
# [1..4] |
2225
|
|
|
|
|
|
|
|
2226
|
|
|
|
|
|
|
=back |
2227
|
|
|
|
|
|
|
|
2228
|
|
|
|
|
|
|
=over 4 |
2229
|
|
|
|
|
|
|
|
2230
|
|
|
|
|
|
|
=item arrayref example 4 |
2231
|
|
|
|
|
|
|
|
2232
|
|
|
|
|
|
|
# given: synopsis |
2233
|
|
|
|
|
|
|
|
2234
|
|
|
|
|
|
|
package main; |
2235
|
|
|
|
|
|
|
|
2236
|
|
|
|
|
|
|
$check = $check->arrayref; |
2237
|
|
|
|
|
|
|
|
2238
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2239
|
|
|
|
|
|
|
|
2240
|
|
|
|
|
|
|
# my $result = $check->result({1..4}); |
2241
|
|
|
|
|
|
|
|
2242
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2243
|
|
|
|
|
|
|
|
2244
|
|
|
|
|
|
|
=back |
2245
|
|
|
|
|
|
|
|
2246
|
|
|
|
|
|
|
=cut |
2247
|
|
|
|
|
|
|
|
2248
|
|
|
|
|
|
|
=head2 attributes |
2249
|
|
|
|
|
|
|
|
2250
|
|
|
|
|
|
|
attributes(string | within[arrayref, string] @args) (Venus::Check) |
2251
|
|
|
|
|
|
|
|
2252
|
|
|
|
|
|
|
The attributes method configures the object to accept objects containing |
2253
|
|
|
|
|
|
|
attributes whose values' match the attribute names and types specified, and |
2254
|
|
|
|
|
|
|
returns the invocant. |
2255
|
|
|
|
|
|
|
|
2256
|
|
|
|
|
|
|
I> |
2257
|
|
|
|
|
|
|
|
2258
|
|
|
|
|
|
|
=over 4 |
2259
|
|
|
|
|
|
|
|
2260
|
|
|
|
|
|
|
=item attributes example 1 |
2261
|
|
|
|
|
|
|
|
2262
|
|
|
|
|
|
|
# given: synopsis |
2263
|
|
|
|
|
|
|
|
2264
|
|
|
|
|
|
|
package Example; |
2265
|
|
|
|
|
|
|
|
2266
|
|
|
|
|
|
|
use Venus::Class 'attr'; |
2267
|
|
|
|
|
|
|
|
2268
|
|
|
|
|
|
|
attr 'name'; |
2269
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
package main; |
2271
|
|
|
|
|
|
|
|
2272
|
|
|
|
|
|
|
$check = $check->attributes('name', 'string'); |
2273
|
|
|
|
|
|
|
|
2274
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2275
|
|
|
|
|
|
|
|
2276
|
|
|
|
|
|
|
# my $result = $check->eval(Example->new(name => 'test')); |
2277
|
|
|
|
|
|
|
|
2278
|
|
|
|
|
|
|
# true |
2279
|
|
|
|
|
|
|
|
2280
|
|
|
|
|
|
|
=back |
2281
|
|
|
|
|
|
|
|
2282
|
|
|
|
|
|
|
=over 4 |
2283
|
|
|
|
|
|
|
|
2284
|
|
|
|
|
|
|
=item attributes example 2 |
2285
|
|
|
|
|
|
|
|
2286
|
|
|
|
|
|
|
# given: synopsis |
2287
|
|
|
|
|
|
|
|
2288
|
|
|
|
|
|
|
package Example; |
2289
|
|
|
|
|
|
|
|
2290
|
|
|
|
|
|
|
use Venus::Class 'attr'; |
2291
|
|
|
|
|
|
|
|
2292
|
|
|
|
|
|
|
attr 'name'; |
2293
|
|
|
|
|
|
|
|
2294
|
|
|
|
|
|
|
package main; |
2295
|
|
|
|
|
|
|
|
2296
|
|
|
|
|
|
|
$check = $check->attributes('name', 'string'); |
2297
|
|
|
|
|
|
|
|
2298
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2299
|
|
|
|
|
|
|
|
2300
|
|
|
|
|
|
|
# my $result = $check->eval(Example->new); |
2301
|
|
|
|
|
|
|
|
2302
|
|
|
|
|
|
|
# false |
2303
|
|
|
|
|
|
|
|
2304
|
|
|
|
|
|
|
=back |
2305
|
|
|
|
|
|
|
|
2306
|
|
|
|
|
|
|
=over 4 |
2307
|
|
|
|
|
|
|
|
2308
|
|
|
|
|
|
|
=item attributes example 3 |
2309
|
|
|
|
|
|
|
|
2310
|
|
|
|
|
|
|
# given: synopsis |
2311
|
|
|
|
|
|
|
|
2312
|
|
|
|
|
|
|
package Example; |
2313
|
|
|
|
|
|
|
|
2314
|
|
|
|
|
|
|
use Venus::Class 'attr'; |
2315
|
|
|
|
|
|
|
|
2316
|
|
|
|
|
|
|
attr 'name'; |
2317
|
|
|
|
|
|
|
|
2318
|
|
|
|
|
|
|
package main; |
2319
|
|
|
|
|
|
|
|
2320
|
|
|
|
|
|
|
$check = $check->attributes('name', 'string'); |
2321
|
|
|
|
|
|
|
|
2322
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2323
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
# my $result = $check->result(Example->new(name => 'test')); |
2325
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
# bless(..., 'Example') |
2327
|
|
|
|
|
|
|
|
2328
|
|
|
|
|
|
|
=back |
2329
|
|
|
|
|
|
|
|
2330
|
|
|
|
|
|
|
=over 4 |
2331
|
|
|
|
|
|
|
|
2332
|
|
|
|
|
|
|
=item attributes example 4 |
2333
|
|
|
|
|
|
|
|
2334
|
|
|
|
|
|
|
# given: synopsis |
2335
|
|
|
|
|
|
|
|
2336
|
|
|
|
|
|
|
package Example; |
2337
|
|
|
|
|
|
|
|
2338
|
|
|
|
|
|
|
use Venus::Class 'attr'; |
2339
|
|
|
|
|
|
|
|
2340
|
|
|
|
|
|
|
attr 'name'; |
2341
|
|
|
|
|
|
|
|
2342
|
|
|
|
|
|
|
package main; |
2343
|
|
|
|
|
|
|
|
2344
|
|
|
|
|
|
|
$check = $check->attributes('name', 'string'); |
2345
|
|
|
|
|
|
|
|
2346
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2347
|
|
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
# my $result = $check->result({}); |
2349
|
|
|
|
|
|
|
|
2350
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2351
|
|
|
|
|
|
|
|
2352
|
|
|
|
|
|
|
=back |
2353
|
|
|
|
|
|
|
|
2354
|
|
|
|
|
|
|
=over 4 |
2355
|
|
|
|
|
|
|
|
2356
|
|
|
|
|
|
|
=item attributes example 5 |
2357
|
|
|
|
|
|
|
|
2358
|
|
|
|
|
|
|
# given: synopsis |
2359
|
|
|
|
|
|
|
|
2360
|
|
|
|
|
|
|
package Example; |
2361
|
|
|
|
|
|
|
|
2362
|
|
|
|
|
|
|
use Venus::Class 'attr'; |
2363
|
|
|
|
|
|
|
|
2364
|
|
|
|
|
|
|
attr 'name'; |
2365
|
|
|
|
|
|
|
|
2366
|
|
|
|
|
|
|
package main; |
2367
|
|
|
|
|
|
|
|
2368
|
|
|
|
|
|
|
$check = $check->attributes('name', 'string', 'age'); |
2369
|
|
|
|
|
|
|
|
2370
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2371
|
|
|
|
|
|
|
|
2372
|
|
|
|
|
|
|
# my $result = $check->result(Example->new); |
2373
|
|
|
|
|
|
|
|
2374
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_pairs) |
2375
|
|
|
|
|
|
|
|
2376
|
|
|
|
|
|
|
=back |
2377
|
|
|
|
|
|
|
|
2378
|
|
|
|
|
|
|
=over 4 |
2379
|
|
|
|
|
|
|
|
2380
|
|
|
|
|
|
|
=item attributes example 6 |
2381
|
|
|
|
|
|
|
|
2382
|
|
|
|
|
|
|
# given: synopsis |
2383
|
|
|
|
|
|
|
|
2384
|
|
|
|
|
|
|
package Example; |
2385
|
|
|
|
|
|
|
|
2386
|
|
|
|
|
|
|
use Venus::Class; |
2387
|
|
|
|
|
|
|
|
2388
|
|
|
|
|
|
|
package main; |
2389
|
|
|
|
|
|
|
|
2390
|
|
|
|
|
|
|
$check = $check->attributes('name', 'string'); |
2391
|
|
|
|
|
|
|
|
2392
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2393
|
|
|
|
|
|
|
|
2394
|
|
|
|
|
|
|
# my $result = $check->result(Example->new); |
2395
|
|
|
|
|
|
|
|
2396
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_missing) |
2397
|
|
|
|
|
|
|
|
2398
|
|
|
|
|
|
|
=back |
2399
|
|
|
|
|
|
|
|
2400
|
|
|
|
|
|
|
=over 4 |
2401
|
|
|
|
|
|
|
|
2402
|
|
|
|
|
|
|
=item attributes example 7 |
2403
|
|
|
|
|
|
|
|
2404
|
|
|
|
|
|
|
# given: synopsis |
2405
|
|
|
|
|
|
|
|
2406
|
|
|
|
|
|
|
package Example; |
2407
|
|
|
|
|
|
|
|
2408
|
|
|
|
|
|
|
use Venus::Class 'attr'; |
2409
|
|
|
|
|
|
|
|
2410
|
|
|
|
|
|
|
attr 'name'; |
2411
|
|
|
|
|
|
|
|
2412
|
|
|
|
|
|
|
package main; |
2413
|
|
|
|
|
|
|
|
2414
|
|
|
|
|
|
|
$check = $check->attributes('name', 'string'); |
2415
|
|
|
|
|
|
|
|
2416
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2417
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
# my $result = $check->result(Example->new(name => rand)); |
2419
|
|
|
|
|
|
|
|
2420
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2421
|
|
|
|
|
|
|
|
2422
|
|
|
|
|
|
|
=back |
2423
|
|
|
|
|
|
|
|
2424
|
|
|
|
|
|
|
=cut |
2425
|
|
|
|
|
|
|
|
2426
|
|
|
|
|
|
|
=head2 bool |
2427
|
|
|
|
|
|
|
|
2428
|
|
|
|
|
|
|
bool(coderef @code) (Venus::Check) |
2429
|
|
|
|
|
|
|
|
2430
|
|
|
|
|
|
|
The bool method configures the object to accept boolean values and returns the |
2431
|
|
|
|
|
|
|
invocant. |
2432
|
|
|
|
|
|
|
|
2433
|
|
|
|
|
|
|
I> |
2434
|
|
|
|
|
|
|
|
2435
|
|
|
|
|
|
|
=over 4 |
2436
|
|
|
|
|
|
|
|
2437
|
|
|
|
|
|
|
=item bool example 1 |
2438
|
|
|
|
|
|
|
|
2439
|
|
|
|
|
|
|
# given: synopsis |
2440
|
|
|
|
|
|
|
|
2441
|
|
|
|
|
|
|
package main; |
2442
|
|
|
|
|
|
|
|
2443
|
|
|
|
|
|
|
use Venus; |
2444
|
|
|
|
|
|
|
|
2445
|
|
|
|
|
|
|
$check = $check->bool; |
2446
|
|
|
|
|
|
|
|
2447
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2448
|
|
|
|
|
|
|
|
2449
|
|
|
|
|
|
|
# my $result = $check->eval(true); |
2450
|
|
|
|
|
|
|
|
2451
|
|
|
|
|
|
|
# true |
2452
|
|
|
|
|
|
|
|
2453
|
|
|
|
|
|
|
=back |
2454
|
|
|
|
|
|
|
|
2455
|
|
|
|
|
|
|
=over 4 |
2456
|
|
|
|
|
|
|
|
2457
|
|
|
|
|
|
|
=item bool example 2 |
2458
|
|
|
|
|
|
|
|
2459
|
|
|
|
|
|
|
# given: synopsis |
2460
|
|
|
|
|
|
|
|
2461
|
|
|
|
|
|
|
package main; |
2462
|
|
|
|
|
|
|
|
2463
|
|
|
|
|
|
|
use Venus; |
2464
|
|
|
|
|
|
|
|
2465
|
|
|
|
|
|
|
$check = $check->bool; |
2466
|
|
|
|
|
|
|
|
2467
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2468
|
|
|
|
|
|
|
|
2469
|
|
|
|
|
|
|
# my $result = $check->eval(1); |
2470
|
|
|
|
|
|
|
|
2471
|
|
|
|
|
|
|
# false |
2472
|
|
|
|
|
|
|
|
2473
|
|
|
|
|
|
|
=back |
2474
|
|
|
|
|
|
|
|
2475
|
|
|
|
|
|
|
=over 4 |
2476
|
|
|
|
|
|
|
|
2477
|
|
|
|
|
|
|
=item bool example 3 |
2478
|
|
|
|
|
|
|
|
2479
|
|
|
|
|
|
|
# given: synopsis |
2480
|
|
|
|
|
|
|
|
2481
|
|
|
|
|
|
|
package main; |
2482
|
|
|
|
|
|
|
|
2483
|
|
|
|
|
|
|
use Venus; |
2484
|
|
|
|
|
|
|
|
2485
|
|
|
|
|
|
|
$check = $check->bool; |
2486
|
|
|
|
|
|
|
|
2487
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2488
|
|
|
|
|
|
|
|
2489
|
|
|
|
|
|
|
# my $result = $check->result(true); |
2490
|
|
|
|
|
|
|
|
2491
|
|
|
|
|
|
|
# true |
2492
|
|
|
|
|
|
|
|
2493
|
|
|
|
|
|
|
=back |
2494
|
|
|
|
|
|
|
|
2495
|
|
|
|
|
|
|
=over 4 |
2496
|
|
|
|
|
|
|
|
2497
|
|
|
|
|
|
|
=item bool example 4 |
2498
|
|
|
|
|
|
|
|
2499
|
|
|
|
|
|
|
# given: synopsis |
2500
|
|
|
|
|
|
|
|
2501
|
|
|
|
|
|
|
package main; |
2502
|
|
|
|
|
|
|
|
2503
|
|
|
|
|
|
|
use Venus; |
2504
|
|
|
|
|
|
|
|
2505
|
|
|
|
|
|
|
$check = $check->bool; |
2506
|
|
|
|
|
|
|
|
2507
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2508
|
|
|
|
|
|
|
|
2509
|
|
|
|
|
|
|
# my $result = $check->result(1); |
2510
|
|
|
|
|
|
|
|
2511
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2512
|
|
|
|
|
|
|
|
2513
|
|
|
|
|
|
|
=back |
2514
|
|
|
|
|
|
|
|
2515
|
|
|
|
|
|
|
=cut |
2516
|
|
|
|
|
|
|
|
2517
|
|
|
|
|
|
|
=head2 boolean |
2518
|
|
|
|
|
|
|
|
2519
|
|
|
|
|
|
|
boolean(coderef @code) (Venus::Check) |
2520
|
|
|
|
|
|
|
|
2521
|
|
|
|
|
|
|
The boolean method configures the object to accept boolean values and returns |
2522
|
|
|
|
|
|
|
the invocant. |
2523
|
|
|
|
|
|
|
|
2524
|
|
|
|
|
|
|
I> |
2525
|
|
|
|
|
|
|
|
2526
|
|
|
|
|
|
|
=over 4 |
2527
|
|
|
|
|
|
|
|
2528
|
|
|
|
|
|
|
=item boolean example 1 |
2529
|
|
|
|
|
|
|
|
2530
|
|
|
|
|
|
|
# given: synopsis |
2531
|
|
|
|
|
|
|
|
2532
|
|
|
|
|
|
|
package main; |
2533
|
|
|
|
|
|
|
|
2534
|
|
|
|
|
|
|
use Venus; |
2535
|
|
|
|
|
|
|
|
2536
|
|
|
|
|
|
|
$check = $check->boolean; |
2537
|
|
|
|
|
|
|
|
2538
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2539
|
|
|
|
|
|
|
|
2540
|
|
|
|
|
|
|
# my $result = $check->eval(true); |
2541
|
|
|
|
|
|
|
|
2542
|
|
|
|
|
|
|
# true |
2543
|
|
|
|
|
|
|
|
2544
|
|
|
|
|
|
|
=back |
2545
|
|
|
|
|
|
|
|
2546
|
|
|
|
|
|
|
=over 4 |
2547
|
|
|
|
|
|
|
|
2548
|
|
|
|
|
|
|
=item boolean example 2 |
2549
|
|
|
|
|
|
|
|
2550
|
|
|
|
|
|
|
# given: synopsis |
2551
|
|
|
|
|
|
|
|
2552
|
|
|
|
|
|
|
package main; |
2553
|
|
|
|
|
|
|
|
2554
|
|
|
|
|
|
|
use Venus; |
2555
|
|
|
|
|
|
|
|
2556
|
|
|
|
|
|
|
$check = $check->boolean; |
2557
|
|
|
|
|
|
|
|
2558
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2559
|
|
|
|
|
|
|
|
2560
|
|
|
|
|
|
|
# my $result = $check->eval(1); |
2561
|
|
|
|
|
|
|
|
2562
|
|
|
|
|
|
|
# false |
2563
|
|
|
|
|
|
|
|
2564
|
|
|
|
|
|
|
=back |
2565
|
|
|
|
|
|
|
|
2566
|
|
|
|
|
|
|
=over 4 |
2567
|
|
|
|
|
|
|
|
2568
|
|
|
|
|
|
|
=item boolean example 3 |
2569
|
|
|
|
|
|
|
|
2570
|
|
|
|
|
|
|
# given: synopsis |
2571
|
|
|
|
|
|
|
|
2572
|
|
|
|
|
|
|
package main; |
2573
|
|
|
|
|
|
|
|
2574
|
|
|
|
|
|
|
use Venus; |
2575
|
|
|
|
|
|
|
|
2576
|
|
|
|
|
|
|
$check = $check->boolean; |
2577
|
|
|
|
|
|
|
|
2578
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2579
|
|
|
|
|
|
|
|
2580
|
|
|
|
|
|
|
# my $result = $check->result(true); |
2581
|
|
|
|
|
|
|
|
2582
|
|
|
|
|
|
|
# true |
2583
|
|
|
|
|
|
|
|
2584
|
|
|
|
|
|
|
=back |
2585
|
|
|
|
|
|
|
|
2586
|
|
|
|
|
|
|
=over 4 |
2587
|
|
|
|
|
|
|
|
2588
|
|
|
|
|
|
|
=item boolean example 4 |
2589
|
|
|
|
|
|
|
|
2590
|
|
|
|
|
|
|
# given: synopsis |
2591
|
|
|
|
|
|
|
|
2592
|
|
|
|
|
|
|
package main; |
2593
|
|
|
|
|
|
|
|
2594
|
|
|
|
|
|
|
use Venus; |
2595
|
|
|
|
|
|
|
|
2596
|
|
|
|
|
|
|
$check = $check->boolean; |
2597
|
|
|
|
|
|
|
|
2598
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2599
|
|
|
|
|
|
|
|
2600
|
|
|
|
|
|
|
# my $result = $check->result(1); |
2601
|
|
|
|
|
|
|
|
2602
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2603
|
|
|
|
|
|
|
|
2604
|
|
|
|
|
|
|
=back |
2605
|
|
|
|
|
|
|
|
2606
|
|
|
|
|
|
|
=cut |
2607
|
|
|
|
|
|
|
|
2608
|
|
|
|
|
|
|
=head2 branch |
2609
|
|
|
|
|
|
|
|
2610
|
|
|
|
|
|
|
branch(string @args) (Venus::Check) |
2611
|
|
|
|
|
|
|
|
2612
|
|
|
|
|
|
|
The branch method returns a new L object configured to evaluate a |
2613
|
|
|
|
|
|
|
branch of logic from its source. |
2614
|
|
|
|
|
|
|
|
2615
|
|
|
|
|
|
|
I> |
2616
|
|
|
|
|
|
|
|
2617
|
|
|
|
|
|
|
=over 4 |
2618
|
|
|
|
|
|
|
|
2619
|
|
|
|
|
|
|
=item branch example 1 |
2620
|
|
|
|
|
|
|
|
2621
|
|
|
|
|
|
|
# given: synopsis |
2622
|
|
|
|
|
|
|
|
2623
|
|
|
|
|
|
|
package main; |
2624
|
|
|
|
|
|
|
|
2625
|
|
|
|
|
|
|
my $branch = $check->branch('nested'); |
2626
|
|
|
|
|
|
|
|
2627
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2628
|
|
|
|
|
|
|
|
2629
|
|
|
|
|
|
|
=back |
2630
|
|
|
|
|
|
|
|
2631
|
|
|
|
|
|
|
=cut |
2632
|
|
|
|
|
|
|
|
2633
|
|
|
|
|
|
|
=head2 clear |
2634
|
|
|
|
|
|
|
|
2635
|
|
|
|
|
|
|
clear() (Venus::Check) |
2636
|
|
|
|
|
|
|
|
2637
|
|
|
|
|
|
|
The clear method resets all registered conditions and returns the invocant. |
2638
|
|
|
|
|
|
|
|
2639
|
|
|
|
|
|
|
I> |
2640
|
|
|
|
|
|
|
|
2641
|
|
|
|
|
|
|
=over 4 |
2642
|
|
|
|
|
|
|
|
2643
|
|
|
|
|
|
|
=item clear example 1 |
2644
|
|
|
|
|
|
|
|
2645
|
|
|
|
|
|
|
# given: synopsis |
2646
|
|
|
|
|
|
|
|
2647
|
|
|
|
|
|
|
package main; |
2648
|
|
|
|
|
|
|
|
2649
|
|
|
|
|
|
|
$check->any; |
2650
|
|
|
|
|
|
|
|
2651
|
|
|
|
|
|
|
$check = $check->clear; |
2652
|
|
|
|
|
|
|
|
2653
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2654
|
|
|
|
|
|
|
|
2655
|
|
|
|
|
|
|
=back |
2656
|
|
|
|
|
|
|
|
2657
|
|
|
|
|
|
|
=cut |
2658
|
|
|
|
|
|
|
|
2659
|
|
|
|
|
|
|
=head2 code |
2660
|
|
|
|
|
|
|
|
2661
|
|
|
|
|
|
|
code(coderef @code) (Venus::Check) |
2662
|
|
|
|
|
|
|
|
2663
|
|
|
|
|
|
|
The code method configures the object to accept code references and returns |
2664
|
|
|
|
|
|
|
the invocant. |
2665
|
|
|
|
|
|
|
|
2666
|
|
|
|
|
|
|
I> |
2667
|
|
|
|
|
|
|
|
2668
|
|
|
|
|
|
|
=over 4 |
2669
|
|
|
|
|
|
|
|
2670
|
|
|
|
|
|
|
=item code example 1 |
2671
|
|
|
|
|
|
|
|
2672
|
|
|
|
|
|
|
# given: synopsis |
2673
|
|
|
|
|
|
|
|
2674
|
|
|
|
|
|
|
package main; |
2675
|
|
|
|
|
|
|
|
2676
|
|
|
|
|
|
|
$check = $check->code; |
2677
|
|
|
|
|
|
|
|
2678
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2679
|
|
|
|
|
|
|
|
2680
|
|
|
|
|
|
|
# my $result = $check->eval(sub{}); |
2681
|
|
|
|
|
|
|
|
2682
|
|
|
|
|
|
|
# true |
2683
|
|
|
|
|
|
|
|
2684
|
|
|
|
|
|
|
=back |
2685
|
|
|
|
|
|
|
|
2686
|
|
|
|
|
|
|
=over 4 |
2687
|
|
|
|
|
|
|
|
2688
|
|
|
|
|
|
|
=item code example 2 |
2689
|
|
|
|
|
|
|
|
2690
|
|
|
|
|
|
|
# given: synopsis |
2691
|
|
|
|
|
|
|
|
2692
|
|
|
|
|
|
|
package main; |
2693
|
|
|
|
|
|
|
|
2694
|
|
|
|
|
|
|
$check = $check->code; |
2695
|
|
|
|
|
|
|
|
2696
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2697
|
|
|
|
|
|
|
|
2698
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
2699
|
|
|
|
|
|
|
|
2700
|
|
|
|
|
|
|
# false |
2701
|
|
|
|
|
|
|
|
2702
|
|
|
|
|
|
|
=back |
2703
|
|
|
|
|
|
|
|
2704
|
|
|
|
|
|
|
=over 4 |
2705
|
|
|
|
|
|
|
|
2706
|
|
|
|
|
|
|
=item code example 3 |
2707
|
|
|
|
|
|
|
|
2708
|
|
|
|
|
|
|
# given: synopsis |
2709
|
|
|
|
|
|
|
|
2710
|
|
|
|
|
|
|
package main; |
2711
|
|
|
|
|
|
|
|
2712
|
|
|
|
|
|
|
$check = $check->code; |
2713
|
|
|
|
|
|
|
|
2714
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2715
|
|
|
|
|
|
|
|
2716
|
|
|
|
|
|
|
# my $result = $check->result(sub{}); |
2717
|
|
|
|
|
|
|
|
2718
|
|
|
|
|
|
|
# sub{} |
2719
|
|
|
|
|
|
|
|
2720
|
|
|
|
|
|
|
=back |
2721
|
|
|
|
|
|
|
|
2722
|
|
|
|
|
|
|
=over 4 |
2723
|
|
|
|
|
|
|
|
2724
|
|
|
|
|
|
|
=item code example 4 |
2725
|
|
|
|
|
|
|
|
2726
|
|
|
|
|
|
|
# given: synopsis |
2727
|
|
|
|
|
|
|
|
2728
|
|
|
|
|
|
|
package main; |
2729
|
|
|
|
|
|
|
|
2730
|
|
|
|
|
|
|
$check = $check->code; |
2731
|
|
|
|
|
|
|
|
2732
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2733
|
|
|
|
|
|
|
|
2734
|
|
|
|
|
|
|
# my $result = $check->result({}); |
2735
|
|
|
|
|
|
|
|
2736
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2737
|
|
|
|
|
|
|
|
2738
|
|
|
|
|
|
|
=back |
2739
|
|
|
|
|
|
|
|
2740
|
|
|
|
|
|
|
=cut |
2741
|
|
|
|
|
|
|
|
2742
|
|
|
|
|
|
|
=head2 coded |
2743
|
|
|
|
|
|
|
|
2744
|
|
|
|
|
|
|
coded(any $data, string $name) (Venus::Check) |
2745
|
|
|
|
|
|
|
|
2746
|
|
|
|
|
|
|
The coded method accepts a value and a type name returns the result of a |
2747
|
|
|
|
|
|
|
L operation. |
2748
|
|
|
|
|
|
|
|
2749
|
|
|
|
|
|
|
I> |
2750
|
|
|
|
|
|
|
|
2751
|
|
|
|
|
|
|
=over 4 |
2752
|
|
|
|
|
|
|
|
2753
|
|
|
|
|
|
|
=item coded example 1 |
2754
|
|
|
|
|
|
|
|
2755
|
|
|
|
|
|
|
# given: synopsis |
2756
|
|
|
|
|
|
|
|
2757
|
|
|
|
|
|
|
package main; |
2758
|
|
|
|
|
|
|
|
2759
|
|
|
|
|
|
|
$check = $check->coded('hello', 'string'); |
2760
|
|
|
|
|
|
|
|
2761
|
|
|
|
|
|
|
# true |
2762
|
|
|
|
|
|
|
|
2763
|
|
|
|
|
|
|
=back |
2764
|
|
|
|
|
|
|
|
2765
|
|
|
|
|
|
|
=over 4 |
2766
|
|
|
|
|
|
|
|
2767
|
|
|
|
|
|
|
=item coded example 2 |
2768
|
|
|
|
|
|
|
|
2769
|
|
|
|
|
|
|
# given: synopsis |
2770
|
|
|
|
|
|
|
|
2771
|
|
|
|
|
|
|
package main; |
2772
|
|
|
|
|
|
|
|
2773
|
|
|
|
|
|
|
$check = $check->coded(12345, 'string'); |
2774
|
|
|
|
|
|
|
|
2775
|
|
|
|
|
|
|
# false |
2776
|
|
|
|
|
|
|
|
2777
|
|
|
|
|
|
|
=back |
2778
|
|
|
|
|
|
|
|
2779
|
|
|
|
|
|
|
=cut |
2780
|
|
|
|
|
|
|
|
2781
|
|
|
|
|
|
|
=head2 coderef |
2782
|
|
|
|
|
|
|
|
2783
|
|
|
|
|
|
|
coderef(coderef @code) (Venus::Check) |
2784
|
|
|
|
|
|
|
|
2785
|
|
|
|
|
|
|
The coderef method configures the object to accept code references and returns |
2786
|
|
|
|
|
|
|
the invocant. |
2787
|
|
|
|
|
|
|
|
2788
|
|
|
|
|
|
|
I> |
2789
|
|
|
|
|
|
|
|
2790
|
|
|
|
|
|
|
=over 4 |
2791
|
|
|
|
|
|
|
|
2792
|
|
|
|
|
|
|
=item coderef example 1 |
2793
|
|
|
|
|
|
|
|
2794
|
|
|
|
|
|
|
# given: synopsis |
2795
|
|
|
|
|
|
|
|
2796
|
|
|
|
|
|
|
package main; |
2797
|
|
|
|
|
|
|
|
2798
|
|
|
|
|
|
|
$check = $check->coderef; |
2799
|
|
|
|
|
|
|
|
2800
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2801
|
|
|
|
|
|
|
|
2802
|
|
|
|
|
|
|
# my $result = $check->eval(sub{}); |
2803
|
|
|
|
|
|
|
|
2804
|
|
|
|
|
|
|
# true |
2805
|
|
|
|
|
|
|
|
2806
|
|
|
|
|
|
|
=back |
2807
|
|
|
|
|
|
|
|
2808
|
|
|
|
|
|
|
=over 4 |
2809
|
|
|
|
|
|
|
|
2810
|
|
|
|
|
|
|
=item coderef example 2 |
2811
|
|
|
|
|
|
|
|
2812
|
|
|
|
|
|
|
# given: synopsis |
2813
|
|
|
|
|
|
|
|
2814
|
|
|
|
|
|
|
package main; |
2815
|
|
|
|
|
|
|
|
2816
|
|
|
|
|
|
|
$check = $check->coderef; |
2817
|
|
|
|
|
|
|
|
2818
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2819
|
|
|
|
|
|
|
|
2820
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
2821
|
|
|
|
|
|
|
|
2822
|
|
|
|
|
|
|
# false |
2823
|
|
|
|
|
|
|
|
2824
|
|
|
|
|
|
|
=back |
2825
|
|
|
|
|
|
|
|
2826
|
|
|
|
|
|
|
=over 4 |
2827
|
|
|
|
|
|
|
|
2828
|
|
|
|
|
|
|
=item coderef example 3 |
2829
|
|
|
|
|
|
|
|
2830
|
|
|
|
|
|
|
# given: synopsis |
2831
|
|
|
|
|
|
|
|
2832
|
|
|
|
|
|
|
package main; |
2833
|
|
|
|
|
|
|
|
2834
|
|
|
|
|
|
|
$check = $check->coderef; |
2835
|
|
|
|
|
|
|
|
2836
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2837
|
|
|
|
|
|
|
|
2838
|
|
|
|
|
|
|
# my $result = $check->result(sub{}); |
2839
|
|
|
|
|
|
|
|
2840
|
|
|
|
|
|
|
# sub{} |
2841
|
|
|
|
|
|
|
|
2842
|
|
|
|
|
|
|
=back |
2843
|
|
|
|
|
|
|
|
2844
|
|
|
|
|
|
|
=over 4 |
2845
|
|
|
|
|
|
|
|
2846
|
|
|
|
|
|
|
=item coderef example 4 |
2847
|
|
|
|
|
|
|
|
2848
|
|
|
|
|
|
|
# given: synopsis |
2849
|
|
|
|
|
|
|
|
2850
|
|
|
|
|
|
|
package main; |
2851
|
|
|
|
|
|
|
|
2852
|
|
|
|
|
|
|
$check = $check->coderef; |
2853
|
|
|
|
|
|
|
|
2854
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2855
|
|
|
|
|
|
|
|
2856
|
|
|
|
|
|
|
# my $result = $check->result({}); |
2857
|
|
|
|
|
|
|
|
2858
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2859
|
|
|
|
|
|
|
|
2860
|
|
|
|
|
|
|
=back |
2861
|
|
|
|
|
|
|
|
2862
|
|
|
|
|
|
|
=cut |
2863
|
|
|
|
|
|
|
|
2864
|
|
|
|
|
|
|
=head2 consumes |
2865
|
|
|
|
|
|
|
|
2866
|
|
|
|
|
|
|
consumes(string $role) (Venus::Check) |
2867
|
|
|
|
|
|
|
|
2868
|
|
|
|
|
|
|
The consumes method configures the object to accept objects which consume the |
2869
|
|
|
|
|
|
|
role provided, and returns the invocant. |
2870
|
|
|
|
|
|
|
|
2871
|
|
|
|
|
|
|
I> |
2872
|
|
|
|
|
|
|
|
2873
|
|
|
|
|
|
|
=over 4 |
2874
|
|
|
|
|
|
|
|
2875
|
|
|
|
|
|
|
=item consumes example 1 |
2876
|
|
|
|
|
|
|
|
2877
|
|
|
|
|
|
|
# given: synopsis |
2878
|
|
|
|
|
|
|
|
2879
|
|
|
|
|
|
|
package Example; |
2880
|
|
|
|
|
|
|
|
2881
|
|
|
|
|
|
|
use Venus::Class 'base'; |
2882
|
|
|
|
|
|
|
|
2883
|
|
|
|
|
|
|
base 'Venus::Kind'; |
2884
|
|
|
|
|
|
|
|
2885
|
|
|
|
|
|
|
package main; |
2886
|
|
|
|
|
|
|
|
2887
|
|
|
|
|
|
|
$check = $check->consumes('Venus::Role::Throwable'); |
2888
|
|
|
|
|
|
|
|
2889
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2890
|
|
|
|
|
|
|
|
2891
|
|
|
|
|
|
|
# my $result = $check->eval(Example->new); |
2892
|
|
|
|
|
|
|
|
2893
|
|
|
|
|
|
|
# true |
2894
|
|
|
|
|
|
|
|
2895
|
|
|
|
|
|
|
=back |
2896
|
|
|
|
|
|
|
|
2897
|
|
|
|
|
|
|
=over 4 |
2898
|
|
|
|
|
|
|
|
2899
|
|
|
|
|
|
|
=item consumes example 2 |
2900
|
|
|
|
|
|
|
|
2901
|
|
|
|
|
|
|
# given: synopsis |
2902
|
|
|
|
|
|
|
|
2903
|
|
|
|
|
|
|
package Example; |
2904
|
|
|
|
|
|
|
|
2905
|
|
|
|
|
|
|
use Venus::Class 'base'; |
2906
|
|
|
|
|
|
|
|
2907
|
|
|
|
|
|
|
base 'Venus::Kind'; |
2908
|
|
|
|
|
|
|
|
2909
|
|
|
|
|
|
|
package main; |
2910
|
|
|
|
|
|
|
|
2911
|
|
|
|
|
|
|
$check = $check->consumes('Venus::Role::Knowable'); |
2912
|
|
|
|
|
|
|
|
2913
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2914
|
|
|
|
|
|
|
|
2915
|
|
|
|
|
|
|
# my $result = $check->eval(Example->new); |
2916
|
|
|
|
|
|
|
|
2917
|
|
|
|
|
|
|
# false |
2918
|
|
|
|
|
|
|
|
2919
|
|
|
|
|
|
|
=back |
2920
|
|
|
|
|
|
|
|
2921
|
|
|
|
|
|
|
=over 4 |
2922
|
|
|
|
|
|
|
|
2923
|
|
|
|
|
|
|
=item consumes example 3 |
2924
|
|
|
|
|
|
|
|
2925
|
|
|
|
|
|
|
# given: synopsis |
2926
|
|
|
|
|
|
|
|
2927
|
|
|
|
|
|
|
package Example; |
2928
|
|
|
|
|
|
|
|
2929
|
|
|
|
|
|
|
use Venus::Class 'base'; |
2930
|
|
|
|
|
|
|
|
2931
|
|
|
|
|
|
|
base 'Venus::Kind'; |
2932
|
|
|
|
|
|
|
|
2933
|
|
|
|
|
|
|
package main; |
2934
|
|
|
|
|
|
|
|
2935
|
|
|
|
|
|
|
$check = $check->consumes('Venus::Role::Throwable'); |
2936
|
|
|
|
|
|
|
|
2937
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2938
|
|
|
|
|
|
|
|
2939
|
|
|
|
|
|
|
# my $result = $check->result(Example->new); |
2940
|
|
|
|
|
|
|
|
2941
|
|
|
|
|
|
|
# bless(..., 'Example') |
2942
|
|
|
|
|
|
|
|
2943
|
|
|
|
|
|
|
=back |
2944
|
|
|
|
|
|
|
|
2945
|
|
|
|
|
|
|
=over 4 |
2946
|
|
|
|
|
|
|
|
2947
|
|
|
|
|
|
|
=item consumes example 4 |
2948
|
|
|
|
|
|
|
|
2949
|
|
|
|
|
|
|
# given: synopsis |
2950
|
|
|
|
|
|
|
|
2951
|
|
|
|
|
|
|
package main; |
2952
|
|
|
|
|
|
|
|
2953
|
|
|
|
|
|
|
$check = $check->consumes('Venus::Role::Knowable'); |
2954
|
|
|
|
|
|
|
|
2955
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2956
|
|
|
|
|
|
|
|
2957
|
|
|
|
|
|
|
# my $result = $check->result({}); |
2958
|
|
|
|
|
|
|
|
2959
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
2960
|
|
|
|
|
|
|
|
2961
|
|
|
|
|
|
|
=back |
2962
|
|
|
|
|
|
|
|
2963
|
|
|
|
|
|
|
=over 4 |
2964
|
|
|
|
|
|
|
|
2965
|
|
|
|
|
|
|
=item consumes example 5 |
2966
|
|
|
|
|
|
|
|
2967
|
|
|
|
|
|
|
# given: synopsis |
2968
|
|
|
|
|
|
|
|
2969
|
|
|
|
|
|
|
package Example; |
2970
|
|
|
|
|
|
|
|
2971
|
|
|
|
|
|
|
use Venus::Class 'base'; |
2972
|
|
|
|
|
|
|
|
2973
|
|
|
|
|
|
|
base 'Venus::Kind'; |
2974
|
|
|
|
|
|
|
|
2975
|
|
|
|
|
|
|
package main; |
2976
|
|
|
|
|
|
|
|
2977
|
|
|
|
|
|
|
$check = $check->consumes('Venus::Role::Knowable'); |
2978
|
|
|
|
|
|
|
|
2979
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
2980
|
|
|
|
|
|
|
|
2981
|
|
|
|
|
|
|
# my $result = $check->result(Example->new); |
2982
|
|
|
|
|
|
|
|
2983
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_consumes) |
2984
|
|
|
|
|
|
|
|
2985
|
|
|
|
|
|
|
=back |
2986
|
|
|
|
|
|
|
|
2987
|
|
|
|
|
|
|
=cut |
2988
|
|
|
|
|
|
|
|
2989
|
|
|
|
|
|
|
=head2 defined |
2990
|
|
|
|
|
|
|
|
2991
|
|
|
|
|
|
|
defined(coderef @code) (Venus::Check) |
2992
|
|
|
|
|
|
|
|
2993
|
|
|
|
|
|
|
The defined method configures the object to accept any value that's not |
2994
|
|
|
|
|
|
|
undefined and returns the invocant. |
2995
|
|
|
|
|
|
|
|
2996
|
|
|
|
|
|
|
I> |
2997
|
|
|
|
|
|
|
|
2998
|
|
|
|
|
|
|
=over 4 |
2999
|
|
|
|
|
|
|
|
3000
|
|
|
|
|
|
|
=item defined example 1 |
3001
|
|
|
|
|
|
|
|
3002
|
|
|
|
|
|
|
# given: synopsis |
3003
|
|
|
|
|
|
|
|
3004
|
|
|
|
|
|
|
package main; |
3005
|
|
|
|
|
|
|
|
3006
|
|
|
|
|
|
|
$check = $check->defined; |
3007
|
|
|
|
|
|
|
|
3008
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3009
|
|
|
|
|
|
|
|
3010
|
|
|
|
|
|
|
# my $result = $check->eval(''); |
3011
|
|
|
|
|
|
|
|
3012
|
|
|
|
|
|
|
# true |
3013
|
|
|
|
|
|
|
|
3014
|
|
|
|
|
|
|
=back |
3015
|
|
|
|
|
|
|
|
3016
|
|
|
|
|
|
|
=over 4 |
3017
|
|
|
|
|
|
|
|
3018
|
|
|
|
|
|
|
=item defined example 2 |
3019
|
|
|
|
|
|
|
|
3020
|
|
|
|
|
|
|
# given: synopsis |
3021
|
|
|
|
|
|
|
|
3022
|
|
|
|
|
|
|
package main; |
3023
|
|
|
|
|
|
|
|
3024
|
|
|
|
|
|
|
$check = $check->defined; |
3025
|
|
|
|
|
|
|
|
3026
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3027
|
|
|
|
|
|
|
|
3028
|
|
|
|
|
|
|
# my $result = $check->eval(undef); |
3029
|
|
|
|
|
|
|
|
3030
|
|
|
|
|
|
|
# false |
3031
|
|
|
|
|
|
|
|
3032
|
|
|
|
|
|
|
=back |
3033
|
|
|
|
|
|
|
|
3034
|
|
|
|
|
|
|
=over 4 |
3035
|
|
|
|
|
|
|
|
3036
|
|
|
|
|
|
|
=item defined example 3 |
3037
|
|
|
|
|
|
|
|
3038
|
|
|
|
|
|
|
# given: synopsis |
3039
|
|
|
|
|
|
|
|
3040
|
|
|
|
|
|
|
package main; |
3041
|
|
|
|
|
|
|
|
3042
|
|
|
|
|
|
|
$check = $check->defined; |
3043
|
|
|
|
|
|
|
|
3044
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3045
|
|
|
|
|
|
|
|
3046
|
|
|
|
|
|
|
# my $result = $check->result(''); |
3047
|
|
|
|
|
|
|
|
3048
|
|
|
|
|
|
|
# '' |
3049
|
|
|
|
|
|
|
|
3050
|
|
|
|
|
|
|
=back |
3051
|
|
|
|
|
|
|
|
3052
|
|
|
|
|
|
|
=over 4 |
3053
|
|
|
|
|
|
|
|
3054
|
|
|
|
|
|
|
=item defined example 4 |
3055
|
|
|
|
|
|
|
|
3056
|
|
|
|
|
|
|
# given: synopsis |
3057
|
|
|
|
|
|
|
|
3058
|
|
|
|
|
|
|
package main; |
3059
|
|
|
|
|
|
|
|
3060
|
|
|
|
|
|
|
$check = $check->defined; |
3061
|
|
|
|
|
|
|
|
3062
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3063
|
|
|
|
|
|
|
|
3064
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
3065
|
|
|
|
|
|
|
|
3066
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_defined) |
3067
|
|
|
|
|
|
|
|
3068
|
|
|
|
|
|
|
=back |
3069
|
|
|
|
|
|
|
|
3070
|
|
|
|
|
|
|
=cut |
3071
|
|
|
|
|
|
|
|
3072
|
|
|
|
|
|
|
=head2 either |
3073
|
|
|
|
|
|
|
|
3074
|
|
|
|
|
|
|
either(string | within[arrayref, string] @args) (Venus::Check) |
3075
|
|
|
|
|
|
|
|
3076
|
|
|
|
|
|
|
The either method configures the object to accept "either" of the conditions |
3077
|
|
|
|
|
|
|
provided, which may be a string or arrayref representing a method call, and |
3078
|
|
|
|
|
|
|
returns the invocant. |
3079
|
|
|
|
|
|
|
|
3080
|
|
|
|
|
|
|
I> |
3081
|
|
|
|
|
|
|
|
3082
|
|
|
|
|
|
|
=over 4 |
3083
|
|
|
|
|
|
|
|
3084
|
|
|
|
|
|
|
=item either example 1 |
3085
|
|
|
|
|
|
|
|
3086
|
|
|
|
|
|
|
# given: synopsis |
3087
|
|
|
|
|
|
|
|
3088
|
|
|
|
|
|
|
package main; |
3089
|
|
|
|
|
|
|
|
3090
|
|
|
|
|
|
|
$check = $check->either('string', 'number'); |
3091
|
|
|
|
|
|
|
|
3092
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3093
|
|
|
|
|
|
|
|
3094
|
|
|
|
|
|
|
# my $result = $check->eval('hello'); |
3095
|
|
|
|
|
|
|
|
3096
|
|
|
|
|
|
|
# true |
3097
|
|
|
|
|
|
|
|
3098
|
|
|
|
|
|
|
=back |
3099
|
|
|
|
|
|
|
|
3100
|
|
|
|
|
|
|
=over 4 |
3101
|
|
|
|
|
|
|
|
3102
|
|
|
|
|
|
|
=item either example 2 |
3103
|
|
|
|
|
|
|
|
3104
|
|
|
|
|
|
|
# given: synopsis |
3105
|
|
|
|
|
|
|
|
3106
|
|
|
|
|
|
|
package main; |
3107
|
|
|
|
|
|
|
|
3108
|
|
|
|
|
|
|
$check = $check->either('string', 'number'); |
3109
|
|
|
|
|
|
|
|
3110
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3111
|
|
|
|
|
|
|
|
3112
|
|
|
|
|
|
|
# my $result = $check->eval(rand); |
3113
|
|
|
|
|
|
|
|
3114
|
|
|
|
|
|
|
# false |
3115
|
|
|
|
|
|
|
|
3116
|
|
|
|
|
|
|
=back |
3117
|
|
|
|
|
|
|
|
3118
|
|
|
|
|
|
|
=over 4 |
3119
|
|
|
|
|
|
|
|
3120
|
|
|
|
|
|
|
=item either example 3 |
3121
|
|
|
|
|
|
|
|
3122
|
|
|
|
|
|
|
# given: synopsis |
3123
|
|
|
|
|
|
|
|
3124
|
|
|
|
|
|
|
package main; |
3125
|
|
|
|
|
|
|
|
3126
|
|
|
|
|
|
|
$check = $check->either('string', 'number'); |
3127
|
|
|
|
|
|
|
|
3128
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3129
|
|
|
|
|
|
|
|
3130
|
|
|
|
|
|
|
# my $result = $check->result('hello'); |
3131
|
|
|
|
|
|
|
|
3132
|
|
|
|
|
|
|
# 'hello' |
3133
|
|
|
|
|
|
|
|
3134
|
|
|
|
|
|
|
=back |
3135
|
|
|
|
|
|
|
|
3136
|
|
|
|
|
|
|
=over 4 |
3137
|
|
|
|
|
|
|
|
3138
|
|
|
|
|
|
|
=item either example 4 |
3139
|
|
|
|
|
|
|
|
3140
|
|
|
|
|
|
|
# given: synopsis |
3141
|
|
|
|
|
|
|
|
3142
|
|
|
|
|
|
|
package main; |
3143
|
|
|
|
|
|
|
|
3144
|
|
|
|
|
|
|
$check = $check->either('string', 'number'); |
3145
|
|
|
|
|
|
|
|
3146
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3147
|
|
|
|
|
|
|
|
3148
|
|
|
|
|
|
|
# my $result = $check->result(rand); |
3149
|
|
|
|
|
|
|
|
3150
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_either) |
3151
|
|
|
|
|
|
|
|
3152
|
|
|
|
|
|
|
=back |
3153
|
|
|
|
|
|
|
|
3154
|
|
|
|
|
|
|
=cut |
3155
|
|
|
|
|
|
|
|
3156
|
|
|
|
|
|
|
=head2 enum |
3157
|
|
|
|
|
|
|
|
3158
|
|
|
|
|
|
|
enum(string @args) (Venus::Check) |
3159
|
|
|
|
|
|
|
|
3160
|
|
|
|
|
|
|
The enum method configures the object to accept any one of the provide options, |
3161
|
|
|
|
|
|
|
and returns the invocant. |
3162
|
|
|
|
|
|
|
|
3163
|
|
|
|
|
|
|
I> |
3164
|
|
|
|
|
|
|
|
3165
|
|
|
|
|
|
|
=over 4 |
3166
|
|
|
|
|
|
|
|
3167
|
|
|
|
|
|
|
=item enum example 1 |
3168
|
|
|
|
|
|
|
|
3169
|
|
|
|
|
|
|
# given: synopsis |
3170
|
|
|
|
|
|
|
|
3171
|
|
|
|
|
|
|
package main; |
3172
|
|
|
|
|
|
|
|
3173
|
|
|
|
|
|
|
$check = $check->enum('black', 'white', 'grey'); |
3174
|
|
|
|
|
|
|
|
3175
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3176
|
|
|
|
|
|
|
|
3177
|
|
|
|
|
|
|
# my $result = $check->eval('black'); |
3178
|
|
|
|
|
|
|
|
3179
|
|
|
|
|
|
|
# true |
3180
|
|
|
|
|
|
|
|
3181
|
|
|
|
|
|
|
=back |
3182
|
|
|
|
|
|
|
|
3183
|
|
|
|
|
|
|
=over 4 |
3184
|
|
|
|
|
|
|
|
3185
|
|
|
|
|
|
|
=item enum example 2 |
3186
|
|
|
|
|
|
|
|
3187
|
|
|
|
|
|
|
# given: synopsis |
3188
|
|
|
|
|
|
|
|
3189
|
|
|
|
|
|
|
package main; |
3190
|
|
|
|
|
|
|
|
3191
|
|
|
|
|
|
|
$check = $check->enum('black', 'white', 'grey'); |
3192
|
|
|
|
|
|
|
|
3193
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3194
|
|
|
|
|
|
|
|
3195
|
|
|
|
|
|
|
# my $result = $check->eval('purple'); |
3196
|
|
|
|
|
|
|
|
3197
|
|
|
|
|
|
|
# false |
3198
|
|
|
|
|
|
|
|
3199
|
|
|
|
|
|
|
=back |
3200
|
|
|
|
|
|
|
|
3201
|
|
|
|
|
|
|
=over 4 |
3202
|
|
|
|
|
|
|
|
3203
|
|
|
|
|
|
|
=item enum example 3 |
3204
|
|
|
|
|
|
|
|
3205
|
|
|
|
|
|
|
# given: synopsis |
3206
|
|
|
|
|
|
|
|
3207
|
|
|
|
|
|
|
package main; |
3208
|
|
|
|
|
|
|
|
3209
|
|
|
|
|
|
|
$check = $check->enum('black', 'white', 'grey'); |
3210
|
|
|
|
|
|
|
|
3211
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3212
|
|
|
|
|
|
|
|
3213
|
|
|
|
|
|
|
# my $result = $check->result('black'); |
3214
|
|
|
|
|
|
|
|
3215
|
|
|
|
|
|
|
# 'black' |
3216
|
|
|
|
|
|
|
|
3217
|
|
|
|
|
|
|
=back |
3218
|
|
|
|
|
|
|
|
3219
|
|
|
|
|
|
|
=over 4 |
3220
|
|
|
|
|
|
|
|
3221
|
|
|
|
|
|
|
=item enum example 4 |
3222
|
|
|
|
|
|
|
|
3223
|
|
|
|
|
|
|
# given: synopsis |
3224
|
|
|
|
|
|
|
|
3225
|
|
|
|
|
|
|
package main; |
3226
|
|
|
|
|
|
|
|
3227
|
|
|
|
|
|
|
$check = $check->enum('black', 'white', 'grey'); |
3228
|
|
|
|
|
|
|
|
3229
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3230
|
|
|
|
|
|
|
|
3231
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
3232
|
|
|
|
|
|
|
|
3233
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_defined) |
3234
|
|
|
|
|
|
|
|
3235
|
|
|
|
|
|
|
=back |
3236
|
|
|
|
|
|
|
|
3237
|
|
|
|
|
|
|
=over 4 |
3238
|
|
|
|
|
|
|
|
3239
|
|
|
|
|
|
|
=item enum example 5 |
3240
|
|
|
|
|
|
|
|
3241
|
|
|
|
|
|
|
# given: synopsis |
3242
|
|
|
|
|
|
|
|
3243
|
|
|
|
|
|
|
package main; |
3244
|
|
|
|
|
|
|
|
3245
|
|
|
|
|
|
|
$check = $check->enum('black', 'white', 'grey'); |
3246
|
|
|
|
|
|
|
|
3247
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3248
|
|
|
|
|
|
|
|
3249
|
|
|
|
|
|
|
# my $result = $check->result('purple'); |
3250
|
|
|
|
|
|
|
|
3251
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_enum) |
3252
|
|
|
|
|
|
|
|
3253
|
|
|
|
|
|
|
=back |
3254
|
|
|
|
|
|
|
|
3255
|
|
|
|
|
|
|
=cut |
3256
|
|
|
|
|
|
|
|
3257
|
|
|
|
|
|
|
=head2 eval |
3258
|
|
|
|
|
|
|
|
3259
|
|
|
|
|
|
|
eval(any $data) (any) |
3260
|
|
|
|
|
|
|
|
3261
|
|
|
|
|
|
|
The eval method returns true or false if the data provided passes the |
3262
|
|
|
|
|
|
|
registered conditions. |
3263
|
|
|
|
|
|
|
|
3264
|
|
|
|
|
|
|
I> |
3265
|
|
|
|
|
|
|
|
3266
|
|
|
|
|
|
|
=over 4 |
3267
|
|
|
|
|
|
|
|
3268
|
|
|
|
|
|
|
=item eval example 1 |
3269
|
|
|
|
|
|
|
|
3270
|
|
|
|
|
|
|
# given: synopsis |
3271
|
|
|
|
|
|
|
|
3272
|
|
|
|
|
|
|
package main; |
3273
|
|
|
|
|
|
|
|
3274
|
|
|
|
|
|
|
my $eval = $check->eval; |
3275
|
|
|
|
|
|
|
|
3276
|
|
|
|
|
|
|
# false |
3277
|
|
|
|
|
|
|
|
3278
|
|
|
|
|
|
|
=back |
3279
|
|
|
|
|
|
|
|
3280
|
|
|
|
|
|
|
=over 4 |
3281
|
|
|
|
|
|
|
|
3282
|
|
|
|
|
|
|
=item eval example 2 |
3283
|
|
|
|
|
|
|
|
3284
|
|
|
|
|
|
|
# given: synopsis |
3285
|
|
|
|
|
|
|
|
3286
|
|
|
|
|
|
|
package main; |
3287
|
|
|
|
|
|
|
|
3288
|
|
|
|
|
|
|
my $eval = $check->any->eval(''); |
3289
|
|
|
|
|
|
|
|
3290
|
|
|
|
|
|
|
# true |
3291
|
|
|
|
|
|
|
|
3292
|
|
|
|
|
|
|
=back |
3293
|
|
|
|
|
|
|
|
3294
|
|
|
|
|
|
|
=cut |
3295
|
|
|
|
|
|
|
|
3296
|
|
|
|
|
|
|
=head2 evaled |
3297
|
|
|
|
|
|
|
|
3298
|
|
|
|
|
|
|
evaled() (boolean) |
3299
|
|
|
|
|
|
|
|
3300
|
|
|
|
|
|
|
The evaled method returns true if L has previously been executed, and |
3301
|
|
|
|
|
|
|
false otherwise. |
3302
|
|
|
|
|
|
|
|
3303
|
|
|
|
|
|
|
I> |
3304
|
|
|
|
|
|
|
|
3305
|
|
|
|
|
|
|
=over 4 |
3306
|
|
|
|
|
|
|
|
3307
|
|
|
|
|
|
|
=item evaled example 1 |
3308
|
|
|
|
|
|
|
|
3309
|
|
|
|
|
|
|
# given: synopsis |
3310
|
|
|
|
|
|
|
|
3311
|
|
|
|
|
|
|
package main; |
3312
|
|
|
|
|
|
|
|
3313
|
|
|
|
|
|
|
my $evaled = $check->evaled; |
3314
|
|
|
|
|
|
|
|
3315
|
|
|
|
|
|
|
# false |
3316
|
|
|
|
|
|
|
|
3317
|
|
|
|
|
|
|
=back |
3318
|
|
|
|
|
|
|
|
3319
|
|
|
|
|
|
|
=over 4 |
3320
|
|
|
|
|
|
|
|
3321
|
|
|
|
|
|
|
=item evaled example 2 |
3322
|
|
|
|
|
|
|
|
3323
|
|
|
|
|
|
|
# given: synopsis |
3324
|
|
|
|
|
|
|
|
3325
|
|
|
|
|
|
|
package main; |
3326
|
|
|
|
|
|
|
|
3327
|
|
|
|
|
|
|
$check->any->eval; |
3328
|
|
|
|
|
|
|
|
3329
|
|
|
|
|
|
|
my $evaled = $check->evaled; |
3330
|
|
|
|
|
|
|
|
3331
|
|
|
|
|
|
|
# true |
3332
|
|
|
|
|
|
|
|
3333
|
|
|
|
|
|
|
=back |
3334
|
|
|
|
|
|
|
|
3335
|
|
|
|
|
|
|
=cut |
3336
|
|
|
|
|
|
|
|
3337
|
|
|
|
|
|
|
=head2 evaler |
3338
|
|
|
|
|
|
|
|
3339
|
|
|
|
|
|
|
evaler(any @args) (coderef) |
3340
|
|
|
|
|
|
|
|
3341
|
|
|
|
|
|
|
The evaler method returns a coderef which calls the L method with the |
3342
|
|
|
|
|
|
|
invocant when called. |
3343
|
|
|
|
|
|
|
|
3344
|
|
|
|
|
|
|
I> |
3345
|
|
|
|
|
|
|
|
3346
|
|
|
|
|
|
|
=over 4 |
3347
|
|
|
|
|
|
|
|
3348
|
|
|
|
|
|
|
=item evaler example 1 |
3349
|
|
|
|
|
|
|
|
3350
|
|
|
|
|
|
|
# given: synopsis |
3351
|
|
|
|
|
|
|
|
3352
|
|
|
|
|
|
|
package main; |
3353
|
|
|
|
|
|
|
|
3354
|
|
|
|
|
|
|
my $evaler = $check->evaler; |
3355
|
|
|
|
|
|
|
|
3356
|
|
|
|
|
|
|
# sub{...} |
3357
|
|
|
|
|
|
|
|
3358
|
|
|
|
|
|
|
# my $result = $evaler->(); |
3359
|
|
|
|
|
|
|
|
3360
|
|
|
|
|
|
|
# false |
3361
|
|
|
|
|
|
|
|
3362
|
|
|
|
|
|
|
=back |
3363
|
|
|
|
|
|
|
|
3364
|
|
|
|
|
|
|
=over 4 |
3365
|
|
|
|
|
|
|
|
3366
|
|
|
|
|
|
|
=item evaler example 2 |
3367
|
|
|
|
|
|
|
|
3368
|
|
|
|
|
|
|
# given: synopsis |
3369
|
|
|
|
|
|
|
|
3370
|
|
|
|
|
|
|
package main; |
3371
|
|
|
|
|
|
|
|
3372
|
|
|
|
|
|
|
my $evaler = $check->any->evaler; |
3373
|
|
|
|
|
|
|
|
3374
|
|
|
|
|
|
|
# sub{...} |
3375
|
|
|
|
|
|
|
|
3376
|
|
|
|
|
|
|
# my $result = $evaler->(); |
3377
|
|
|
|
|
|
|
|
3378
|
|
|
|
|
|
|
# true |
3379
|
|
|
|
|
|
|
|
3380
|
|
|
|
|
|
|
=back |
3381
|
|
|
|
|
|
|
|
3382
|
|
|
|
|
|
|
=cut |
3383
|
|
|
|
|
|
|
|
3384
|
|
|
|
|
|
|
=head2 fail |
3385
|
|
|
|
|
|
|
|
3386
|
|
|
|
|
|
|
fail(any $data, hashref $meta) (boolean) |
3387
|
|
|
|
|
|
|
|
3388
|
|
|
|
|
|
|
The fail method captures data related to a failure and returns false. |
3389
|
|
|
|
|
|
|
|
3390
|
|
|
|
|
|
|
I> |
3391
|
|
|
|
|
|
|
|
3392
|
|
|
|
|
|
|
=over 4 |
3393
|
|
|
|
|
|
|
|
3394
|
|
|
|
|
|
|
=item fail example 1 |
3395
|
|
|
|
|
|
|
|
3396
|
|
|
|
|
|
|
# given: synopsis |
3397
|
|
|
|
|
|
|
|
3398
|
|
|
|
|
|
|
package main; |
3399
|
|
|
|
|
|
|
|
3400
|
|
|
|
|
|
|
my $fail = $check->fail('...', { |
3401
|
|
|
|
|
|
|
from => 'caller', |
3402
|
|
|
|
|
|
|
}); |
3403
|
|
|
|
|
|
|
|
3404
|
|
|
|
|
|
|
# false |
3405
|
|
|
|
|
|
|
|
3406
|
|
|
|
|
|
|
=back |
3407
|
|
|
|
|
|
|
|
3408
|
|
|
|
|
|
|
=cut |
3409
|
|
|
|
|
|
|
|
3410
|
|
|
|
|
|
|
=head2 failed |
3411
|
|
|
|
|
|
|
|
3412
|
|
|
|
|
|
|
failed() (boolean) |
3413
|
|
|
|
|
|
|
|
3414
|
|
|
|
|
|
|
The failed method returns true if the result of the last operation was a |
3415
|
|
|
|
|
|
|
failure, otherwise returns false. |
3416
|
|
|
|
|
|
|
|
3417
|
|
|
|
|
|
|
I> |
3418
|
|
|
|
|
|
|
|
3419
|
|
|
|
|
|
|
=over 4 |
3420
|
|
|
|
|
|
|
|
3421
|
|
|
|
|
|
|
=item failed example 1 |
3422
|
|
|
|
|
|
|
|
3423
|
|
|
|
|
|
|
# given: synopsis |
3424
|
|
|
|
|
|
|
|
3425
|
|
|
|
|
|
|
package main; |
3426
|
|
|
|
|
|
|
|
3427
|
|
|
|
|
|
|
my $failed = $check->failed; |
3428
|
|
|
|
|
|
|
|
3429
|
|
|
|
|
|
|
# false |
3430
|
|
|
|
|
|
|
|
3431
|
|
|
|
|
|
|
=back |
3432
|
|
|
|
|
|
|
|
3433
|
|
|
|
|
|
|
=over 4 |
3434
|
|
|
|
|
|
|
|
3435
|
|
|
|
|
|
|
=item failed example 2 |
3436
|
|
|
|
|
|
|
|
3437
|
|
|
|
|
|
|
# given: synopsis |
3438
|
|
|
|
|
|
|
|
3439
|
|
|
|
|
|
|
package main; |
3440
|
|
|
|
|
|
|
|
3441
|
|
|
|
|
|
|
$check->string->eval(12345); |
3442
|
|
|
|
|
|
|
|
3443
|
|
|
|
|
|
|
my $failed = $check->failed; |
3444
|
|
|
|
|
|
|
|
3445
|
|
|
|
|
|
|
# true |
3446
|
|
|
|
|
|
|
|
3447
|
|
|
|
|
|
|
=back |
3448
|
|
|
|
|
|
|
|
3449
|
|
|
|
|
|
|
=over 4 |
3450
|
|
|
|
|
|
|
|
3451
|
|
|
|
|
|
|
=item failed example 3 |
3452
|
|
|
|
|
|
|
|
3453
|
|
|
|
|
|
|
# given: synopsis |
3454
|
|
|
|
|
|
|
|
3455
|
|
|
|
|
|
|
package main; |
3456
|
|
|
|
|
|
|
|
3457
|
|
|
|
|
|
|
$check->string->eval('hello'); |
3458
|
|
|
|
|
|
|
|
3459
|
|
|
|
|
|
|
my $failed = $check->failed; |
3460
|
|
|
|
|
|
|
|
3461
|
|
|
|
|
|
|
# false |
3462
|
|
|
|
|
|
|
|
3463
|
|
|
|
|
|
|
=back |
3464
|
|
|
|
|
|
|
|
3465
|
|
|
|
|
|
|
=cut |
3466
|
|
|
|
|
|
|
|
3467
|
|
|
|
|
|
|
=head2 float |
3468
|
|
|
|
|
|
|
|
3469
|
|
|
|
|
|
|
float(coderef @code) (Venus::Check) |
3470
|
|
|
|
|
|
|
|
3471
|
|
|
|
|
|
|
The float method configures the object to accept floating-point values and |
3472
|
|
|
|
|
|
|
returns the invocant. |
3473
|
|
|
|
|
|
|
|
3474
|
|
|
|
|
|
|
I> |
3475
|
|
|
|
|
|
|
|
3476
|
|
|
|
|
|
|
=over 4 |
3477
|
|
|
|
|
|
|
|
3478
|
|
|
|
|
|
|
=item float example 1 |
3479
|
|
|
|
|
|
|
|
3480
|
|
|
|
|
|
|
# given: synopsis |
3481
|
|
|
|
|
|
|
|
3482
|
|
|
|
|
|
|
package main; |
3483
|
|
|
|
|
|
|
|
3484
|
|
|
|
|
|
|
$check = $check->float; |
3485
|
|
|
|
|
|
|
|
3486
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3487
|
|
|
|
|
|
|
|
3488
|
|
|
|
|
|
|
# my $result = $check->eval(1.2345); |
3489
|
|
|
|
|
|
|
|
3490
|
|
|
|
|
|
|
# true |
3491
|
|
|
|
|
|
|
|
3492
|
|
|
|
|
|
|
=back |
3493
|
|
|
|
|
|
|
|
3494
|
|
|
|
|
|
|
=over 4 |
3495
|
|
|
|
|
|
|
|
3496
|
|
|
|
|
|
|
=item float example 2 |
3497
|
|
|
|
|
|
|
|
3498
|
|
|
|
|
|
|
# given: synopsis |
3499
|
|
|
|
|
|
|
|
3500
|
|
|
|
|
|
|
package main; |
3501
|
|
|
|
|
|
|
|
3502
|
|
|
|
|
|
|
$check = $check->float; |
3503
|
|
|
|
|
|
|
|
3504
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3505
|
|
|
|
|
|
|
|
3506
|
|
|
|
|
|
|
# my $result = $check->eval(12345); |
3507
|
|
|
|
|
|
|
|
3508
|
|
|
|
|
|
|
# false |
3509
|
|
|
|
|
|
|
|
3510
|
|
|
|
|
|
|
=back |
3511
|
|
|
|
|
|
|
|
3512
|
|
|
|
|
|
|
=over 4 |
3513
|
|
|
|
|
|
|
|
3514
|
|
|
|
|
|
|
=item float example 3 |
3515
|
|
|
|
|
|
|
|
3516
|
|
|
|
|
|
|
# given: synopsis |
3517
|
|
|
|
|
|
|
|
3518
|
|
|
|
|
|
|
package main; |
3519
|
|
|
|
|
|
|
|
3520
|
|
|
|
|
|
|
$check = $check->float; |
3521
|
|
|
|
|
|
|
|
3522
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3523
|
|
|
|
|
|
|
|
3524
|
|
|
|
|
|
|
# my $result = $check->result(1.2345); |
3525
|
|
|
|
|
|
|
|
3526
|
|
|
|
|
|
|
# 1.2345 |
3527
|
|
|
|
|
|
|
|
3528
|
|
|
|
|
|
|
=back |
3529
|
|
|
|
|
|
|
|
3530
|
|
|
|
|
|
|
=over 4 |
3531
|
|
|
|
|
|
|
|
3532
|
|
|
|
|
|
|
=item float example 4 |
3533
|
|
|
|
|
|
|
|
3534
|
|
|
|
|
|
|
# given: synopsis |
3535
|
|
|
|
|
|
|
|
3536
|
|
|
|
|
|
|
package main; |
3537
|
|
|
|
|
|
|
|
3538
|
|
|
|
|
|
|
$check = $check->float; |
3539
|
|
|
|
|
|
|
|
3540
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3541
|
|
|
|
|
|
|
|
3542
|
|
|
|
|
|
|
# my $result = $check->result(12345); |
3543
|
|
|
|
|
|
|
|
3544
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
3545
|
|
|
|
|
|
|
|
3546
|
|
|
|
|
|
|
=back |
3547
|
|
|
|
|
|
|
|
3548
|
|
|
|
|
|
|
=cut |
3549
|
|
|
|
|
|
|
|
3550
|
|
|
|
|
|
|
=head2 hash |
3551
|
|
|
|
|
|
|
|
3552
|
|
|
|
|
|
|
hash(coderef @code) (Venus::Check) |
3553
|
|
|
|
|
|
|
|
3554
|
|
|
|
|
|
|
The hash method configures the object to accept hash references and returns |
3555
|
|
|
|
|
|
|
the invocant. |
3556
|
|
|
|
|
|
|
|
3557
|
|
|
|
|
|
|
I> |
3558
|
|
|
|
|
|
|
|
3559
|
|
|
|
|
|
|
=over 4 |
3560
|
|
|
|
|
|
|
|
3561
|
|
|
|
|
|
|
=item hash example 1 |
3562
|
|
|
|
|
|
|
|
3563
|
|
|
|
|
|
|
# given: synopsis |
3564
|
|
|
|
|
|
|
|
3565
|
|
|
|
|
|
|
package main; |
3566
|
|
|
|
|
|
|
|
3567
|
|
|
|
|
|
|
$check = $check->hash; |
3568
|
|
|
|
|
|
|
|
3569
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3570
|
|
|
|
|
|
|
|
3571
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
3572
|
|
|
|
|
|
|
|
3573
|
|
|
|
|
|
|
# true |
3574
|
|
|
|
|
|
|
|
3575
|
|
|
|
|
|
|
=back |
3576
|
|
|
|
|
|
|
|
3577
|
|
|
|
|
|
|
=over 4 |
3578
|
|
|
|
|
|
|
|
3579
|
|
|
|
|
|
|
=item hash example 2 |
3580
|
|
|
|
|
|
|
|
3581
|
|
|
|
|
|
|
# given: synopsis |
3582
|
|
|
|
|
|
|
|
3583
|
|
|
|
|
|
|
package main; |
3584
|
|
|
|
|
|
|
|
3585
|
|
|
|
|
|
|
$check = $check->hash; |
3586
|
|
|
|
|
|
|
|
3587
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3588
|
|
|
|
|
|
|
|
3589
|
|
|
|
|
|
|
# my $result = $check->eval([]); |
3590
|
|
|
|
|
|
|
|
3591
|
|
|
|
|
|
|
# false |
3592
|
|
|
|
|
|
|
|
3593
|
|
|
|
|
|
|
=back |
3594
|
|
|
|
|
|
|
|
3595
|
|
|
|
|
|
|
=over 4 |
3596
|
|
|
|
|
|
|
|
3597
|
|
|
|
|
|
|
=item hash example 3 |
3598
|
|
|
|
|
|
|
|
3599
|
|
|
|
|
|
|
# given: synopsis |
3600
|
|
|
|
|
|
|
|
3601
|
|
|
|
|
|
|
package main; |
3602
|
|
|
|
|
|
|
|
3603
|
|
|
|
|
|
|
$check = $check->hash; |
3604
|
|
|
|
|
|
|
|
3605
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3606
|
|
|
|
|
|
|
|
3607
|
|
|
|
|
|
|
# my $result = $check->result({}); |
3608
|
|
|
|
|
|
|
|
3609
|
|
|
|
|
|
|
# {} |
3610
|
|
|
|
|
|
|
|
3611
|
|
|
|
|
|
|
=back |
3612
|
|
|
|
|
|
|
|
3613
|
|
|
|
|
|
|
=over 4 |
3614
|
|
|
|
|
|
|
|
3615
|
|
|
|
|
|
|
=item hash example 4 |
3616
|
|
|
|
|
|
|
|
3617
|
|
|
|
|
|
|
# given: synopsis |
3618
|
|
|
|
|
|
|
|
3619
|
|
|
|
|
|
|
package main; |
3620
|
|
|
|
|
|
|
|
3621
|
|
|
|
|
|
|
$check = $check->hash; |
3622
|
|
|
|
|
|
|
|
3623
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3624
|
|
|
|
|
|
|
|
3625
|
|
|
|
|
|
|
# my $result = $check->result([]); |
3626
|
|
|
|
|
|
|
|
3627
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
3628
|
|
|
|
|
|
|
|
3629
|
|
|
|
|
|
|
=back |
3630
|
|
|
|
|
|
|
|
3631
|
|
|
|
|
|
|
=cut |
3632
|
|
|
|
|
|
|
|
3633
|
|
|
|
|
|
|
=head2 hashkeys |
3634
|
|
|
|
|
|
|
|
3635
|
|
|
|
|
|
|
hashkeys(string | within[arrayref, string] @args) (Venus::Check) |
3636
|
|
|
|
|
|
|
|
3637
|
|
|
|
|
|
|
The hashkeys method configures the object to accept hash based values |
3638
|
|
|
|
|
|
|
containing the keys whose values' match the specified types, and returns the |
3639
|
|
|
|
|
|
|
invocant. |
3640
|
|
|
|
|
|
|
|
3641
|
|
|
|
|
|
|
I> |
3642
|
|
|
|
|
|
|
|
3643
|
|
|
|
|
|
|
=over 4 |
3644
|
|
|
|
|
|
|
|
3645
|
|
|
|
|
|
|
=item hashkeys example 1 |
3646
|
|
|
|
|
|
|
|
3647
|
|
|
|
|
|
|
# given: synopsis |
3648
|
|
|
|
|
|
|
|
3649
|
|
|
|
|
|
|
package main; |
3650
|
|
|
|
|
|
|
|
3651
|
|
|
|
|
|
|
$check = $check->hashkeys('rand', 'float'); |
3652
|
|
|
|
|
|
|
|
3653
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3654
|
|
|
|
|
|
|
|
3655
|
|
|
|
|
|
|
# my $result = $check->eval({rand => rand}); |
3656
|
|
|
|
|
|
|
|
3657
|
|
|
|
|
|
|
# true |
3658
|
|
|
|
|
|
|
|
3659
|
|
|
|
|
|
|
=back |
3660
|
|
|
|
|
|
|
|
3661
|
|
|
|
|
|
|
=over 4 |
3662
|
|
|
|
|
|
|
|
3663
|
|
|
|
|
|
|
=item hashkeys example 2 |
3664
|
|
|
|
|
|
|
|
3665
|
|
|
|
|
|
|
# given: synopsis |
3666
|
|
|
|
|
|
|
|
3667
|
|
|
|
|
|
|
package main; |
3668
|
|
|
|
|
|
|
|
3669
|
|
|
|
|
|
|
$check = $check->hashkeys('rand', 'float'); |
3670
|
|
|
|
|
|
|
|
3671
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3672
|
|
|
|
|
|
|
|
3673
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
3674
|
|
|
|
|
|
|
|
3675
|
|
|
|
|
|
|
# false |
3676
|
|
|
|
|
|
|
|
3677
|
|
|
|
|
|
|
=back |
3678
|
|
|
|
|
|
|
|
3679
|
|
|
|
|
|
|
=over 4 |
3680
|
|
|
|
|
|
|
|
3681
|
|
|
|
|
|
|
=item hashkeys example 3 |
3682
|
|
|
|
|
|
|
|
3683
|
|
|
|
|
|
|
# given: synopsis |
3684
|
|
|
|
|
|
|
|
3685
|
|
|
|
|
|
|
package main; |
3686
|
|
|
|
|
|
|
|
3687
|
|
|
|
|
|
|
$check = $check->hashkeys('rand', 'float'); |
3688
|
|
|
|
|
|
|
|
3689
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3690
|
|
|
|
|
|
|
|
3691
|
|
|
|
|
|
|
# my $result = $check->result({rand => rand}); |
3692
|
|
|
|
|
|
|
|
3693
|
|
|
|
|
|
|
# {rand => rand} |
3694
|
|
|
|
|
|
|
|
3695
|
|
|
|
|
|
|
=back |
3696
|
|
|
|
|
|
|
|
3697
|
|
|
|
|
|
|
=over 4 |
3698
|
|
|
|
|
|
|
|
3699
|
|
|
|
|
|
|
=item hashkeys example 4 |
3700
|
|
|
|
|
|
|
|
3701
|
|
|
|
|
|
|
# given: synopsis |
3702
|
|
|
|
|
|
|
|
3703
|
|
|
|
|
|
|
package main; |
3704
|
|
|
|
|
|
|
|
3705
|
|
|
|
|
|
|
$check = $check->hashkeys('rand', 'float'); |
3706
|
|
|
|
|
|
|
|
3707
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3708
|
|
|
|
|
|
|
|
3709
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
3710
|
|
|
|
|
|
|
|
3711
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_defined) |
3712
|
|
|
|
|
|
|
|
3713
|
|
|
|
|
|
|
=back |
3714
|
|
|
|
|
|
|
|
3715
|
|
|
|
|
|
|
=over 4 |
3716
|
|
|
|
|
|
|
|
3717
|
|
|
|
|
|
|
=item hashkeys example 5 |
3718
|
|
|
|
|
|
|
|
3719
|
|
|
|
|
|
|
# given: synopsis |
3720
|
|
|
|
|
|
|
|
3721
|
|
|
|
|
|
|
package main; |
3722
|
|
|
|
|
|
|
|
3723
|
|
|
|
|
|
|
$check = $check->hashkeys('rand', 'float'); |
3724
|
|
|
|
|
|
|
|
3725
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3726
|
|
|
|
|
|
|
|
3727
|
|
|
|
|
|
|
# my $result = $check->result([]); |
3728
|
|
|
|
|
|
|
|
3729
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_hashref) |
3730
|
|
|
|
|
|
|
|
3731
|
|
|
|
|
|
|
=back |
3732
|
|
|
|
|
|
|
|
3733
|
|
|
|
|
|
|
=over 4 |
3734
|
|
|
|
|
|
|
|
3735
|
|
|
|
|
|
|
=item hashkeys example 6 |
3736
|
|
|
|
|
|
|
|
3737
|
|
|
|
|
|
|
# given: synopsis |
3738
|
|
|
|
|
|
|
|
3739
|
|
|
|
|
|
|
package main; |
3740
|
|
|
|
|
|
|
|
3741
|
|
|
|
|
|
|
$check = $check->hashkeys('rand', 'float', 'name'); |
3742
|
|
|
|
|
|
|
|
3743
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3744
|
|
|
|
|
|
|
|
3745
|
|
|
|
|
|
|
# my $result = $check->result({rand => rand}); |
3746
|
|
|
|
|
|
|
|
3747
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_pairs) |
3748
|
|
|
|
|
|
|
|
3749
|
|
|
|
|
|
|
=back |
3750
|
|
|
|
|
|
|
|
3751
|
|
|
|
|
|
|
=over 4 |
3752
|
|
|
|
|
|
|
|
3753
|
|
|
|
|
|
|
=item hashkeys example 7 |
3754
|
|
|
|
|
|
|
|
3755
|
|
|
|
|
|
|
# given: synopsis |
3756
|
|
|
|
|
|
|
|
3757
|
|
|
|
|
|
|
package main; |
3758
|
|
|
|
|
|
|
|
3759
|
|
|
|
|
|
|
$check = $check->hashkeys('rand', 'float'); |
3760
|
|
|
|
|
|
|
|
3761
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3762
|
|
|
|
|
|
|
|
3763
|
|
|
|
|
|
|
# my $result = $check->result({rndm => rand}); |
3764
|
|
|
|
|
|
|
|
3765
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_missing) |
3766
|
|
|
|
|
|
|
|
3767
|
|
|
|
|
|
|
=back |
3768
|
|
|
|
|
|
|
|
3769
|
|
|
|
|
|
|
=cut |
3770
|
|
|
|
|
|
|
|
3771
|
|
|
|
|
|
|
=head2 hashref |
3772
|
|
|
|
|
|
|
|
3773
|
|
|
|
|
|
|
hashref(coderef @code) (Venus::Check) |
3774
|
|
|
|
|
|
|
|
3775
|
|
|
|
|
|
|
The hashref method configures the object to accept hash references and returns |
3776
|
|
|
|
|
|
|
the invocant. |
3777
|
|
|
|
|
|
|
|
3778
|
|
|
|
|
|
|
I> |
3779
|
|
|
|
|
|
|
|
3780
|
|
|
|
|
|
|
=over 4 |
3781
|
|
|
|
|
|
|
|
3782
|
|
|
|
|
|
|
=item hashref example 1 |
3783
|
|
|
|
|
|
|
|
3784
|
|
|
|
|
|
|
# given: synopsis |
3785
|
|
|
|
|
|
|
|
3786
|
|
|
|
|
|
|
package main; |
3787
|
|
|
|
|
|
|
|
3788
|
|
|
|
|
|
|
$check = $check->hashref; |
3789
|
|
|
|
|
|
|
|
3790
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3791
|
|
|
|
|
|
|
|
3792
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
3793
|
|
|
|
|
|
|
|
3794
|
|
|
|
|
|
|
# true |
3795
|
|
|
|
|
|
|
|
3796
|
|
|
|
|
|
|
=back |
3797
|
|
|
|
|
|
|
|
3798
|
|
|
|
|
|
|
=over 4 |
3799
|
|
|
|
|
|
|
|
3800
|
|
|
|
|
|
|
=item hashref example 2 |
3801
|
|
|
|
|
|
|
|
3802
|
|
|
|
|
|
|
# given: synopsis |
3803
|
|
|
|
|
|
|
|
3804
|
|
|
|
|
|
|
package main; |
3805
|
|
|
|
|
|
|
|
3806
|
|
|
|
|
|
|
$check = $check->hashref; |
3807
|
|
|
|
|
|
|
|
3808
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3809
|
|
|
|
|
|
|
|
3810
|
|
|
|
|
|
|
# my $result = $check->eval([]); |
3811
|
|
|
|
|
|
|
|
3812
|
|
|
|
|
|
|
# false |
3813
|
|
|
|
|
|
|
|
3814
|
|
|
|
|
|
|
=back |
3815
|
|
|
|
|
|
|
|
3816
|
|
|
|
|
|
|
=over 4 |
3817
|
|
|
|
|
|
|
|
3818
|
|
|
|
|
|
|
=item hashref example 3 |
3819
|
|
|
|
|
|
|
|
3820
|
|
|
|
|
|
|
# given: synopsis |
3821
|
|
|
|
|
|
|
|
3822
|
|
|
|
|
|
|
package main; |
3823
|
|
|
|
|
|
|
|
3824
|
|
|
|
|
|
|
$check = $check->hashref; |
3825
|
|
|
|
|
|
|
|
3826
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3827
|
|
|
|
|
|
|
|
3828
|
|
|
|
|
|
|
# my $result = $check->result({}); |
3829
|
|
|
|
|
|
|
|
3830
|
|
|
|
|
|
|
# {} |
3831
|
|
|
|
|
|
|
|
3832
|
|
|
|
|
|
|
=back |
3833
|
|
|
|
|
|
|
|
3834
|
|
|
|
|
|
|
=over 4 |
3835
|
|
|
|
|
|
|
|
3836
|
|
|
|
|
|
|
=item hashref example 4 |
3837
|
|
|
|
|
|
|
|
3838
|
|
|
|
|
|
|
# given: synopsis |
3839
|
|
|
|
|
|
|
|
3840
|
|
|
|
|
|
|
package main; |
3841
|
|
|
|
|
|
|
|
3842
|
|
|
|
|
|
|
$check = $check->hashref; |
3843
|
|
|
|
|
|
|
|
3844
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3845
|
|
|
|
|
|
|
|
3846
|
|
|
|
|
|
|
# my $result = $check->result([]); |
3847
|
|
|
|
|
|
|
|
3848
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
3849
|
|
|
|
|
|
|
|
3850
|
|
|
|
|
|
|
=back |
3851
|
|
|
|
|
|
|
|
3852
|
|
|
|
|
|
|
=cut |
3853
|
|
|
|
|
|
|
|
3854
|
|
|
|
|
|
|
=head2 identity |
3855
|
|
|
|
|
|
|
|
3856
|
|
|
|
|
|
|
identity(string $name) (Venus::Check) |
3857
|
|
|
|
|
|
|
|
3858
|
|
|
|
|
|
|
The identity method configures the object to accept objects of the type |
3859
|
|
|
|
|
|
|
specified as the argument, and returns the invocant. |
3860
|
|
|
|
|
|
|
|
3861
|
|
|
|
|
|
|
I> |
3862
|
|
|
|
|
|
|
|
3863
|
|
|
|
|
|
|
=over 4 |
3864
|
|
|
|
|
|
|
|
3865
|
|
|
|
|
|
|
=item identity example 1 |
3866
|
|
|
|
|
|
|
|
3867
|
|
|
|
|
|
|
# given: synopsis |
3868
|
|
|
|
|
|
|
|
3869
|
|
|
|
|
|
|
package main; |
3870
|
|
|
|
|
|
|
|
3871
|
|
|
|
|
|
|
$check = $check->identity('Venus::Check'); |
3872
|
|
|
|
|
|
|
|
3873
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3874
|
|
|
|
|
|
|
|
3875
|
|
|
|
|
|
|
# my $result = $check->eval(Venus::Check->new); |
3876
|
|
|
|
|
|
|
|
3877
|
|
|
|
|
|
|
# true |
3878
|
|
|
|
|
|
|
|
3879
|
|
|
|
|
|
|
=back |
3880
|
|
|
|
|
|
|
|
3881
|
|
|
|
|
|
|
=over 4 |
3882
|
|
|
|
|
|
|
|
3883
|
|
|
|
|
|
|
=item identity example 2 |
3884
|
|
|
|
|
|
|
|
3885
|
|
|
|
|
|
|
# given: synopsis |
3886
|
|
|
|
|
|
|
|
3887
|
|
|
|
|
|
|
package main; |
3888
|
|
|
|
|
|
|
|
3889
|
|
|
|
|
|
|
use Venus::Config; |
3890
|
|
|
|
|
|
|
|
3891
|
|
|
|
|
|
|
$check = $check->identity('Venus::Check'); |
3892
|
|
|
|
|
|
|
|
3893
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3894
|
|
|
|
|
|
|
|
3895
|
|
|
|
|
|
|
# my $result = $check->eval(Venus::Config->new); |
3896
|
|
|
|
|
|
|
|
3897
|
|
|
|
|
|
|
# false |
3898
|
|
|
|
|
|
|
|
3899
|
|
|
|
|
|
|
=back |
3900
|
|
|
|
|
|
|
|
3901
|
|
|
|
|
|
|
=over 4 |
3902
|
|
|
|
|
|
|
|
3903
|
|
|
|
|
|
|
=item identity example 3 |
3904
|
|
|
|
|
|
|
|
3905
|
|
|
|
|
|
|
# given: synopsis |
3906
|
|
|
|
|
|
|
|
3907
|
|
|
|
|
|
|
package main; |
3908
|
|
|
|
|
|
|
|
3909
|
|
|
|
|
|
|
$check = $check->identity('Venus::Check'); |
3910
|
|
|
|
|
|
|
|
3911
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3912
|
|
|
|
|
|
|
|
3913
|
|
|
|
|
|
|
# my $result = $check->result(Venus::Check->new); |
3914
|
|
|
|
|
|
|
|
3915
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3916
|
|
|
|
|
|
|
|
3917
|
|
|
|
|
|
|
=back |
3918
|
|
|
|
|
|
|
|
3919
|
|
|
|
|
|
|
=over 4 |
3920
|
|
|
|
|
|
|
|
3921
|
|
|
|
|
|
|
=item identity example 4 |
3922
|
|
|
|
|
|
|
|
3923
|
|
|
|
|
|
|
# given: synopsis |
3924
|
|
|
|
|
|
|
|
3925
|
|
|
|
|
|
|
package main; |
3926
|
|
|
|
|
|
|
|
3927
|
|
|
|
|
|
|
$check = $check->identity('Venus::Check'); |
3928
|
|
|
|
|
|
|
|
3929
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3930
|
|
|
|
|
|
|
|
3931
|
|
|
|
|
|
|
# my $result = $check->result({}); |
3932
|
|
|
|
|
|
|
|
3933
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
3934
|
|
|
|
|
|
|
|
3935
|
|
|
|
|
|
|
=back |
3936
|
|
|
|
|
|
|
|
3937
|
|
|
|
|
|
|
=over 4 |
3938
|
|
|
|
|
|
|
|
3939
|
|
|
|
|
|
|
=item identity example 5 |
3940
|
|
|
|
|
|
|
|
3941
|
|
|
|
|
|
|
# given: synopsis |
3942
|
|
|
|
|
|
|
|
3943
|
|
|
|
|
|
|
package main; |
3944
|
|
|
|
|
|
|
|
3945
|
|
|
|
|
|
|
use Venus::Config; |
3946
|
|
|
|
|
|
|
|
3947
|
|
|
|
|
|
|
$check = $check->identity('Venus::Check'); |
3948
|
|
|
|
|
|
|
|
3949
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3950
|
|
|
|
|
|
|
|
3951
|
|
|
|
|
|
|
# my $result = $check->result(Venus::Config->new); |
3952
|
|
|
|
|
|
|
|
3953
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_identity) |
3954
|
|
|
|
|
|
|
|
3955
|
|
|
|
|
|
|
=back |
3956
|
|
|
|
|
|
|
|
3957
|
|
|
|
|
|
|
=cut |
3958
|
|
|
|
|
|
|
|
3959
|
|
|
|
|
|
|
=head2 includes |
3960
|
|
|
|
|
|
|
|
3961
|
|
|
|
|
|
|
includes(string | within[arrayref, string] @args) (Venus::Check) |
3962
|
|
|
|
|
|
|
|
3963
|
|
|
|
|
|
|
The include method configures the object to accept "all" of the conditions |
3964
|
|
|
|
|
|
|
provided, which may be a string or arrayref representing a method call, and |
3965
|
|
|
|
|
|
|
returns the invocant. |
3966
|
|
|
|
|
|
|
|
3967
|
|
|
|
|
|
|
I> |
3968
|
|
|
|
|
|
|
|
3969
|
|
|
|
|
|
|
=over 4 |
3970
|
|
|
|
|
|
|
|
3971
|
|
|
|
|
|
|
=item includes example 1 |
3972
|
|
|
|
|
|
|
|
3973
|
|
|
|
|
|
|
# given: synopsis |
3974
|
|
|
|
|
|
|
|
3975
|
|
|
|
|
|
|
package main; |
3976
|
|
|
|
|
|
|
|
3977
|
|
|
|
|
|
|
$check = $check->includes('string', 'yesno'); |
3978
|
|
|
|
|
|
|
|
3979
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3980
|
|
|
|
|
|
|
|
3981
|
|
|
|
|
|
|
# my $result = $check->eval('yes'); |
3982
|
|
|
|
|
|
|
|
3983
|
|
|
|
|
|
|
# true |
3984
|
|
|
|
|
|
|
|
3985
|
|
|
|
|
|
|
=back |
3986
|
|
|
|
|
|
|
|
3987
|
|
|
|
|
|
|
=over 4 |
3988
|
|
|
|
|
|
|
|
3989
|
|
|
|
|
|
|
=item includes example 2 |
3990
|
|
|
|
|
|
|
|
3991
|
|
|
|
|
|
|
# given: synopsis |
3992
|
|
|
|
|
|
|
|
3993
|
|
|
|
|
|
|
package main; |
3994
|
|
|
|
|
|
|
|
3995
|
|
|
|
|
|
|
$check = $check->includes('string', 'yesno'); |
3996
|
|
|
|
|
|
|
|
3997
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
3998
|
|
|
|
|
|
|
|
3999
|
|
|
|
|
|
|
# my $result = $check->eval(0); |
4000
|
|
|
|
|
|
|
|
4001
|
|
|
|
|
|
|
# false |
4002
|
|
|
|
|
|
|
|
4003
|
|
|
|
|
|
|
=back |
4004
|
|
|
|
|
|
|
|
4005
|
|
|
|
|
|
|
=over 4 |
4006
|
|
|
|
|
|
|
|
4007
|
|
|
|
|
|
|
=item includes example 3 |
4008
|
|
|
|
|
|
|
|
4009
|
|
|
|
|
|
|
# given: synopsis |
4010
|
|
|
|
|
|
|
|
4011
|
|
|
|
|
|
|
package main; |
4012
|
|
|
|
|
|
|
|
4013
|
|
|
|
|
|
|
$check = $check->includes('string', 'yesno'); |
4014
|
|
|
|
|
|
|
|
4015
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4016
|
|
|
|
|
|
|
|
4017
|
|
|
|
|
|
|
# my $result = $check->result('Yes'); |
4018
|
|
|
|
|
|
|
|
4019
|
|
|
|
|
|
|
# 'Yes' |
4020
|
|
|
|
|
|
|
|
4021
|
|
|
|
|
|
|
=back |
4022
|
|
|
|
|
|
|
|
4023
|
|
|
|
|
|
|
=over 4 |
4024
|
|
|
|
|
|
|
|
4025
|
|
|
|
|
|
|
=item includes example 4 |
4026
|
|
|
|
|
|
|
|
4027
|
|
|
|
|
|
|
# given: synopsis |
4028
|
|
|
|
|
|
|
|
4029
|
|
|
|
|
|
|
package main; |
4030
|
|
|
|
|
|
|
|
4031
|
|
|
|
|
|
|
$check = $check->includes('string', 'yesno'); |
4032
|
|
|
|
|
|
|
|
4033
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4034
|
|
|
|
|
|
|
|
4035
|
|
|
|
|
|
|
# my $result = $check->result(1); |
4036
|
|
|
|
|
|
|
|
4037
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_includes) |
4038
|
|
|
|
|
|
|
|
4039
|
|
|
|
|
|
|
=back |
4040
|
|
|
|
|
|
|
|
4041
|
|
|
|
|
|
|
=cut |
4042
|
|
|
|
|
|
|
|
4043
|
|
|
|
|
|
|
=head2 inherits |
4044
|
|
|
|
|
|
|
|
4045
|
|
|
|
|
|
|
inherits(string $base) (Venus::Check) |
4046
|
|
|
|
|
|
|
|
4047
|
|
|
|
|
|
|
The inherits method configures the object to accept objects of the type |
4048
|
|
|
|
|
|
|
specified as the argument, and returns the invocant. This method is a proxy for |
4049
|
|
|
|
|
|
|
the L method. |
4050
|
|
|
|
|
|
|
|
4051
|
|
|
|
|
|
|
I> |
4052
|
|
|
|
|
|
|
|
4053
|
|
|
|
|
|
|
=over 4 |
4054
|
|
|
|
|
|
|
|
4055
|
|
|
|
|
|
|
=item inherits example 1 |
4056
|
|
|
|
|
|
|
|
4057
|
|
|
|
|
|
|
# given: synopsis |
4058
|
|
|
|
|
|
|
|
4059
|
|
|
|
|
|
|
package main; |
4060
|
|
|
|
|
|
|
|
4061
|
|
|
|
|
|
|
$check = $check->inherits('Venus::Kind::Utility'); |
4062
|
|
|
|
|
|
|
|
4063
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4064
|
|
|
|
|
|
|
|
4065
|
|
|
|
|
|
|
# my $result = $check->eval(Venus::Check->new); |
4066
|
|
|
|
|
|
|
|
4067
|
|
|
|
|
|
|
# true |
4068
|
|
|
|
|
|
|
|
4069
|
|
|
|
|
|
|
=back |
4070
|
|
|
|
|
|
|
|
4071
|
|
|
|
|
|
|
=over 4 |
4072
|
|
|
|
|
|
|
|
4073
|
|
|
|
|
|
|
=item inherits example 2 |
4074
|
|
|
|
|
|
|
|
4075
|
|
|
|
|
|
|
# given: synopsis |
4076
|
|
|
|
|
|
|
|
4077
|
|
|
|
|
|
|
package main; |
4078
|
|
|
|
|
|
|
|
4079
|
|
|
|
|
|
|
$check = $check->inherits('Venus::Kind::Value'); |
4080
|
|
|
|
|
|
|
|
4081
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4082
|
|
|
|
|
|
|
|
4083
|
|
|
|
|
|
|
# my $result = $check->eval(Venus::Check->new); |
4084
|
|
|
|
|
|
|
|
4085
|
|
|
|
|
|
|
# false |
4086
|
|
|
|
|
|
|
|
4087
|
|
|
|
|
|
|
=back |
4088
|
|
|
|
|
|
|
|
4089
|
|
|
|
|
|
|
=over 4 |
4090
|
|
|
|
|
|
|
|
4091
|
|
|
|
|
|
|
=item inherits example 3 |
4092
|
|
|
|
|
|
|
|
4093
|
|
|
|
|
|
|
# given: synopsis |
4094
|
|
|
|
|
|
|
|
4095
|
|
|
|
|
|
|
package main; |
4096
|
|
|
|
|
|
|
|
4097
|
|
|
|
|
|
|
$check = $check->inherits('Venus::Kind::Utility'); |
4098
|
|
|
|
|
|
|
|
4099
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4100
|
|
|
|
|
|
|
|
4101
|
|
|
|
|
|
|
# my $result = $check->result(Venus::Check->new); |
4102
|
|
|
|
|
|
|
|
4103
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4104
|
|
|
|
|
|
|
|
4105
|
|
|
|
|
|
|
=back |
4106
|
|
|
|
|
|
|
|
4107
|
|
|
|
|
|
|
=over 4 |
4108
|
|
|
|
|
|
|
|
4109
|
|
|
|
|
|
|
=item inherits example 4 |
4110
|
|
|
|
|
|
|
|
4111
|
|
|
|
|
|
|
# given: synopsis |
4112
|
|
|
|
|
|
|
|
4113
|
|
|
|
|
|
|
package main; |
4114
|
|
|
|
|
|
|
|
4115
|
|
|
|
|
|
|
$check = $check->inherits('Venus::Kind::Value'); |
4116
|
|
|
|
|
|
|
|
4117
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4118
|
|
|
|
|
|
|
|
4119
|
|
|
|
|
|
|
# my $result = $check->result({}); |
4120
|
|
|
|
|
|
|
|
4121
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
4122
|
|
|
|
|
|
|
|
4123
|
|
|
|
|
|
|
=back |
4124
|
|
|
|
|
|
|
|
4125
|
|
|
|
|
|
|
=over 4 |
4126
|
|
|
|
|
|
|
|
4127
|
|
|
|
|
|
|
=item inherits example 5 |
4128
|
|
|
|
|
|
|
|
4129
|
|
|
|
|
|
|
# given: synopsis |
4130
|
|
|
|
|
|
|
|
4131
|
|
|
|
|
|
|
package main; |
4132
|
|
|
|
|
|
|
|
4133
|
|
|
|
|
|
|
$check = $check->inherits('Venus::Kind::Value'); |
4134
|
|
|
|
|
|
|
|
4135
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4136
|
|
|
|
|
|
|
|
4137
|
|
|
|
|
|
|
# my $result = $check->result(Venus::Check->new); |
4138
|
|
|
|
|
|
|
|
4139
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_inherits) |
4140
|
|
|
|
|
|
|
|
4141
|
|
|
|
|
|
|
=back |
4142
|
|
|
|
|
|
|
|
4143
|
|
|
|
|
|
|
=cut |
4144
|
|
|
|
|
|
|
|
4145
|
|
|
|
|
|
|
=head2 integrates |
4146
|
|
|
|
|
|
|
|
4147
|
|
|
|
|
|
|
integrates(string $role) (Venus::Check) |
4148
|
|
|
|
|
|
|
|
4149
|
|
|
|
|
|
|
The integrates method configures the object to accept objects that support the |
4150
|
|
|
|
|
|
|
C<"does"> behavior and consumes the "role" specified as the argument, and |
4151
|
|
|
|
|
|
|
returns the invocant. |
4152
|
|
|
|
|
|
|
|
4153
|
|
|
|
|
|
|
I> |
4154
|
|
|
|
|
|
|
|
4155
|
|
|
|
|
|
|
=over 4 |
4156
|
|
|
|
|
|
|
|
4157
|
|
|
|
|
|
|
=item integrates example 1 |
4158
|
|
|
|
|
|
|
|
4159
|
|
|
|
|
|
|
# given: synopsis |
4160
|
|
|
|
|
|
|
|
4161
|
|
|
|
|
|
|
package main; |
4162
|
|
|
|
|
|
|
|
4163
|
|
|
|
|
|
|
$check = $check->integrates('Venus::Role::Throwable'); |
4164
|
|
|
|
|
|
|
|
4165
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4166
|
|
|
|
|
|
|
|
4167
|
|
|
|
|
|
|
# my $result = $check->eval(Venus::Check->new); |
4168
|
|
|
|
|
|
|
|
4169
|
|
|
|
|
|
|
# true |
4170
|
|
|
|
|
|
|
|
4171
|
|
|
|
|
|
|
=back |
4172
|
|
|
|
|
|
|
|
4173
|
|
|
|
|
|
|
=over 4 |
4174
|
|
|
|
|
|
|
|
4175
|
|
|
|
|
|
|
=item integrates example 2 |
4176
|
|
|
|
|
|
|
|
4177
|
|
|
|
|
|
|
# given: synopsis |
4178
|
|
|
|
|
|
|
|
4179
|
|
|
|
|
|
|
package main; |
4180
|
|
|
|
|
|
|
|
4181
|
|
|
|
|
|
|
$check = $check->integrates('Venus::Role::Knowable'); |
4182
|
|
|
|
|
|
|
|
4183
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4184
|
|
|
|
|
|
|
|
4185
|
|
|
|
|
|
|
# my $result = $check->eval(Venus::Check->new); |
4186
|
|
|
|
|
|
|
|
4187
|
|
|
|
|
|
|
# false |
4188
|
|
|
|
|
|
|
|
4189
|
|
|
|
|
|
|
=back |
4190
|
|
|
|
|
|
|
|
4191
|
|
|
|
|
|
|
=over 4 |
4192
|
|
|
|
|
|
|
|
4193
|
|
|
|
|
|
|
=item integrates example 3 |
4194
|
|
|
|
|
|
|
|
4195
|
|
|
|
|
|
|
# given: synopsis |
4196
|
|
|
|
|
|
|
|
4197
|
|
|
|
|
|
|
package main; |
4198
|
|
|
|
|
|
|
|
4199
|
|
|
|
|
|
|
$check = $check->integrates('Venus::Role::Throwable'); |
4200
|
|
|
|
|
|
|
|
4201
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4202
|
|
|
|
|
|
|
|
4203
|
|
|
|
|
|
|
# my $result = $check->result(Venus::Check->new); |
4204
|
|
|
|
|
|
|
|
4205
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4206
|
|
|
|
|
|
|
|
4207
|
|
|
|
|
|
|
=back |
4208
|
|
|
|
|
|
|
|
4209
|
|
|
|
|
|
|
=over 4 |
4210
|
|
|
|
|
|
|
|
4211
|
|
|
|
|
|
|
=item integrates example 4 |
4212
|
|
|
|
|
|
|
|
4213
|
|
|
|
|
|
|
# given: synopsis |
4214
|
|
|
|
|
|
|
|
4215
|
|
|
|
|
|
|
package main; |
4216
|
|
|
|
|
|
|
|
4217
|
|
|
|
|
|
|
$check = $check->integrates('Venus::Role::Knowable'); |
4218
|
|
|
|
|
|
|
|
4219
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4220
|
|
|
|
|
|
|
|
4221
|
|
|
|
|
|
|
# my $result = $check->result({}); |
4222
|
|
|
|
|
|
|
|
4223
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
4224
|
|
|
|
|
|
|
|
4225
|
|
|
|
|
|
|
=back |
4226
|
|
|
|
|
|
|
|
4227
|
|
|
|
|
|
|
=over 4 |
4228
|
|
|
|
|
|
|
|
4229
|
|
|
|
|
|
|
=item integrates example 5 |
4230
|
|
|
|
|
|
|
|
4231
|
|
|
|
|
|
|
# given: synopsis |
4232
|
|
|
|
|
|
|
|
4233
|
|
|
|
|
|
|
package main; |
4234
|
|
|
|
|
|
|
|
4235
|
|
|
|
|
|
|
$check = $check->integrates('Venus::Role::Knowable'); |
4236
|
|
|
|
|
|
|
|
4237
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4238
|
|
|
|
|
|
|
|
4239
|
|
|
|
|
|
|
# my $result = $check->result(Venus::Check->new); |
4240
|
|
|
|
|
|
|
|
4241
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_consumes) |
4242
|
|
|
|
|
|
|
|
4243
|
|
|
|
|
|
|
=back |
4244
|
|
|
|
|
|
|
|
4245
|
|
|
|
|
|
|
=cut |
4246
|
|
|
|
|
|
|
|
4247
|
|
|
|
|
|
|
=head2 maybe |
4248
|
|
|
|
|
|
|
|
4249
|
|
|
|
|
|
|
maybe(string | within[arrayref, string] @args) (Venus::Check) |
4250
|
|
|
|
|
|
|
|
4251
|
|
|
|
|
|
|
The maybe method configures the object to accept the type provided as an |
4252
|
|
|
|
|
|
|
argument, or undef, and returns the invocant. |
4253
|
|
|
|
|
|
|
|
4254
|
|
|
|
|
|
|
I> |
4255
|
|
|
|
|
|
|
|
4256
|
|
|
|
|
|
|
=over 4 |
4257
|
|
|
|
|
|
|
|
4258
|
|
|
|
|
|
|
=item maybe example 1 |
4259
|
|
|
|
|
|
|
|
4260
|
|
|
|
|
|
|
# given: synopsis |
4261
|
|
|
|
|
|
|
|
4262
|
|
|
|
|
|
|
package main; |
4263
|
|
|
|
|
|
|
|
4264
|
|
|
|
|
|
|
$check = $check->maybe('string'); |
4265
|
|
|
|
|
|
|
|
4266
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4267
|
|
|
|
|
|
|
|
4268
|
|
|
|
|
|
|
# my $result = $check->eval(''); |
4269
|
|
|
|
|
|
|
|
4270
|
|
|
|
|
|
|
# true |
4271
|
|
|
|
|
|
|
|
4272
|
|
|
|
|
|
|
=back |
4273
|
|
|
|
|
|
|
|
4274
|
|
|
|
|
|
|
=over 4 |
4275
|
|
|
|
|
|
|
|
4276
|
|
|
|
|
|
|
=item maybe example 2 |
4277
|
|
|
|
|
|
|
|
4278
|
|
|
|
|
|
|
# given: synopsis |
4279
|
|
|
|
|
|
|
|
4280
|
|
|
|
|
|
|
package main; |
4281
|
|
|
|
|
|
|
|
4282
|
|
|
|
|
|
|
$check = $check->maybe('string'); |
4283
|
|
|
|
|
|
|
|
4284
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4285
|
|
|
|
|
|
|
|
4286
|
|
|
|
|
|
|
# my $result = $check->eval([]); |
4287
|
|
|
|
|
|
|
|
4288
|
|
|
|
|
|
|
# false |
4289
|
|
|
|
|
|
|
|
4290
|
|
|
|
|
|
|
=back |
4291
|
|
|
|
|
|
|
|
4292
|
|
|
|
|
|
|
=over 4 |
4293
|
|
|
|
|
|
|
|
4294
|
|
|
|
|
|
|
=item maybe example 3 |
4295
|
|
|
|
|
|
|
|
4296
|
|
|
|
|
|
|
# given: synopsis |
4297
|
|
|
|
|
|
|
|
4298
|
|
|
|
|
|
|
package main; |
4299
|
|
|
|
|
|
|
|
4300
|
|
|
|
|
|
|
$check = $check->maybe('string'); |
4301
|
|
|
|
|
|
|
|
4302
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4303
|
|
|
|
|
|
|
|
4304
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
4305
|
|
|
|
|
|
|
|
4306
|
|
|
|
|
|
|
# undef |
4307
|
|
|
|
|
|
|
|
4308
|
|
|
|
|
|
|
=back |
4309
|
|
|
|
|
|
|
|
4310
|
|
|
|
|
|
|
=over 4 |
4311
|
|
|
|
|
|
|
|
4312
|
|
|
|
|
|
|
=item maybe example 4 |
4313
|
|
|
|
|
|
|
|
4314
|
|
|
|
|
|
|
# given: synopsis |
4315
|
|
|
|
|
|
|
|
4316
|
|
|
|
|
|
|
package main; |
4317
|
|
|
|
|
|
|
|
4318
|
|
|
|
|
|
|
$check = $check->maybe('string'); |
4319
|
|
|
|
|
|
|
|
4320
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4321
|
|
|
|
|
|
|
|
4322
|
|
|
|
|
|
|
# my $result = $check->result(0); |
4323
|
|
|
|
|
|
|
|
4324
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_either) |
4325
|
|
|
|
|
|
|
|
4326
|
|
|
|
|
|
|
=back |
4327
|
|
|
|
|
|
|
|
4328
|
|
|
|
|
|
|
=over 4 |
4329
|
|
|
|
|
|
|
|
4330
|
|
|
|
|
|
|
=item maybe example 5 |
4331
|
|
|
|
|
|
|
|
4332
|
|
|
|
|
|
|
# given: synopsis |
4333
|
|
|
|
|
|
|
|
4334
|
|
|
|
|
|
|
package main; |
4335
|
|
|
|
|
|
|
|
4336
|
|
|
|
|
|
|
$check = $check->maybe('string'); |
4337
|
|
|
|
|
|
|
|
4338
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4339
|
|
|
|
|
|
|
|
4340
|
|
|
|
|
|
|
# my $result = $check->result([]); |
4341
|
|
|
|
|
|
|
|
4342
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_either) |
4343
|
|
|
|
|
|
|
|
4344
|
|
|
|
|
|
|
=back |
4345
|
|
|
|
|
|
|
|
4346
|
|
|
|
|
|
|
=cut |
4347
|
|
|
|
|
|
|
|
4348
|
|
|
|
|
|
|
=head2 number |
4349
|
|
|
|
|
|
|
|
4350
|
|
|
|
|
|
|
number(coderef @code) (Venus::Check) |
4351
|
|
|
|
|
|
|
|
4352
|
|
|
|
|
|
|
The number method configures the object to accept numberic values and returns |
4353
|
|
|
|
|
|
|
the invocant. |
4354
|
|
|
|
|
|
|
|
4355
|
|
|
|
|
|
|
I> |
4356
|
|
|
|
|
|
|
|
4357
|
|
|
|
|
|
|
=over 4 |
4358
|
|
|
|
|
|
|
|
4359
|
|
|
|
|
|
|
=item number example 1 |
4360
|
|
|
|
|
|
|
|
4361
|
|
|
|
|
|
|
# given: synopsis |
4362
|
|
|
|
|
|
|
|
4363
|
|
|
|
|
|
|
package main; |
4364
|
|
|
|
|
|
|
|
4365
|
|
|
|
|
|
|
$check = $check->number; |
4366
|
|
|
|
|
|
|
|
4367
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4368
|
|
|
|
|
|
|
|
4369
|
|
|
|
|
|
|
# my $result = $check->eval(1234); |
4370
|
|
|
|
|
|
|
|
4371
|
|
|
|
|
|
|
# true |
4372
|
|
|
|
|
|
|
|
4373
|
|
|
|
|
|
|
=back |
4374
|
|
|
|
|
|
|
|
4375
|
|
|
|
|
|
|
=over 4 |
4376
|
|
|
|
|
|
|
|
4377
|
|
|
|
|
|
|
=item number example 2 |
4378
|
|
|
|
|
|
|
|
4379
|
|
|
|
|
|
|
# given: synopsis |
4380
|
|
|
|
|
|
|
|
4381
|
|
|
|
|
|
|
package main; |
4382
|
|
|
|
|
|
|
|
4383
|
|
|
|
|
|
|
$check = $check->number; |
4384
|
|
|
|
|
|
|
|
4385
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4386
|
|
|
|
|
|
|
|
4387
|
|
|
|
|
|
|
# my $result = $check->eval(1.234); |
4388
|
|
|
|
|
|
|
|
4389
|
|
|
|
|
|
|
# false |
4390
|
|
|
|
|
|
|
|
4391
|
|
|
|
|
|
|
=back |
4392
|
|
|
|
|
|
|
|
4393
|
|
|
|
|
|
|
=over 4 |
4394
|
|
|
|
|
|
|
|
4395
|
|
|
|
|
|
|
=item number example 3 |
4396
|
|
|
|
|
|
|
|
4397
|
|
|
|
|
|
|
# given: synopsis |
4398
|
|
|
|
|
|
|
|
4399
|
|
|
|
|
|
|
package main; |
4400
|
|
|
|
|
|
|
|
4401
|
|
|
|
|
|
|
$check = $check->number; |
4402
|
|
|
|
|
|
|
|
4403
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4404
|
|
|
|
|
|
|
|
4405
|
|
|
|
|
|
|
# my $result = $check->result(1234); |
4406
|
|
|
|
|
|
|
|
4407
|
|
|
|
|
|
|
# 1234 |
4408
|
|
|
|
|
|
|
|
4409
|
|
|
|
|
|
|
=back |
4410
|
|
|
|
|
|
|
|
4411
|
|
|
|
|
|
|
=over 4 |
4412
|
|
|
|
|
|
|
|
4413
|
|
|
|
|
|
|
=item number example 4 |
4414
|
|
|
|
|
|
|
|
4415
|
|
|
|
|
|
|
# given: synopsis |
4416
|
|
|
|
|
|
|
|
4417
|
|
|
|
|
|
|
package main; |
4418
|
|
|
|
|
|
|
|
4419
|
|
|
|
|
|
|
$check = $check->number; |
4420
|
|
|
|
|
|
|
|
4421
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4422
|
|
|
|
|
|
|
|
4423
|
|
|
|
|
|
|
# my $result = $check->result(1.234); |
4424
|
|
|
|
|
|
|
|
4425
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
4426
|
|
|
|
|
|
|
|
4427
|
|
|
|
|
|
|
=back |
4428
|
|
|
|
|
|
|
|
4429
|
|
|
|
|
|
|
=cut |
4430
|
|
|
|
|
|
|
|
4431
|
|
|
|
|
|
|
=head2 object |
4432
|
|
|
|
|
|
|
|
4433
|
|
|
|
|
|
|
object(coderef @code) (Venus::Check) |
4434
|
|
|
|
|
|
|
|
4435
|
|
|
|
|
|
|
The object method configures the object to accept objects and returns the |
4436
|
|
|
|
|
|
|
invocant. |
4437
|
|
|
|
|
|
|
|
4438
|
|
|
|
|
|
|
I> |
4439
|
|
|
|
|
|
|
|
4440
|
|
|
|
|
|
|
=over 4 |
4441
|
|
|
|
|
|
|
|
4442
|
|
|
|
|
|
|
=item object example 1 |
4443
|
|
|
|
|
|
|
|
4444
|
|
|
|
|
|
|
# given: synopsis |
4445
|
|
|
|
|
|
|
|
4446
|
|
|
|
|
|
|
package main; |
4447
|
|
|
|
|
|
|
|
4448
|
|
|
|
|
|
|
$check = $check->object; |
4449
|
|
|
|
|
|
|
|
4450
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4451
|
|
|
|
|
|
|
|
4452
|
|
|
|
|
|
|
# my $result = $check->eval(bless{}); |
4453
|
|
|
|
|
|
|
|
4454
|
|
|
|
|
|
|
# true |
4455
|
|
|
|
|
|
|
|
4456
|
|
|
|
|
|
|
=back |
4457
|
|
|
|
|
|
|
|
4458
|
|
|
|
|
|
|
=over 4 |
4459
|
|
|
|
|
|
|
|
4460
|
|
|
|
|
|
|
=item object example 2 |
4461
|
|
|
|
|
|
|
|
4462
|
|
|
|
|
|
|
# given: synopsis |
4463
|
|
|
|
|
|
|
|
4464
|
|
|
|
|
|
|
package main; |
4465
|
|
|
|
|
|
|
|
4466
|
|
|
|
|
|
|
$check = $check->object; |
4467
|
|
|
|
|
|
|
|
4468
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4469
|
|
|
|
|
|
|
|
4470
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
4471
|
|
|
|
|
|
|
|
4472
|
|
|
|
|
|
|
# false |
4473
|
|
|
|
|
|
|
|
4474
|
|
|
|
|
|
|
=back |
4475
|
|
|
|
|
|
|
|
4476
|
|
|
|
|
|
|
=over 4 |
4477
|
|
|
|
|
|
|
|
4478
|
|
|
|
|
|
|
=item object example 3 |
4479
|
|
|
|
|
|
|
|
4480
|
|
|
|
|
|
|
# given: synopsis |
4481
|
|
|
|
|
|
|
|
4482
|
|
|
|
|
|
|
package main; |
4483
|
|
|
|
|
|
|
|
4484
|
|
|
|
|
|
|
$check = $check->object; |
4485
|
|
|
|
|
|
|
|
4486
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4487
|
|
|
|
|
|
|
|
4488
|
|
|
|
|
|
|
# my $result = $check->result(bless{}); |
4489
|
|
|
|
|
|
|
|
4490
|
|
|
|
|
|
|
# bless{} |
4491
|
|
|
|
|
|
|
|
4492
|
|
|
|
|
|
|
=back |
4493
|
|
|
|
|
|
|
|
4494
|
|
|
|
|
|
|
=over 4 |
4495
|
|
|
|
|
|
|
|
4496
|
|
|
|
|
|
|
=item object example 4 |
4497
|
|
|
|
|
|
|
|
4498
|
|
|
|
|
|
|
# given: synopsis |
4499
|
|
|
|
|
|
|
|
4500
|
|
|
|
|
|
|
package main; |
4501
|
|
|
|
|
|
|
|
4502
|
|
|
|
|
|
|
$check = $check->object; |
4503
|
|
|
|
|
|
|
|
4504
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4505
|
|
|
|
|
|
|
|
4506
|
|
|
|
|
|
|
# my $result = $check->result({}); |
4507
|
|
|
|
|
|
|
|
4508
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
4509
|
|
|
|
|
|
|
|
4510
|
|
|
|
|
|
|
=back |
4511
|
|
|
|
|
|
|
|
4512
|
|
|
|
|
|
|
=cut |
4513
|
|
|
|
|
|
|
|
4514
|
|
|
|
|
|
|
=head2 package |
4515
|
|
|
|
|
|
|
|
4516
|
|
|
|
|
|
|
package(coderef @code) (Venus::Check) |
4517
|
|
|
|
|
|
|
|
4518
|
|
|
|
|
|
|
The package method configures the object to accept package names (which are |
4519
|
|
|
|
|
|
|
loaded) and returns the invocant. |
4520
|
|
|
|
|
|
|
|
4521
|
|
|
|
|
|
|
I> |
4522
|
|
|
|
|
|
|
|
4523
|
|
|
|
|
|
|
=over 4 |
4524
|
|
|
|
|
|
|
|
4525
|
|
|
|
|
|
|
=item package example 1 |
4526
|
|
|
|
|
|
|
|
4527
|
|
|
|
|
|
|
# given: synopsis |
4528
|
|
|
|
|
|
|
|
4529
|
|
|
|
|
|
|
package main; |
4530
|
|
|
|
|
|
|
|
4531
|
|
|
|
|
|
|
$check = $check->package; |
4532
|
|
|
|
|
|
|
|
4533
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4534
|
|
|
|
|
|
|
|
4535
|
|
|
|
|
|
|
# my $result = $check->eval('Venus::Check'); |
4536
|
|
|
|
|
|
|
|
4537
|
|
|
|
|
|
|
# true |
4538
|
|
|
|
|
|
|
|
4539
|
|
|
|
|
|
|
=back |
4540
|
|
|
|
|
|
|
|
4541
|
|
|
|
|
|
|
=over 4 |
4542
|
|
|
|
|
|
|
|
4543
|
|
|
|
|
|
|
=item package example 2 |
4544
|
|
|
|
|
|
|
|
4545
|
|
|
|
|
|
|
# given: synopsis |
4546
|
|
|
|
|
|
|
|
4547
|
|
|
|
|
|
|
package main; |
4548
|
|
|
|
|
|
|
|
4549
|
|
|
|
|
|
|
$check = $check->package; |
4550
|
|
|
|
|
|
|
|
4551
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4552
|
|
|
|
|
|
|
|
4553
|
|
|
|
|
|
|
# my $result = $check->eval('MyApp::Check'); |
4554
|
|
|
|
|
|
|
|
4555
|
|
|
|
|
|
|
# false |
4556
|
|
|
|
|
|
|
|
4557
|
|
|
|
|
|
|
=back |
4558
|
|
|
|
|
|
|
|
4559
|
|
|
|
|
|
|
=over 4 |
4560
|
|
|
|
|
|
|
|
4561
|
|
|
|
|
|
|
=item package example 3 |
4562
|
|
|
|
|
|
|
|
4563
|
|
|
|
|
|
|
# given: synopsis |
4564
|
|
|
|
|
|
|
|
4565
|
|
|
|
|
|
|
package main; |
4566
|
|
|
|
|
|
|
|
4567
|
|
|
|
|
|
|
$check = $check->package; |
4568
|
|
|
|
|
|
|
|
4569
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4570
|
|
|
|
|
|
|
|
4571
|
|
|
|
|
|
|
# my $result = $check->result('Venus::Check'); |
4572
|
|
|
|
|
|
|
|
4573
|
|
|
|
|
|
|
# 'Venus::Check' |
4574
|
|
|
|
|
|
|
|
4575
|
|
|
|
|
|
|
=back |
4576
|
|
|
|
|
|
|
|
4577
|
|
|
|
|
|
|
=over 4 |
4578
|
|
|
|
|
|
|
|
4579
|
|
|
|
|
|
|
=item package example 4 |
4580
|
|
|
|
|
|
|
|
4581
|
|
|
|
|
|
|
# given: synopsis |
4582
|
|
|
|
|
|
|
|
4583
|
|
|
|
|
|
|
package main; |
4584
|
|
|
|
|
|
|
|
4585
|
|
|
|
|
|
|
$check = $check->package; |
4586
|
|
|
|
|
|
|
|
4587
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4588
|
|
|
|
|
|
|
|
4589
|
|
|
|
|
|
|
# my $result = $check->result(0); |
4590
|
|
|
|
|
|
|
|
4591
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
4592
|
|
|
|
|
|
|
|
4593
|
|
|
|
|
|
|
=back |
4594
|
|
|
|
|
|
|
|
4595
|
|
|
|
|
|
|
=over 4 |
4596
|
|
|
|
|
|
|
|
4597
|
|
|
|
|
|
|
=item package example 5 |
4598
|
|
|
|
|
|
|
|
4599
|
|
|
|
|
|
|
# given: synopsis |
4600
|
|
|
|
|
|
|
|
4601
|
|
|
|
|
|
|
package main; |
4602
|
|
|
|
|
|
|
|
4603
|
|
|
|
|
|
|
$check = $check->package; |
4604
|
|
|
|
|
|
|
|
4605
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4606
|
|
|
|
|
|
|
|
4607
|
|
|
|
|
|
|
# my $result = $check->result('main'); |
4608
|
|
|
|
|
|
|
|
4609
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_package) |
4610
|
|
|
|
|
|
|
|
4611
|
|
|
|
|
|
|
=back |
4612
|
|
|
|
|
|
|
|
4613
|
|
|
|
|
|
|
=over 4 |
4614
|
|
|
|
|
|
|
|
4615
|
|
|
|
|
|
|
=item package example 6 |
4616
|
|
|
|
|
|
|
|
4617
|
|
|
|
|
|
|
# given: synopsis |
4618
|
|
|
|
|
|
|
|
4619
|
|
|
|
|
|
|
package main; |
4620
|
|
|
|
|
|
|
|
4621
|
|
|
|
|
|
|
$check = $check->package; |
4622
|
|
|
|
|
|
|
|
4623
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4624
|
|
|
|
|
|
|
|
4625
|
|
|
|
|
|
|
# my $result = $check->result('MyApp::Check'); |
4626
|
|
|
|
|
|
|
|
4627
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_package_loaded) |
4628
|
|
|
|
|
|
|
|
4629
|
|
|
|
|
|
|
=back |
4630
|
|
|
|
|
|
|
|
4631
|
|
|
|
|
|
|
=cut |
4632
|
|
|
|
|
|
|
|
4633
|
|
|
|
|
|
|
=head2 pass |
4634
|
|
|
|
|
|
|
|
4635
|
|
|
|
|
|
|
pass(any $data, hashref $meta) (boolean) |
4636
|
|
|
|
|
|
|
|
4637
|
|
|
|
|
|
|
The pass method captures data related to a success and returns true. |
4638
|
|
|
|
|
|
|
|
4639
|
|
|
|
|
|
|
I> |
4640
|
|
|
|
|
|
|
|
4641
|
|
|
|
|
|
|
=over 4 |
4642
|
|
|
|
|
|
|
|
4643
|
|
|
|
|
|
|
=item pass example 1 |
4644
|
|
|
|
|
|
|
|
4645
|
|
|
|
|
|
|
# given: synopsis |
4646
|
|
|
|
|
|
|
|
4647
|
|
|
|
|
|
|
package main; |
4648
|
|
|
|
|
|
|
|
4649
|
|
|
|
|
|
|
my $pass = $check->pass('...', { |
4650
|
|
|
|
|
|
|
from => 'caller', |
4651
|
|
|
|
|
|
|
}); |
4652
|
|
|
|
|
|
|
|
4653
|
|
|
|
|
|
|
# true |
4654
|
|
|
|
|
|
|
|
4655
|
|
|
|
|
|
|
=back |
4656
|
|
|
|
|
|
|
|
4657
|
|
|
|
|
|
|
=cut |
4658
|
|
|
|
|
|
|
|
4659
|
|
|
|
|
|
|
=head2 passed |
4660
|
|
|
|
|
|
|
|
4661
|
|
|
|
|
|
|
passed() (boolean) |
4662
|
|
|
|
|
|
|
|
4663
|
|
|
|
|
|
|
The passed method returns true if the result of the last operation was a |
4664
|
|
|
|
|
|
|
success, otherwise returns false. |
4665
|
|
|
|
|
|
|
|
4666
|
|
|
|
|
|
|
I> |
4667
|
|
|
|
|
|
|
|
4668
|
|
|
|
|
|
|
=over 4 |
4669
|
|
|
|
|
|
|
|
4670
|
|
|
|
|
|
|
=item passed example 1 |
4671
|
|
|
|
|
|
|
|
4672
|
|
|
|
|
|
|
# given: synopsis |
4673
|
|
|
|
|
|
|
|
4674
|
|
|
|
|
|
|
package main; |
4675
|
|
|
|
|
|
|
|
4676
|
|
|
|
|
|
|
my $passed = $check->passed; |
4677
|
|
|
|
|
|
|
|
4678
|
|
|
|
|
|
|
# false |
4679
|
|
|
|
|
|
|
|
4680
|
|
|
|
|
|
|
=back |
4681
|
|
|
|
|
|
|
|
4682
|
|
|
|
|
|
|
=over 4 |
4683
|
|
|
|
|
|
|
|
4684
|
|
|
|
|
|
|
=item passed example 2 |
4685
|
|
|
|
|
|
|
|
4686
|
|
|
|
|
|
|
# given: synopsis |
4687
|
|
|
|
|
|
|
|
4688
|
|
|
|
|
|
|
package main; |
4689
|
|
|
|
|
|
|
|
4690
|
|
|
|
|
|
|
$check->string->eval('hello'); |
4691
|
|
|
|
|
|
|
|
4692
|
|
|
|
|
|
|
my $passed = $check->passed; |
4693
|
|
|
|
|
|
|
|
4694
|
|
|
|
|
|
|
# true |
4695
|
|
|
|
|
|
|
|
4696
|
|
|
|
|
|
|
=back |
4697
|
|
|
|
|
|
|
|
4698
|
|
|
|
|
|
|
=over 4 |
4699
|
|
|
|
|
|
|
|
4700
|
|
|
|
|
|
|
=item passed example 3 |
4701
|
|
|
|
|
|
|
|
4702
|
|
|
|
|
|
|
# given: synopsis |
4703
|
|
|
|
|
|
|
|
4704
|
|
|
|
|
|
|
package main; |
4705
|
|
|
|
|
|
|
|
4706
|
|
|
|
|
|
|
$check->string->eval(12345); |
4707
|
|
|
|
|
|
|
|
4708
|
|
|
|
|
|
|
my $passed = $check->passed; |
4709
|
|
|
|
|
|
|
|
4710
|
|
|
|
|
|
|
# false |
4711
|
|
|
|
|
|
|
|
4712
|
|
|
|
|
|
|
=back |
4713
|
|
|
|
|
|
|
|
4714
|
|
|
|
|
|
|
=cut |
4715
|
|
|
|
|
|
|
|
4716
|
|
|
|
|
|
|
=head2 reference |
4717
|
|
|
|
|
|
|
|
4718
|
|
|
|
|
|
|
reference(coderef @code) (Venus::Check) |
4719
|
|
|
|
|
|
|
|
4720
|
|
|
|
|
|
|
The reference method configures the object to accept references and returns the |
4721
|
|
|
|
|
|
|
invocant. |
4722
|
|
|
|
|
|
|
|
4723
|
|
|
|
|
|
|
I> |
4724
|
|
|
|
|
|
|
|
4725
|
|
|
|
|
|
|
=over 4 |
4726
|
|
|
|
|
|
|
|
4727
|
|
|
|
|
|
|
=item reference example 1 |
4728
|
|
|
|
|
|
|
|
4729
|
|
|
|
|
|
|
# given: synopsis |
4730
|
|
|
|
|
|
|
|
4731
|
|
|
|
|
|
|
package main; |
4732
|
|
|
|
|
|
|
|
4733
|
|
|
|
|
|
|
$check = $check->reference; |
4734
|
|
|
|
|
|
|
|
4735
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4736
|
|
|
|
|
|
|
|
4737
|
|
|
|
|
|
|
# my $result = $check->eval([]); |
4738
|
|
|
|
|
|
|
|
4739
|
|
|
|
|
|
|
# true |
4740
|
|
|
|
|
|
|
|
4741
|
|
|
|
|
|
|
=back |
4742
|
|
|
|
|
|
|
|
4743
|
|
|
|
|
|
|
=over 4 |
4744
|
|
|
|
|
|
|
|
4745
|
|
|
|
|
|
|
=item reference example 2 |
4746
|
|
|
|
|
|
|
|
4747
|
|
|
|
|
|
|
# given: synopsis |
4748
|
|
|
|
|
|
|
|
4749
|
|
|
|
|
|
|
package main; |
4750
|
|
|
|
|
|
|
|
4751
|
|
|
|
|
|
|
$check = $check->reference; |
4752
|
|
|
|
|
|
|
|
4753
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4754
|
|
|
|
|
|
|
|
4755
|
|
|
|
|
|
|
# my $result = $check->eval(''); |
4756
|
|
|
|
|
|
|
|
4757
|
|
|
|
|
|
|
# false |
4758
|
|
|
|
|
|
|
|
4759
|
|
|
|
|
|
|
=back |
4760
|
|
|
|
|
|
|
|
4761
|
|
|
|
|
|
|
=over 4 |
4762
|
|
|
|
|
|
|
|
4763
|
|
|
|
|
|
|
=item reference example 3 |
4764
|
|
|
|
|
|
|
|
4765
|
|
|
|
|
|
|
# given: synopsis |
4766
|
|
|
|
|
|
|
|
4767
|
|
|
|
|
|
|
package main; |
4768
|
|
|
|
|
|
|
|
4769
|
|
|
|
|
|
|
$check = $check->reference; |
4770
|
|
|
|
|
|
|
|
4771
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4772
|
|
|
|
|
|
|
|
4773
|
|
|
|
|
|
|
# my $result = $check->result([]); |
4774
|
|
|
|
|
|
|
|
4775
|
|
|
|
|
|
|
# [] |
4776
|
|
|
|
|
|
|
|
4777
|
|
|
|
|
|
|
=back |
4778
|
|
|
|
|
|
|
|
4779
|
|
|
|
|
|
|
=over 4 |
4780
|
|
|
|
|
|
|
|
4781
|
|
|
|
|
|
|
=item reference example 4 |
4782
|
|
|
|
|
|
|
|
4783
|
|
|
|
|
|
|
# given: synopsis |
4784
|
|
|
|
|
|
|
|
4785
|
|
|
|
|
|
|
package main; |
4786
|
|
|
|
|
|
|
|
4787
|
|
|
|
|
|
|
$check = $check->reference; |
4788
|
|
|
|
|
|
|
|
4789
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4790
|
|
|
|
|
|
|
|
4791
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
4792
|
|
|
|
|
|
|
|
4793
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_defined) |
4794
|
|
|
|
|
|
|
|
4795
|
|
|
|
|
|
|
=back |
4796
|
|
|
|
|
|
|
|
4797
|
|
|
|
|
|
|
=over 4 |
4798
|
|
|
|
|
|
|
|
4799
|
|
|
|
|
|
|
=item reference example 5 |
4800
|
|
|
|
|
|
|
|
4801
|
|
|
|
|
|
|
# given: synopsis |
4802
|
|
|
|
|
|
|
|
4803
|
|
|
|
|
|
|
package main; |
4804
|
|
|
|
|
|
|
|
4805
|
|
|
|
|
|
|
$check = $check->reference; |
4806
|
|
|
|
|
|
|
|
4807
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4808
|
|
|
|
|
|
|
|
4809
|
|
|
|
|
|
|
# my $result = $check->result(''); |
4810
|
|
|
|
|
|
|
|
4811
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_reference) |
4812
|
|
|
|
|
|
|
|
4813
|
|
|
|
|
|
|
=back |
4814
|
|
|
|
|
|
|
|
4815
|
|
|
|
|
|
|
=cut |
4816
|
|
|
|
|
|
|
|
4817
|
|
|
|
|
|
|
=head2 regexp |
4818
|
|
|
|
|
|
|
|
4819
|
|
|
|
|
|
|
regexp(coderef @code) (Venus::Check) |
4820
|
|
|
|
|
|
|
|
4821
|
|
|
|
|
|
|
The regexp method configures the object to accept regular expression objects |
4822
|
|
|
|
|
|
|
and returns the invocant. |
4823
|
|
|
|
|
|
|
|
4824
|
|
|
|
|
|
|
I> |
4825
|
|
|
|
|
|
|
|
4826
|
|
|
|
|
|
|
=over 4 |
4827
|
|
|
|
|
|
|
|
4828
|
|
|
|
|
|
|
=item regexp example 1 |
4829
|
|
|
|
|
|
|
|
4830
|
|
|
|
|
|
|
# given: synopsis |
4831
|
|
|
|
|
|
|
|
4832
|
|
|
|
|
|
|
package main; |
4833
|
|
|
|
|
|
|
|
4834
|
|
|
|
|
|
|
$check = $check->regexp; |
4835
|
|
|
|
|
|
|
|
4836
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4837
|
|
|
|
|
|
|
|
4838
|
|
|
|
|
|
|
# my $result = $check->eval(qr//); |
4839
|
|
|
|
|
|
|
|
4840
|
|
|
|
|
|
|
# true |
4841
|
|
|
|
|
|
|
|
4842
|
|
|
|
|
|
|
=back |
4843
|
|
|
|
|
|
|
|
4844
|
|
|
|
|
|
|
=over 4 |
4845
|
|
|
|
|
|
|
|
4846
|
|
|
|
|
|
|
=item regexp example 2 |
4847
|
|
|
|
|
|
|
|
4848
|
|
|
|
|
|
|
# given: synopsis |
4849
|
|
|
|
|
|
|
|
4850
|
|
|
|
|
|
|
package main; |
4851
|
|
|
|
|
|
|
|
4852
|
|
|
|
|
|
|
$check = $check->regexp; |
4853
|
|
|
|
|
|
|
|
4854
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4855
|
|
|
|
|
|
|
|
4856
|
|
|
|
|
|
|
# my $result = $check->eval(''); |
4857
|
|
|
|
|
|
|
|
4858
|
|
|
|
|
|
|
# false |
4859
|
|
|
|
|
|
|
|
4860
|
|
|
|
|
|
|
=back |
4861
|
|
|
|
|
|
|
|
4862
|
|
|
|
|
|
|
=over 4 |
4863
|
|
|
|
|
|
|
|
4864
|
|
|
|
|
|
|
=item regexp example 3 |
4865
|
|
|
|
|
|
|
|
4866
|
|
|
|
|
|
|
# given: synopsis |
4867
|
|
|
|
|
|
|
|
4868
|
|
|
|
|
|
|
package main; |
4869
|
|
|
|
|
|
|
|
4870
|
|
|
|
|
|
|
$check = $check->regexp; |
4871
|
|
|
|
|
|
|
|
4872
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4873
|
|
|
|
|
|
|
|
4874
|
|
|
|
|
|
|
# my $result = $check->result(qr//); |
4875
|
|
|
|
|
|
|
|
4876
|
|
|
|
|
|
|
# qr// |
4877
|
|
|
|
|
|
|
|
4878
|
|
|
|
|
|
|
=back |
4879
|
|
|
|
|
|
|
|
4880
|
|
|
|
|
|
|
=over 4 |
4881
|
|
|
|
|
|
|
|
4882
|
|
|
|
|
|
|
=item regexp example 4 |
4883
|
|
|
|
|
|
|
|
4884
|
|
|
|
|
|
|
# given: synopsis |
4885
|
|
|
|
|
|
|
|
4886
|
|
|
|
|
|
|
package main; |
4887
|
|
|
|
|
|
|
|
4888
|
|
|
|
|
|
|
$check = $check->regexp; |
4889
|
|
|
|
|
|
|
|
4890
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4891
|
|
|
|
|
|
|
|
4892
|
|
|
|
|
|
|
# my $result = $check->result(''); |
4893
|
|
|
|
|
|
|
|
4894
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
4895
|
|
|
|
|
|
|
|
4896
|
|
|
|
|
|
|
=back |
4897
|
|
|
|
|
|
|
|
4898
|
|
|
|
|
|
|
=cut |
4899
|
|
|
|
|
|
|
|
4900
|
|
|
|
|
|
|
=head2 result |
4901
|
|
|
|
|
|
|
|
4902
|
|
|
|
|
|
|
result(any @args) (any) |
4903
|
|
|
|
|
|
|
|
4904
|
|
|
|
|
|
|
The result method performs an L operation and returns the value provided |
4905
|
|
|
|
|
|
|
on success, and on failure raises an exception. |
4906
|
|
|
|
|
|
|
|
4907
|
|
|
|
|
|
|
I> |
4908
|
|
|
|
|
|
|
|
4909
|
|
|
|
|
|
|
=over 4 |
4910
|
|
|
|
|
|
|
|
4911
|
|
|
|
|
|
|
=item result example 1 |
4912
|
|
|
|
|
|
|
|
4913
|
|
|
|
|
|
|
# given: synopsis |
4914
|
|
|
|
|
|
|
|
4915
|
|
|
|
|
|
|
package main; |
4916
|
|
|
|
|
|
|
|
4917
|
|
|
|
|
|
|
$check->string; |
4918
|
|
|
|
|
|
|
|
4919
|
|
|
|
|
|
|
my $string = $check->result('hello'); |
4920
|
|
|
|
|
|
|
|
4921
|
|
|
|
|
|
|
# 'hello' |
4922
|
|
|
|
|
|
|
|
4923
|
|
|
|
|
|
|
=back |
4924
|
|
|
|
|
|
|
|
4925
|
|
|
|
|
|
|
=over 4 |
4926
|
|
|
|
|
|
|
|
4927
|
|
|
|
|
|
|
=item result example 2 |
4928
|
|
|
|
|
|
|
|
4929
|
|
|
|
|
|
|
# given: synopsis |
4930
|
|
|
|
|
|
|
|
4931
|
|
|
|
|
|
|
package main; |
4932
|
|
|
|
|
|
|
|
4933
|
|
|
|
|
|
|
$check->string; |
4934
|
|
|
|
|
|
|
|
4935
|
|
|
|
|
|
|
my $string = $check->result(12345); |
4936
|
|
|
|
|
|
|
|
4937
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
4938
|
|
|
|
|
|
|
|
4939
|
|
|
|
|
|
|
=back |
4940
|
|
|
|
|
|
|
|
4941
|
|
|
|
|
|
|
=cut |
4942
|
|
|
|
|
|
|
|
4943
|
|
|
|
|
|
|
=head2 routines |
4944
|
|
|
|
|
|
|
|
4945
|
|
|
|
|
|
|
routines(string @names) (Venus::Check) |
4946
|
|
|
|
|
|
|
|
4947
|
|
|
|
|
|
|
The routines method configures the object to accept an object having all of the |
4948
|
|
|
|
|
|
|
routines provided, and returns the invocant. |
4949
|
|
|
|
|
|
|
|
4950
|
|
|
|
|
|
|
I> |
4951
|
|
|
|
|
|
|
|
4952
|
|
|
|
|
|
|
=over 4 |
4953
|
|
|
|
|
|
|
|
4954
|
|
|
|
|
|
|
=item routines example 1 |
4955
|
|
|
|
|
|
|
|
4956
|
|
|
|
|
|
|
# given: synopsis |
4957
|
|
|
|
|
|
|
|
4958
|
|
|
|
|
|
|
package main; |
4959
|
|
|
|
|
|
|
|
4960
|
|
|
|
|
|
|
$check = $check->routines('result'); |
4961
|
|
|
|
|
|
|
|
4962
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4963
|
|
|
|
|
|
|
|
4964
|
|
|
|
|
|
|
# my $result = $check->eval(Venus::Check->new); |
4965
|
|
|
|
|
|
|
|
4966
|
|
|
|
|
|
|
# true |
4967
|
|
|
|
|
|
|
|
4968
|
|
|
|
|
|
|
=back |
4969
|
|
|
|
|
|
|
|
4970
|
|
|
|
|
|
|
=over 4 |
4971
|
|
|
|
|
|
|
|
4972
|
|
|
|
|
|
|
=item routines example 2 |
4973
|
|
|
|
|
|
|
|
4974
|
|
|
|
|
|
|
# given: synopsis |
4975
|
|
|
|
|
|
|
|
4976
|
|
|
|
|
|
|
package main; |
4977
|
|
|
|
|
|
|
|
4978
|
|
|
|
|
|
|
use Venus::Config; |
4979
|
|
|
|
|
|
|
|
4980
|
|
|
|
|
|
|
$check = $check->routines('result'); |
4981
|
|
|
|
|
|
|
|
4982
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
4983
|
|
|
|
|
|
|
|
4984
|
|
|
|
|
|
|
# my $result = $check->eval(Venus::Config->new); |
4985
|
|
|
|
|
|
|
|
4986
|
|
|
|
|
|
|
# false |
4987
|
|
|
|
|
|
|
|
4988
|
|
|
|
|
|
|
=back |
4989
|
|
|
|
|
|
|
|
4990
|
|
|
|
|
|
|
=over 4 |
4991
|
|
|
|
|
|
|
|
4992
|
|
|
|
|
|
|
=item routines example 3 |
4993
|
|
|
|
|
|
|
|
4994
|
|
|
|
|
|
|
# given: synopsis |
4995
|
|
|
|
|
|
|
|
4996
|
|
|
|
|
|
|
package main; |
4997
|
|
|
|
|
|
|
|
4998
|
|
|
|
|
|
|
$check = $check->routines('result'); |
4999
|
|
|
|
|
|
|
|
5000
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5001
|
|
|
|
|
|
|
|
5002
|
|
|
|
|
|
|
# my $result = $check->result(Venus::Check->new); |
5003
|
|
|
|
|
|
|
|
5004
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5005
|
|
|
|
|
|
|
|
5006
|
|
|
|
|
|
|
=back |
5007
|
|
|
|
|
|
|
|
5008
|
|
|
|
|
|
|
=over 4 |
5009
|
|
|
|
|
|
|
|
5010
|
|
|
|
|
|
|
=item routines example 4 |
5011
|
|
|
|
|
|
|
|
5012
|
|
|
|
|
|
|
# given: synopsis |
5013
|
|
|
|
|
|
|
|
5014
|
|
|
|
|
|
|
package main; |
5015
|
|
|
|
|
|
|
|
5016
|
|
|
|
|
|
|
use Venus::Config; |
5017
|
|
|
|
|
|
|
|
5018
|
|
|
|
|
|
|
$check = $check->routines('result'); |
5019
|
|
|
|
|
|
|
|
5020
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5021
|
|
|
|
|
|
|
|
5022
|
|
|
|
|
|
|
# my $result = $check->result({}); |
5023
|
|
|
|
|
|
|
|
5024
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
5025
|
|
|
|
|
|
|
|
5026
|
|
|
|
|
|
|
=back |
5027
|
|
|
|
|
|
|
|
5028
|
|
|
|
|
|
|
=over 4 |
5029
|
|
|
|
|
|
|
|
5030
|
|
|
|
|
|
|
=item routines example 5 |
5031
|
|
|
|
|
|
|
|
5032
|
|
|
|
|
|
|
# given: synopsis |
5033
|
|
|
|
|
|
|
|
5034
|
|
|
|
|
|
|
package main; |
5035
|
|
|
|
|
|
|
|
5036
|
|
|
|
|
|
|
use Venus::Config; |
5037
|
|
|
|
|
|
|
|
5038
|
|
|
|
|
|
|
$check = $check->routines('result'); |
5039
|
|
|
|
|
|
|
|
5040
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5041
|
|
|
|
|
|
|
|
5042
|
|
|
|
|
|
|
# my $result = $check->result(Venus::Config->new); |
5043
|
|
|
|
|
|
|
|
5044
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_missing) |
5045
|
|
|
|
|
|
|
|
5046
|
|
|
|
|
|
|
=back |
5047
|
|
|
|
|
|
|
|
5048
|
|
|
|
|
|
|
=cut |
5049
|
|
|
|
|
|
|
|
5050
|
|
|
|
|
|
|
=head2 scalar |
5051
|
|
|
|
|
|
|
|
5052
|
|
|
|
|
|
|
scalar(coderef @code) (Venus::Check) |
5053
|
|
|
|
|
|
|
|
5054
|
|
|
|
|
|
|
The scalar method configures the object to accept scalar references and returns |
5055
|
|
|
|
|
|
|
the invocant. |
5056
|
|
|
|
|
|
|
|
5057
|
|
|
|
|
|
|
I> |
5058
|
|
|
|
|
|
|
|
5059
|
|
|
|
|
|
|
=over 4 |
5060
|
|
|
|
|
|
|
|
5061
|
|
|
|
|
|
|
=item scalar example 1 |
5062
|
|
|
|
|
|
|
|
5063
|
|
|
|
|
|
|
# given: synopsis |
5064
|
|
|
|
|
|
|
|
5065
|
|
|
|
|
|
|
package main; |
5066
|
|
|
|
|
|
|
|
5067
|
|
|
|
|
|
|
$check = $check->scalar; |
5068
|
|
|
|
|
|
|
|
5069
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5070
|
|
|
|
|
|
|
|
5071
|
|
|
|
|
|
|
# my $result = $check->eval(\''); |
5072
|
|
|
|
|
|
|
|
5073
|
|
|
|
|
|
|
# true |
5074
|
|
|
|
|
|
|
|
5075
|
|
|
|
|
|
|
=back |
5076
|
|
|
|
|
|
|
|
5077
|
|
|
|
|
|
|
=over 4 |
5078
|
|
|
|
|
|
|
|
5079
|
|
|
|
|
|
|
=item scalar example 2 |
5080
|
|
|
|
|
|
|
|
5081
|
|
|
|
|
|
|
# given: synopsis |
5082
|
|
|
|
|
|
|
|
5083
|
|
|
|
|
|
|
package main; |
5084
|
|
|
|
|
|
|
|
5085
|
|
|
|
|
|
|
$check = $check->scalar; |
5086
|
|
|
|
|
|
|
|
5087
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5088
|
|
|
|
|
|
|
|
5089
|
|
|
|
|
|
|
# my $result = $check->eval(''); |
5090
|
|
|
|
|
|
|
|
5091
|
|
|
|
|
|
|
# false |
5092
|
|
|
|
|
|
|
|
5093
|
|
|
|
|
|
|
=back |
5094
|
|
|
|
|
|
|
|
5095
|
|
|
|
|
|
|
=over 4 |
5096
|
|
|
|
|
|
|
|
5097
|
|
|
|
|
|
|
=item scalar example 3 |
5098
|
|
|
|
|
|
|
|
5099
|
|
|
|
|
|
|
# given: synopsis |
5100
|
|
|
|
|
|
|
|
5101
|
|
|
|
|
|
|
package main; |
5102
|
|
|
|
|
|
|
|
5103
|
|
|
|
|
|
|
$check = $check->scalar; |
5104
|
|
|
|
|
|
|
|
5105
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5106
|
|
|
|
|
|
|
|
5107
|
|
|
|
|
|
|
# my $result = $check->result(\''); |
5108
|
|
|
|
|
|
|
|
5109
|
|
|
|
|
|
|
# \'' |
5110
|
|
|
|
|
|
|
|
5111
|
|
|
|
|
|
|
=back |
5112
|
|
|
|
|
|
|
|
5113
|
|
|
|
|
|
|
=over 4 |
5114
|
|
|
|
|
|
|
|
5115
|
|
|
|
|
|
|
=item scalar example 4 |
5116
|
|
|
|
|
|
|
|
5117
|
|
|
|
|
|
|
# given: synopsis |
5118
|
|
|
|
|
|
|
|
5119
|
|
|
|
|
|
|
package main; |
5120
|
|
|
|
|
|
|
|
5121
|
|
|
|
|
|
|
$check = $check->scalar; |
5122
|
|
|
|
|
|
|
|
5123
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5124
|
|
|
|
|
|
|
|
5125
|
|
|
|
|
|
|
# my $result = $check->result(''); |
5126
|
|
|
|
|
|
|
|
5127
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
5128
|
|
|
|
|
|
|
|
5129
|
|
|
|
|
|
|
=back |
5130
|
|
|
|
|
|
|
|
5131
|
|
|
|
|
|
|
=cut |
5132
|
|
|
|
|
|
|
|
5133
|
|
|
|
|
|
|
=head2 scalarref |
5134
|
|
|
|
|
|
|
|
5135
|
|
|
|
|
|
|
scalarref(coderef @code) (Venus::Check) |
5136
|
|
|
|
|
|
|
|
5137
|
|
|
|
|
|
|
The scalarref method configures the object to accept scalar references and returns |
5138
|
|
|
|
|
|
|
the invocant. |
5139
|
|
|
|
|
|
|
|
5140
|
|
|
|
|
|
|
I> |
5141
|
|
|
|
|
|
|
|
5142
|
|
|
|
|
|
|
=over 4 |
5143
|
|
|
|
|
|
|
|
5144
|
|
|
|
|
|
|
=item scalarref example 1 |
5145
|
|
|
|
|
|
|
|
5146
|
|
|
|
|
|
|
# given: synopsis |
5147
|
|
|
|
|
|
|
|
5148
|
|
|
|
|
|
|
package main; |
5149
|
|
|
|
|
|
|
|
5150
|
|
|
|
|
|
|
$check = $check->scalarref; |
5151
|
|
|
|
|
|
|
|
5152
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5153
|
|
|
|
|
|
|
|
5154
|
|
|
|
|
|
|
# my $result = $check->eval(\''); |
5155
|
|
|
|
|
|
|
|
5156
|
|
|
|
|
|
|
# true |
5157
|
|
|
|
|
|
|
|
5158
|
|
|
|
|
|
|
=back |
5159
|
|
|
|
|
|
|
|
5160
|
|
|
|
|
|
|
=over 4 |
5161
|
|
|
|
|
|
|
|
5162
|
|
|
|
|
|
|
=item scalarref example 2 |
5163
|
|
|
|
|
|
|
|
5164
|
|
|
|
|
|
|
# given: synopsis |
5165
|
|
|
|
|
|
|
|
5166
|
|
|
|
|
|
|
package main; |
5167
|
|
|
|
|
|
|
|
5168
|
|
|
|
|
|
|
$check = $check->scalarref; |
5169
|
|
|
|
|
|
|
|
5170
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5171
|
|
|
|
|
|
|
|
5172
|
|
|
|
|
|
|
# my $result = $check->eval(''); |
5173
|
|
|
|
|
|
|
|
5174
|
|
|
|
|
|
|
# false |
5175
|
|
|
|
|
|
|
|
5176
|
|
|
|
|
|
|
=back |
5177
|
|
|
|
|
|
|
|
5178
|
|
|
|
|
|
|
=over 4 |
5179
|
|
|
|
|
|
|
|
5180
|
|
|
|
|
|
|
=item scalarref example 3 |
5181
|
|
|
|
|
|
|
|
5182
|
|
|
|
|
|
|
# given: synopsis |
5183
|
|
|
|
|
|
|
|
5184
|
|
|
|
|
|
|
package main; |
5185
|
|
|
|
|
|
|
|
5186
|
|
|
|
|
|
|
$check = $check->scalarref; |
5187
|
|
|
|
|
|
|
|
5188
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5189
|
|
|
|
|
|
|
|
5190
|
|
|
|
|
|
|
# my $result = $check->result(\''); |
5191
|
|
|
|
|
|
|
|
5192
|
|
|
|
|
|
|
# \'' |
5193
|
|
|
|
|
|
|
|
5194
|
|
|
|
|
|
|
=back |
5195
|
|
|
|
|
|
|
|
5196
|
|
|
|
|
|
|
=over 4 |
5197
|
|
|
|
|
|
|
|
5198
|
|
|
|
|
|
|
=item scalarref example 4 |
5199
|
|
|
|
|
|
|
|
5200
|
|
|
|
|
|
|
# given: synopsis |
5201
|
|
|
|
|
|
|
|
5202
|
|
|
|
|
|
|
package main; |
5203
|
|
|
|
|
|
|
|
5204
|
|
|
|
|
|
|
$check = $check->scalarref; |
5205
|
|
|
|
|
|
|
|
5206
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5207
|
|
|
|
|
|
|
|
5208
|
|
|
|
|
|
|
# my $result = $check->result(''); |
5209
|
|
|
|
|
|
|
|
5210
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
5211
|
|
|
|
|
|
|
|
5212
|
|
|
|
|
|
|
=back |
5213
|
|
|
|
|
|
|
|
5214
|
|
|
|
|
|
|
=cut |
5215
|
|
|
|
|
|
|
|
5216
|
|
|
|
|
|
|
=head2 string |
5217
|
|
|
|
|
|
|
|
5218
|
|
|
|
|
|
|
string(coderef @code) (Venus::Check) |
5219
|
|
|
|
|
|
|
|
5220
|
|
|
|
|
|
|
The string method configures the object to accept string values and returns the |
5221
|
|
|
|
|
|
|
invocant. |
5222
|
|
|
|
|
|
|
|
5223
|
|
|
|
|
|
|
I> |
5224
|
|
|
|
|
|
|
|
5225
|
|
|
|
|
|
|
=over 4 |
5226
|
|
|
|
|
|
|
|
5227
|
|
|
|
|
|
|
=item string example 1 |
5228
|
|
|
|
|
|
|
|
5229
|
|
|
|
|
|
|
# given: synopsis |
5230
|
|
|
|
|
|
|
|
5231
|
|
|
|
|
|
|
package main; |
5232
|
|
|
|
|
|
|
|
5233
|
|
|
|
|
|
|
$check = $check->string; |
5234
|
|
|
|
|
|
|
|
5235
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5236
|
|
|
|
|
|
|
|
5237
|
|
|
|
|
|
|
# my $result = $check->eval('hello'); |
5238
|
|
|
|
|
|
|
|
5239
|
|
|
|
|
|
|
# true |
5240
|
|
|
|
|
|
|
|
5241
|
|
|
|
|
|
|
=back |
5242
|
|
|
|
|
|
|
|
5243
|
|
|
|
|
|
|
=over 4 |
5244
|
|
|
|
|
|
|
|
5245
|
|
|
|
|
|
|
=item string example 2 |
5246
|
|
|
|
|
|
|
|
5247
|
|
|
|
|
|
|
# given: synopsis |
5248
|
|
|
|
|
|
|
|
5249
|
|
|
|
|
|
|
package main; |
5250
|
|
|
|
|
|
|
|
5251
|
|
|
|
|
|
|
$check = $check->string; |
5252
|
|
|
|
|
|
|
|
5253
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5254
|
|
|
|
|
|
|
|
5255
|
|
|
|
|
|
|
# my $result = $check->eval(12345); |
5256
|
|
|
|
|
|
|
|
5257
|
|
|
|
|
|
|
# false |
5258
|
|
|
|
|
|
|
|
5259
|
|
|
|
|
|
|
=back |
5260
|
|
|
|
|
|
|
|
5261
|
|
|
|
|
|
|
=over 4 |
5262
|
|
|
|
|
|
|
|
5263
|
|
|
|
|
|
|
=item string example 3 |
5264
|
|
|
|
|
|
|
|
5265
|
|
|
|
|
|
|
# given: synopsis |
5266
|
|
|
|
|
|
|
|
5267
|
|
|
|
|
|
|
package main; |
5268
|
|
|
|
|
|
|
|
5269
|
|
|
|
|
|
|
$check = $check->string; |
5270
|
|
|
|
|
|
|
|
5271
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5272
|
|
|
|
|
|
|
|
5273
|
|
|
|
|
|
|
# my $result = $check->result('hello'); |
5274
|
|
|
|
|
|
|
|
5275
|
|
|
|
|
|
|
# 'hello' |
5276
|
|
|
|
|
|
|
|
5277
|
|
|
|
|
|
|
=back |
5278
|
|
|
|
|
|
|
|
5279
|
|
|
|
|
|
|
=over 4 |
5280
|
|
|
|
|
|
|
|
5281
|
|
|
|
|
|
|
=item string example 4 |
5282
|
|
|
|
|
|
|
|
5283
|
|
|
|
|
|
|
# given: synopsis |
5284
|
|
|
|
|
|
|
|
5285
|
|
|
|
|
|
|
package main; |
5286
|
|
|
|
|
|
|
|
5287
|
|
|
|
|
|
|
$check = $check->string; |
5288
|
|
|
|
|
|
|
|
5289
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5290
|
|
|
|
|
|
|
|
5291
|
|
|
|
|
|
|
# my $result = $check->result(12345); |
5292
|
|
|
|
|
|
|
|
5293
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
5294
|
|
|
|
|
|
|
|
5295
|
|
|
|
|
|
|
=back |
5296
|
|
|
|
|
|
|
|
5297
|
|
|
|
|
|
|
=cut |
5298
|
|
|
|
|
|
|
|
5299
|
|
|
|
|
|
|
=head2 tuple |
5300
|
|
|
|
|
|
|
|
5301
|
|
|
|
|
|
|
tuple(string | within[arrayref, string] @args) (Venus::Check) |
5302
|
|
|
|
|
|
|
|
5303
|
|
|
|
|
|
|
The tuple method configures the object to accept array references which conform |
5304
|
|
|
|
|
|
|
to a tuple specification, and returns the invocant. The value being evaluated |
5305
|
|
|
|
|
|
|
must contain at-least one element to match. |
5306
|
|
|
|
|
|
|
|
5307
|
|
|
|
|
|
|
I> |
5308
|
|
|
|
|
|
|
|
5309
|
|
|
|
|
|
|
=over 4 |
5310
|
|
|
|
|
|
|
|
5311
|
|
|
|
|
|
|
=item tuple example 1 |
5312
|
|
|
|
|
|
|
|
5313
|
|
|
|
|
|
|
# given: synopsis |
5314
|
|
|
|
|
|
|
|
5315
|
|
|
|
|
|
|
package main; |
5316
|
|
|
|
|
|
|
|
5317
|
|
|
|
|
|
|
$check = $check->tuple('string', 'number'); |
5318
|
|
|
|
|
|
|
|
5319
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5320
|
|
|
|
|
|
|
|
5321
|
|
|
|
|
|
|
# my $result = $check->eval(['hello', 12345]); |
5322
|
|
|
|
|
|
|
|
5323
|
|
|
|
|
|
|
# true |
5324
|
|
|
|
|
|
|
|
5325
|
|
|
|
|
|
|
=back |
5326
|
|
|
|
|
|
|
|
5327
|
|
|
|
|
|
|
=over 4 |
5328
|
|
|
|
|
|
|
|
5329
|
|
|
|
|
|
|
=item tuple example 2 |
5330
|
|
|
|
|
|
|
|
5331
|
|
|
|
|
|
|
# given: synopsis |
5332
|
|
|
|
|
|
|
|
5333
|
|
|
|
|
|
|
package main; |
5334
|
|
|
|
|
|
|
|
5335
|
|
|
|
|
|
|
$check = $check->tuple('string', 'number'); |
5336
|
|
|
|
|
|
|
|
5337
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5338
|
|
|
|
|
|
|
|
5339
|
|
|
|
|
|
|
# my $result = $check->eval([]); |
5340
|
|
|
|
|
|
|
|
5341
|
|
|
|
|
|
|
# false |
5342
|
|
|
|
|
|
|
|
5343
|
|
|
|
|
|
|
=back |
5344
|
|
|
|
|
|
|
|
5345
|
|
|
|
|
|
|
=over 4 |
5346
|
|
|
|
|
|
|
|
5347
|
|
|
|
|
|
|
=item tuple example 3 |
5348
|
|
|
|
|
|
|
|
5349
|
|
|
|
|
|
|
# given: synopsis |
5350
|
|
|
|
|
|
|
|
5351
|
|
|
|
|
|
|
package main; |
5352
|
|
|
|
|
|
|
|
5353
|
|
|
|
|
|
|
$check = $check->tuple('string', 'number'); |
5354
|
|
|
|
|
|
|
|
5355
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5356
|
|
|
|
|
|
|
|
5357
|
|
|
|
|
|
|
# my $result = $check->result(['hello', 12345]); |
5358
|
|
|
|
|
|
|
|
5359
|
|
|
|
|
|
|
# ['hello', 12345] |
5360
|
|
|
|
|
|
|
|
5361
|
|
|
|
|
|
|
=back |
5362
|
|
|
|
|
|
|
|
5363
|
|
|
|
|
|
|
=over 4 |
5364
|
|
|
|
|
|
|
|
5365
|
|
|
|
|
|
|
=item tuple example 4 |
5366
|
|
|
|
|
|
|
|
5367
|
|
|
|
|
|
|
# given: synopsis |
5368
|
|
|
|
|
|
|
|
5369
|
|
|
|
|
|
|
package main; |
5370
|
|
|
|
|
|
|
|
5371
|
|
|
|
|
|
|
$check = $check->tuple('string', 'number'); |
5372
|
|
|
|
|
|
|
|
5373
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5374
|
|
|
|
|
|
|
|
5375
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
5376
|
|
|
|
|
|
|
|
5377
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_defined) |
5378
|
|
|
|
|
|
|
|
5379
|
|
|
|
|
|
|
=back |
5380
|
|
|
|
|
|
|
|
5381
|
|
|
|
|
|
|
=over 4 |
5382
|
|
|
|
|
|
|
|
5383
|
|
|
|
|
|
|
=item tuple example 5 |
5384
|
|
|
|
|
|
|
|
5385
|
|
|
|
|
|
|
# given: synopsis |
5386
|
|
|
|
|
|
|
|
5387
|
|
|
|
|
|
|
package main; |
5388
|
|
|
|
|
|
|
|
5389
|
|
|
|
|
|
|
$check = $check->tuple('string', 'number'); |
5390
|
|
|
|
|
|
|
|
5391
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5392
|
|
|
|
|
|
|
|
5393
|
|
|
|
|
|
|
# my $result = $check->result({}); |
5394
|
|
|
|
|
|
|
|
5395
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_arrayref) |
5396
|
|
|
|
|
|
|
|
5397
|
|
|
|
|
|
|
=back |
5398
|
|
|
|
|
|
|
|
5399
|
|
|
|
|
|
|
=over 4 |
5400
|
|
|
|
|
|
|
|
5401
|
|
|
|
|
|
|
=item tuple example 6 |
5402
|
|
|
|
|
|
|
|
5403
|
|
|
|
|
|
|
# given: synopsis |
5404
|
|
|
|
|
|
|
|
5405
|
|
|
|
|
|
|
package main; |
5406
|
|
|
|
|
|
|
|
5407
|
|
|
|
|
|
|
$check = $check->tuple('string', 'number'); |
5408
|
|
|
|
|
|
|
|
5409
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5410
|
|
|
|
|
|
|
|
5411
|
|
|
|
|
|
|
# my $result = $check->result([]); |
5412
|
|
|
|
|
|
|
|
5413
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_arrayref_count) |
5414
|
|
|
|
|
|
|
|
5415
|
|
|
|
|
|
|
=back |
5416
|
|
|
|
|
|
|
|
5417
|
|
|
|
|
|
|
=cut |
5418
|
|
|
|
|
|
|
|
5419
|
|
|
|
|
|
|
=head2 type |
5420
|
|
|
|
|
|
|
|
5421
|
|
|
|
|
|
|
type(any $data) (string) |
5422
|
|
|
|
|
|
|
|
5423
|
|
|
|
|
|
|
The type method returns the canonical data type name for the value provided. |
5424
|
|
|
|
|
|
|
|
5425
|
|
|
|
|
|
|
I> |
5426
|
|
|
|
|
|
|
|
5427
|
|
|
|
|
|
|
=over 4 |
5428
|
|
|
|
|
|
|
|
5429
|
|
|
|
|
|
|
=item type example 1 |
5430
|
|
|
|
|
|
|
|
5431
|
|
|
|
|
|
|
# given: synopsis |
5432
|
|
|
|
|
|
|
|
5433
|
|
|
|
|
|
|
package main; |
5434
|
|
|
|
|
|
|
|
5435
|
|
|
|
|
|
|
my $type = $check->type({}); |
5436
|
|
|
|
|
|
|
|
5437
|
|
|
|
|
|
|
# 'hashref' |
5438
|
|
|
|
|
|
|
|
5439
|
|
|
|
|
|
|
=back |
5440
|
|
|
|
|
|
|
|
5441
|
|
|
|
|
|
|
=over 4 |
5442
|
|
|
|
|
|
|
|
5443
|
|
|
|
|
|
|
=item type example 2 |
5444
|
|
|
|
|
|
|
|
5445
|
|
|
|
|
|
|
# given: synopsis |
5446
|
|
|
|
|
|
|
|
5447
|
|
|
|
|
|
|
package main; |
5448
|
|
|
|
|
|
|
|
5449
|
|
|
|
|
|
|
my $type = $check->type([]); |
5450
|
|
|
|
|
|
|
|
5451
|
|
|
|
|
|
|
# 'arrayref' |
5452
|
|
|
|
|
|
|
|
5453
|
|
|
|
|
|
|
=back |
5454
|
|
|
|
|
|
|
|
5455
|
|
|
|
|
|
|
=over 4 |
5456
|
|
|
|
|
|
|
|
5457
|
|
|
|
|
|
|
=item type example 3 |
5458
|
|
|
|
|
|
|
|
5459
|
|
|
|
|
|
|
# given: synopsis |
5460
|
|
|
|
|
|
|
|
5461
|
|
|
|
|
|
|
package main; |
5462
|
|
|
|
|
|
|
|
5463
|
|
|
|
|
|
|
my $type = $check->type('Venus::Check'); |
5464
|
|
|
|
|
|
|
|
5465
|
|
|
|
|
|
|
# 'string' |
5466
|
|
|
|
|
|
|
|
5467
|
|
|
|
|
|
|
=back |
5468
|
|
|
|
|
|
|
|
5469
|
|
|
|
|
|
|
=over 4 |
5470
|
|
|
|
|
|
|
|
5471
|
|
|
|
|
|
|
=item type example 4 |
5472
|
|
|
|
|
|
|
|
5473
|
|
|
|
|
|
|
# given: synopsis |
5474
|
|
|
|
|
|
|
|
5475
|
|
|
|
|
|
|
package main; |
5476
|
|
|
|
|
|
|
|
5477
|
|
|
|
|
|
|
my $type = $check->type(Venus::Check->new); |
5478
|
|
|
|
|
|
|
|
5479
|
|
|
|
|
|
|
# 'object' |
5480
|
|
|
|
|
|
|
|
5481
|
|
|
|
|
|
|
=back |
5482
|
|
|
|
|
|
|
|
5483
|
|
|
|
|
|
|
=cut |
5484
|
|
|
|
|
|
|
|
5485
|
|
|
|
|
|
|
=head2 undef |
5486
|
|
|
|
|
|
|
|
5487
|
|
|
|
|
|
|
undef(coderef @code) (Venus::Check) |
5488
|
|
|
|
|
|
|
|
5489
|
|
|
|
|
|
|
The undef method configures the object to accept undefined values and returns |
5490
|
|
|
|
|
|
|
the invocant. |
5491
|
|
|
|
|
|
|
|
5492
|
|
|
|
|
|
|
I> |
5493
|
|
|
|
|
|
|
|
5494
|
|
|
|
|
|
|
=over 4 |
5495
|
|
|
|
|
|
|
|
5496
|
|
|
|
|
|
|
=item undef example 1 |
5497
|
|
|
|
|
|
|
|
5498
|
|
|
|
|
|
|
# given: synopsis |
5499
|
|
|
|
|
|
|
|
5500
|
|
|
|
|
|
|
package main; |
5501
|
|
|
|
|
|
|
|
5502
|
|
|
|
|
|
|
$check = $check->undef; |
5503
|
|
|
|
|
|
|
|
5504
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5505
|
|
|
|
|
|
|
|
5506
|
|
|
|
|
|
|
# my $result = $check->eval(undef); |
5507
|
|
|
|
|
|
|
|
5508
|
|
|
|
|
|
|
# true |
5509
|
|
|
|
|
|
|
|
5510
|
|
|
|
|
|
|
=back |
5511
|
|
|
|
|
|
|
|
5512
|
|
|
|
|
|
|
=over 4 |
5513
|
|
|
|
|
|
|
|
5514
|
|
|
|
|
|
|
=item undef example 2 |
5515
|
|
|
|
|
|
|
|
5516
|
|
|
|
|
|
|
# given: synopsis |
5517
|
|
|
|
|
|
|
|
5518
|
|
|
|
|
|
|
package main; |
5519
|
|
|
|
|
|
|
|
5520
|
|
|
|
|
|
|
$check = $check->undef; |
5521
|
|
|
|
|
|
|
|
5522
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5523
|
|
|
|
|
|
|
|
5524
|
|
|
|
|
|
|
# my $result = $check->eval(''); |
5525
|
|
|
|
|
|
|
|
5526
|
|
|
|
|
|
|
# false |
5527
|
|
|
|
|
|
|
|
5528
|
|
|
|
|
|
|
=back |
5529
|
|
|
|
|
|
|
|
5530
|
|
|
|
|
|
|
=over 4 |
5531
|
|
|
|
|
|
|
|
5532
|
|
|
|
|
|
|
=item undef example 3 |
5533
|
|
|
|
|
|
|
|
5534
|
|
|
|
|
|
|
# given: synopsis |
5535
|
|
|
|
|
|
|
|
5536
|
|
|
|
|
|
|
package main; |
5537
|
|
|
|
|
|
|
|
5538
|
|
|
|
|
|
|
$check = $check->undef; |
5539
|
|
|
|
|
|
|
|
5540
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5541
|
|
|
|
|
|
|
|
5542
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
5543
|
|
|
|
|
|
|
|
5544
|
|
|
|
|
|
|
# undef |
5545
|
|
|
|
|
|
|
|
5546
|
|
|
|
|
|
|
=back |
5547
|
|
|
|
|
|
|
|
5548
|
|
|
|
|
|
|
=over 4 |
5549
|
|
|
|
|
|
|
|
5550
|
|
|
|
|
|
|
=item undef example 4 |
5551
|
|
|
|
|
|
|
|
5552
|
|
|
|
|
|
|
# given: synopsis |
5553
|
|
|
|
|
|
|
|
5554
|
|
|
|
|
|
|
package main; |
5555
|
|
|
|
|
|
|
|
5556
|
|
|
|
|
|
|
$check = $check->undef; |
5557
|
|
|
|
|
|
|
|
5558
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5559
|
|
|
|
|
|
|
|
5560
|
|
|
|
|
|
|
# my $result = $check->result(''); |
5561
|
|
|
|
|
|
|
|
5562
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
5563
|
|
|
|
|
|
|
|
5564
|
|
|
|
|
|
|
=back |
5565
|
|
|
|
|
|
|
|
5566
|
|
|
|
|
|
|
=cut |
5567
|
|
|
|
|
|
|
|
5568
|
|
|
|
|
|
|
=head2 value |
5569
|
|
|
|
|
|
|
|
5570
|
|
|
|
|
|
|
value(coderef @code) (Venus::Check) |
5571
|
|
|
|
|
|
|
|
5572
|
|
|
|
|
|
|
The value method configures the object to accept defined, non-reference, |
5573
|
|
|
|
|
|
|
values, and returns the invocant. |
5574
|
|
|
|
|
|
|
|
5575
|
|
|
|
|
|
|
I> |
5576
|
|
|
|
|
|
|
|
5577
|
|
|
|
|
|
|
=over 4 |
5578
|
|
|
|
|
|
|
|
5579
|
|
|
|
|
|
|
=item value example 1 |
5580
|
|
|
|
|
|
|
|
5581
|
|
|
|
|
|
|
# given: synopsis |
5582
|
|
|
|
|
|
|
|
5583
|
|
|
|
|
|
|
package main; |
5584
|
|
|
|
|
|
|
|
5585
|
|
|
|
|
|
|
$check = $check->value; |
5586
|
|
|
|
|
|
|
|
5587
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5588
|
|
|
|
|
|
|
|
5589
|
|
|
|
|
|
|
# my $result = $check->eval(1); |
5590
|
|
|
|
|
|
|
|
5591
|
|
|
|
|
|
|
# true |
5592
|
|
|
|
|
|
|
|
5593
|
|
|
|
|
|
|
=back |
5594
|
|
|
|
|
|
|
|
5595
|
|
|
|
|
|
|
=over 4 |
5596
|
|
|
|
|
|
|
|
5597
|
|
|
|
|
|
|
=item value example 2 |
5598
|
|
|
|
|
|
|
|
5599
|
|
|
|
|
|
|
# given: synopsis |
5600
|
|
|
|
|
|
|
|
5601
|
|
|
|
|
|
|
package main; |
5602
|
|
|
|
|
|
|
|
5603
|
|
|
|
|
|
|
$check = $check->value; |
5604
|
|
|
|
|
|
|
|
5605
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5606
|
|
|
|
|
|
|
|
5607
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
5608
|
|
|
|
|
|
|
|
5609
|
|
|
|
|
|
|
# false |
5610
|
|
|
|
|
|
|
|
5611
|
|
|
|
|
|
|
=back |
5612
|
|
|
|
|
|
|
|
5613
|
|
|
|
|
|
|
=over 4 |
5614
|
|
|
|
|
|
|
|
5615
|
|
|
|
|
|
|
=item value example 3 |
5616
|
|
|
|
|
|
|
|
5617
|
|
|
|
|
|
|
# given: synopsis |
5618
|
|
|
|
|
|
|
|
5619
|
|
|
|
|
|
|
package main; |
5620
|
|
|
|
|
|
|
|
5621
|
|
|
|
|
|
|
$check = $check->value; |
5622
|
|
|
|
|
|
|
|
5623
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5624
|
|
|
|
|
|
|
|
5625
|
|
|
|
|
|
|
# my $result = $check->result(1); |
5626
|
|
|
|
|
|
|
|
5627
|
|
|
|
|
|
|
# 1 |
5628
|
|
|
|
|
|
|
|
5629
|
|
|
|
|
|
|
=back |
5630
|
|
|
|
|
|
|
|
5631
|
|
|
|
|
|
|
=over 4 |
5632
|
|
|
|
|
|
|
|
5633
|
|
|
|
|
|
|
=item value example 4 |
5634
|
|
|
|
|
|
|
|
5635
|
|
|
|
|
|
|
# given: synopsis |
5636
|
|
|
|
|
|
|
|
5637
|
|
|
|
|
|
|
package main; |
5638
|
|
|
|
|
|
|
|
5639
|
|
|
|
|
|
|
$check = $check->value; |
5640
|
|
|
|
|
|
|
|
5641
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5642
|
|
|
|
|
|
|
|
5643
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
5644
|
|
|
|
|
|
|
|
5645
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_defined) |
5646
|
|
|
|
|
|
|
|
5647
|
|
|
|
|
|
|
=back |
5648
|
|
|
|
|
|
|
|
5649
|
|
|
|
|
|
|
=over 4 |
5650
|
|
|
|
|
|
|
|
5651
|
|
|
|
|
|
|
=item value example 5 |
5652
|
|
|
|
|
|
|
|
5653
|
|
|
|
|
|
|
# given: synopsis |
5654
|
|
|
|
|
|
|
|
5655
|
|
|
|
|
|
|
package main; |
5656
|
|
|
|
|
|
|
|
5657
|
|
|
|
|
|
|
$check = $check->value; |
5658
|
|
|
|
|
|
|
|
5659
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5660
|
|
|
|
|
|
|
|
5661
|
|
|
|
|
|
|
# my $result = $check->result({}); |
5662
|
|
|
|
|
|
|
|
5663
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_value) |
5664
|
|
|
|
|
|
|
|
5665
|
|
|
|
|
|
|
=back |
5666
|
|
|
|
|
|
|
|
5667
|
|
|
|
|
|
|
=cut |
5668
|
|
|
|
|
|
|
|
5669
|
|
|
|
|
|
|
=head2 within |
5670
|
|
|
|
|
|
|
|
5671
|
|
|
|
|
|
|
within(string $type, string | within[arrayref, string] @args) (Venus::Check) |
5672
|
|
|
|
|
|
|
|
5673
|
|
|
|
|
|
|
The within method configures the object, registering a constraint action as a |
5674
|
|
|
|
|
|
|
sub-match operation, to accept array or hash based values, and returns a new |
5675
|
|
|
|
|
|
|
L instance for the sub-match operation (not the invocant). This |
5676
|
|
|
|
|
|
|
operation can traverse blessed array or hash based values. The value being |
5677
|
|
|
|
|
|
|
evaluated must contain at-least one element to match. |
5678
|
|
|
|
|
|
|
|
5679
|
|
|
|
|
|
|
I> |
5680
|
|
|
|
|
|
|
|
5681
|
|
|
|
|
|
|
=over 4 |
5682
|
|
|
|
|
|
|
|
5683
|
|
|
|
|
|
|
=item within example 1 |
5684
|
|
|
|
|
|
|
|
5685
|
|
|
|
|
|
|
# given: synopsis |
5686
|
|
|
|
|
|
|
|
5687
|
|
|
|
|
|
|
package main; |
5688
|
|
|
|
|
|
|
|
5689
|
|
|
|
|
|
|
my $within = $check->within('arrayref', 'string'); |
5690
|
|
|
|
|
|
|
|
5691
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5692
|
|
|
|
|
|
|
|
5693
|
|
|
|
|
|
|
$check; |
5694
|
|
|
|
|
|
|
|
5695
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5696
|
|
|
|
|
|
|
|
5697
|
|
|
|
|
|
|
# my $result = $check->eval(['hello']); |
5698
|
|
|
|
|
|
|
|
5699
|
|
|
|
|
|
|
# true |
5700
|
|
|
|
|
|
|
|
5701
|
|
|
|
|
|
|
=back |
5702
|
|
|
|
|
|
|
|
5703
|
|
|
|
|
|
|
=over 4 |
5704
|
|
|
|
|
|
|
|
5705
|
|
|
|
|
|
|
=item within example 2 |
5706
|
|
|
|
|
|
|
|
5707
|
|
|
|
|
|
|
# given: synopsis |
5708
|
|
|
|
|
|
|
|
5709
|
|
|
|
|
|
|
package main; |
5710
|
|
|
|
|
|
|
|
5711
|
|
|
|
|
|
|
my $within = $check->within('arrayref', 'string'); |
5712
|
|
|
|
|
|
|
|
5713
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5714
|
|
|
|
|
|
|
|
5715
|
|
|
|
|
|
|
$check; |
5716
|
|
|
|
|
|
|
|
5717
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5718
|
|
|
|
|
|
|
|
5719
|
|
|
|
|
|
|
# my $result = $check->eval([]); |
5720
|
|
|
|
|
|
|
|
5721
|
|
|
|
|
|
|
# false |
5722
|
|
|
|
|
|
|
|
5723
|
|
|
|
|
|
|
=back |
5724
|
|
|
|
|
|
|
|
5725
|
|
|
|
|
|
|
=over 4 |
5726
|
|
|
|
|
|
|
|
5727
|
|
|
|
|
|
|
=item within example 3 |
5728
|
|
|
|
|
|
|
|
5729
|
|
|
|
|
|
|
# given: synopsis |
5730
|
|
|
|
|
|
|
|
5731
|
|
|
|
|
|
|
package main; |
5732
|
|
|
|
|
|
|
|
5733
|
|
|
|
|
|
|
my $within = $check->within('arrayref', 'string'); |
5734
|
|
|
|
|
|
|
|
5735
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5736
|
|
|
|
|
|
|
|
5737
|
|
|
|
|
|
|
$check; |
5738
|
|
|
|
|
|
|
|
5739
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5740
|
|
|
|
|
|
|
|
5741
|
|
|
|
|
|
|
# my $result = $check->result(['hello']); |
5742
|
|
|
|
|
|
|
|
5743
|
|
|
|
|
|
|
# ['hello'] |
5744
|
|
|
|
|
|
|
|
5745
|
|
|
|
|
|
|
=back |
5746
|
|
|
|
|
|
|
|
5747
|
|
|
|
|
|
|
=over 4 |
5748
|
|
|
|
|
|
|
|
5749
|
|
|
|
|
|
|
=item within example 4 |
5750
|
|
|
|
|
|
|
|
5751
|
|
|
|
|
|
|
# given: synopsis |
5752
|
|
|
|
|
|
|
|
5753
|
|
|
|
|
|
|
package main; |
5754
|
|
|
|
|
|
|
|
5755
|
|
|
|
|
|
|
my $within = $check->within('arrayref', 'string'); |
5756
|
|
|
|
|
|
|
|
5757
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5758
|
|
|
|
|
|
|
|
5759
|
|
|
|
|
|
|
$check; |
5760
|
|
|
|
|
|
|
|
5761
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5762
|
|
|
|
|
|
|
|
5763
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
5764
|
|
|
|
|
|
|
|
5765
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_defined) |
5766
|
|
|
|
|
|
|
|
5767
|
|
|
|
|
|
|
=back |
5768
|
|
|
|
|
|
|
|
5769
|
|
|
|
|
|
|
=over 4 |
5770
|
|
|
|
|
|
|
|
5771
|
|
|
|
|
|
|
=item within example 5 |
5772
|
|
|
|
|
|
|
|
5773
|
|
|
|
|
|
|
# given: synopsis |
5774
|
|
|
|
|
|
|
|
5775
|
|
|
|
|
|
|
package main; |
5776
|
|
|
|
|
|
|
|
5777
|
|
|
|
|
|
|
my $within = $check->within('arrayref', 'string'); |
5778
|
|
|
|
|
|
|
|
5779
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5780
|
|
|
|
|
|
|
|
5781
|
|
|
|
|
|
|
$check; |
5782
|
|
|
|
|
|
|
|
5783
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5784
|
|
|
|
|
|
|
|
5785
|
|
|
|
|
|
|
# my $result = $check->result({}); |
5786
|
|
|
|
|
|
|
|
5787
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_arrayref) |
5788
|
|
|
|
|
|
|
|
5789
|
|
|
|
|
|
|
=back |
5790
|
|
|
|
|
|
|
|
5791
|
|
|
|
|
|
|
=over 4 |
5792
|
|
|
|
|
|
|
|
5793
|
|
|
|
|
|
|
=item within example 6 |
5794
|
|
|
|
|
|
|
|
5795
|
|
|
|
|
|
|
# given: synopsis |
5796
|
|
|
|
|
|
|
|
5797
|
|
|
|
|
|
|
package main; |
5798
|
|
|
|
|
|
|
|
5799
|
|
|
|
|
|
|
my $within = $check->within('arrayref', 'string'); |
5800
|
|
|
|
|
|
|
|
5801
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5802
|
|
|
|
|
|
|
|
5803
|
|
|
|
|
|
|
$check; |
5804
|
|
|
|
|
|
|
|
5805
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5806
|
|
|
|
|
|
|
|
5807
|
|
|
|
|
|
|
# my $result = $check->result([]); |
5808
|
|
|
|
|
|
|
|
5809
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_arrayref_count) |
5810
|
|
|
|
|
|
|
|
5811
|
|
|
|
|
|
|
=back |
5812
|
|
|
|
|
|
|
|
5813
|
|
|
|
|
|
|
=over 4 |
5814
|
|
|
|
|
|
|
|
5815
|
|
|
|
|
|
|
=item within example 7 |
5816
|
|
|
|
|
|
|
|
5817
|
|
|
|
|
|
|
# given: synopsis |
5818
|
|
|
|
|
|
|
|
5819
|
|
|
|
|
|
|
package main; |
5820
|
|
|
|
|
|
|
|
5821
|
|
|
|
|
|
|
my $within = $check->within('arrayref', 'string'); |
5822
|
|
|
|
|
|
|
|
5823
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5824
|
|
|
|
|
|
|
|
5825
|
|
|
|
|
|
|
$check; |
5826
|
|
|
|
|
|
|
|
5827
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5828
|
|
|
|
|
|
|
|
5829
|
|
|
|
|
|
|
# my $result = $check->result([rand]); |
5830
|
|
|
|
|
|
|
|
5831
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
5832
|
|
|
|
|
|
|
|
5833
|
|
|
|
|
|
|
=back |
5834
|
|
|
|
|
|
|
|
5835
|
|
|
|
|
|
|
=over 4 |
5836
|
|
|
|
|
|
|
|
5837
|
|
|
|
|
|
|
=item within example 8 |
5838
|
|
|
|
|
|
|
|
5839
|
|
|
|
|
|
|
# given: synopsis |
5840
|
|
|
|
|
|
|
|
5841
|
|
|
|
|
|
|
package main; |
5842
|
|
|
|
|
|
|
|
5843
|
|
|
|
|
|
|
my $within = $check->within('hashref', 'string'); |
5844
|
|
|
|
|
|
|
|
5845
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5846
|
|
|
|
|
|
|
|
5847
|
|
|
|
|
|
|
$check; |
5848
|
|
|
|
|
|
|
|
5849
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5850
|
|
|
|
|
|
|
|
5851
|
|
|
|
|
|
|
# my $result = $check->eval({title => 'hello'}); |
5852
|
|
|
|
|
|
|
|
5853
|
|
|
|
|
|
|
# true |
5854
|
|
|
|
|
|
|
|
5855
|
|
|
|
|
|
|
=back |
5856
|
|
|
|
|
|
|
|
5857
|
|
|
|
|
|
|
=over 4 |
5858
|
|
|
|
|
|
|
|
5859
|
|
|
|
|
|
|
=item within example 9 |
5860
|
|
|
|
|
|
|
|
5861
|
|
|
|
|
|
|
# given: synopsis |
5862
|
|
|
|
|
|
|
|
5863
|
|
|
|
|
|
|
package main; |
5864
|
|
|
|
|
|
|
|
5865
|
|
|
|
|
|
|
my $within = $check->within('hashref', 'string'); |
5866
|
|
|
|
|
|
|
|
5867
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5868
|
|
|
|
|
|
|
|
5869
|
|
|
|
|
|
|
$check; |
5870
|
|
|
|
|
|
|
|
5871
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5872
|
|
|
|
|
|
|
|
5873
|
|
|
|
|
|
|
# my $result = $check->eval({}); |
5874
|
|
|
|
|
|
|
|
5875
|
|
|
|
|
|
|
# false |
5876
|
|
|
|
|
|
|
|
5877
|
|
|
|
|
|
|
=back |
5878
|
|
|
|
|
|
|
|
5879
|
|
|
|
|
|
|
=over 4 |
5880
|
|
|
|
|
|
|
|
5881
|
|
|
|
|
|
|
=item within example 10 |
5882
|
|
|
|
|
|
|
|
5883
|
|
|
|
|
|
|
# given: synopsis |
5884
|
|
|
|
|
|
|
|
5885
|
|
|
|
|
|
|
package main; |
5886
|
|
|
|
|
|
|
|
5887
|
|
|
|
|
|
|
my $within = $check->within('hashref', 'string'); |
5888
|
|
|
|
|
|
|
|
5889
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5890
|
|
|
|
|
|
|
|
5891
|
|
|
|
|
|
|
$check; |
5892
|
|
|
|
|
|
|
|
5893
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5894
|
|
|
|
|
|
|
|
5895
|
|
|
|
|
|
|
# my $result = $check->result({title => 'hello'}); |
5896
|
|
|
|
|
|
|
|
5897
|
|
|
|
|
|
|
# {title => 'hello'} |
5898
|
|
|
|
|
|
|
|
5899
|
|
|
|
|
|
|
=back |
5900
|
|
|
|
|
|
|
|
5901
|
|
|
|
|
|
|
=over 4 |
5902
|
|
|
|
|
|
|
|
5903
|
|
|
|
|
|
|
=item within example 11 |
5904
|
|
|
|
|
|
|
|
5905
|
|
|
|
|
|
|
# given: synopsis |
5906
|
|
|
|
|
|
|
|
5907
|
|
|
|
|
|
|
package main; |
5908
|
|
|
|
|
|
|
|
5909
|
|
|
|
|
|
|
my $within = $check->within('hashref', 'string'); |
5910
|
|
|
|
|
|
|
|
5911
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5912
|
|
|
|
|
|
|
|
5913
|
|
|
|
|
|
|
$check; |
5914
|
|
|
|
|
|
|
|
5915
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5916
|
|
|
|
|
|
|
|
5917
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
5918
|
|
|
|
|
|
|
|
5919
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_defined) |
5920
|
|
|
|
|
|
|
|
5921
|
|
|
|
|
|
|
=back |
5922
|
|
|
|
|
|
|
|
5923
|
|
|
|
|
|
|
=over 4 |
5924
|
|
|
|
|
|
|
|
5925
|
|
|
|
|
|
|
=item within example 12 |
5926
|
|
|
|
|
|
|
|
5927
|
|
|
|
|
|
|
# given: synopsis |
5928
|
|
|
|
|
|
|
|
5929
|
|
|
|
|
|
|
package main; |
5930
|
|
|
|
|
|
|
|
5931
|
|
|
|
|
|
|
my $within = $check->within('hashref', 'string'); |
5932
|
|
|
|
|
|
|
|
5933
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5934
|
|
|
|
|
|
|
|
5935
|
|
|
|
|
|
|
$check; |
5936
|
|
|
|
|
|
|
|
5937
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5938
|
|
|
|
|
|
|
|
5939
|
|
|
|
|
|
|
# my $result = $check->result([]); |
5940
|
|
|
|
|
|
|
|
5941
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_hashref) |
5942
|
|
|
|
|
|
|
|
5943
|
|
|
|
|
|
|
=back |
5944
|
|
|
|
|
|
|
|
5945
|
|
|
|
|
|
|
=over 4 |
5946
|
|
|
|
|
|
|
|
5947
|
|
|
|
|
|
|
=item within example 13 |
5948
|
|
|
|
|
|
|
|
5949
|
|
|
|
|
|
|
# given: synopsis |
5950
|
|
|
|
|
|
|
|
5951
|
|
|
|
|
|
|
package main; |
5952
|
|
|
|
|
|
|
|
5953
|
|
|
|
|
|
|
my $within = $check->within('hashref', 'string'); |
5954
|
|
|
|
|
|
|
|
5955
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5956
|
|
|
|
|
|
|
|
5957
|
|
|
|
|
|
|
$check; |
5958
|
|
|
|
|
|
|
|
5959
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5960
|
|
|
|
|
|
|
|
5961
|
|
|
|
|
|
|
# my $result = $check->result({}); |
5962
|
|
|
|
|
|
|
|
5963
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_hashref_empty) |
5964
|
|
|
|
|
|
|
|
5965
|
|
|
|
|
|
|
=back |
5966
|
|
|
|
|
|
|
|
5967
|
|
|
|
|
|
|
=over 4 |
5968
|
|
|
|
|
|
|
|
5969
|
|
|
|
|
|
|
=item within example 14 |
5970
|
|
|
|
|
|
|
|
5971
|
|
|
|
|
|
|
# given: synopsis |
5972
|
|
|
|
|
|
|
|
5973
|
|
|
|
|
|
|
package main; |
5974
|
|
|
|
|
|
|
|
5975
|
|
|
|
|
|
|
my $within = $check->within('hashref', 'string'); |
5976
|
|
|
|
|
|
|
|
5977
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5978
|
|
|
|
|
|
|
|
5979
|
|
|
|
|
|
|
$check; |
5980
|
|
|
|
|
|
|
|
5981
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
5982
|
|
|
|
|
|
|
|
5983
|
|
|
|
|
|
|
# my $result = $check->result({title => rand}); |
5984
|
|
|
|
|
|
|
|
5985
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_coded) |
5986
|
|
|
|
|
|
|
|
5987
|
|
|
|
|
|
|
=back |
5988
|
|
|
|
|
|
|
|
5989
|
|
|
|
|
|
|
=cut |
5990
|
|
|
|
|
|
|
|
5991
|
|
|
|
|
|
|
=head2 yesno |
5992
|
|
|
|
|
|
|
|
5993
|
|
|
|
|
|
|
yesno(coderef @code) (Venus::Check) |
5994
|
|
|
|
|
|
|
|
5995
|
|
|
|
|
|
|
The yesno method configures the object to accept a string value, that's case |
5996
|
|
|
|
|
|
|
insensitive, and that's either C<"y"> or C<"yes"> or C<1> or C<"n"> or C<"no"> |
5997
|
|
|
|
|
|
|
or C<0>, and returns the invocant. |
5998
|
|
|
|
|
|
|
|
5999
|
|
|
|
|
|
|
I> |
6000
|
|
|
|
|
|
|
|
6001
|
|
|
|
|
|
|
=over 4 |
6002
|
|
|
|
|
|
|
|
6003
|
|
|
|
|
|
|
=item yesno example 1 |
6004
|
|
|
|
|
|
|
|
6005
|
|
|
|
|
|
|
# given: synopsis |
6006
|
|
|
|
|
|
|
|
6007
|
|
|
|
|
|
|
package main; |
6008
|
|
|
|
|
|
|
|
6009
|
|
|
|
|
|
|
$check = $check->yesno; |
6010
|
|
|
|
|
|
|
|
6011
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
6012
|
|
|
|
|
|
|
|
6013
|
|
|
|
|
|
|
# my $result = $check->eval('yes'); |
6014
|
|
|
|
|
|
|
|
6015
|
|
|
|
|
|
|
# true |
6016
|
|
|
|
|
|
|
|
6017
|
|
|
|
|
|
|
=back |
6018
|
|
|
|
|
|
|
|
6019
|
|
|
|
|
|
|
=over 4 |
6020
|
|
|
|
|
|
|
|
6021
|
|
|
|
|
|
|
=item yesno example 2 |
6022
|
|
|
|
|
|
|
|
6023
|
|
|
|
|
|
|
# given: synopsis |
6024
|
|
|
|
|
|
|
|
6025
|
|
|
|
|
|
|
package main; |
6026
|
|
|
|
|
|
|
|
6027
|
|
|
|
|
|
|
$check = $check->yesno; |
6028
|
|
|
|
|
|
|
|
6029
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
6030
|
|
|
|
|
|
|
|
6031
|
|
|
|
|
|
|
# my $result = $check->eval('yup'); |
6032
|
|
|
|
|
|
|
|
6033
|
|
|
|
|
|
|
# false |
6034
|
|
|
|
|
|
|
|
6035
|
|
|
|
|
|
|
=back |
6036
|
|
|
|
|
|
|
|
6037
|
|
|
|
|
|
|
=over 4 |
6038
|
|
|
|
|
|
|
|
6039
|
|
|
|
|
|
|
=item yesno example 3 |
6040
|
|
|
|
|
|
|
|
6041
|
|
|
|
|
|
|
# given: synopsis |
6042
|
|
|
|
|
|
|
|
6043
|
|
|
|
|
|
|
package main; |
6044
|
|
|
|
|
|
|
|
6045
|
|
|
|
|
|
|
$check = $check->yesno; |
6046
|
|
|
|
|
|
|
|
6047
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
6048
|
|
|
|
|
|
|
|
6049
|
|
|
|
|
|
|
# my $result = $check->result('yes'); |
6050
|
|
|
|
|
|
|
|
6051
|
|
|
|
|
|
|
# 'yes' |
6052
|
|
|
|
|
|
|
|
6053
|
|
|
|
|
|
|
=back |
6054
|
|
|
|
|
|
|
|
6055
|
|
|
|
|
|
|
=over 4 |
6056
|
|
|
|
|
|
|
|
6057
|
|
|
|
|
|
|
=item yesno example 4 |
6058
|
|
|
|
|
|
|
|
6059
|
|
|
|
|
|
|
# given: synopsis |
6060
|
|
|
|
|
|
|
|
6061
|
|
|
|
|
|
|
package main; |
6062
|
|
|
|
|
|
|
|
6063
|
|
|
|
|
|
|
$check = $check->yesno; |
6064
|
|
|
|
|
|
|
|
6065
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
6066
|
|
|
|
|
|
|
|
6067
|
|
|
|
|
|
|
# my $result = $check->result(undef); |
6068
|
|
|
|
|
|
|
|
6069
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_defined) |
6070
|
|
|
|
|
|
|
|
6071
|
|
|
|
|
|
|
=back |
6072
|
|
|
|
|
|
|
|
6073
|
|
|
|
|
|
|
=over 4 |
6074
|
|
|
|
|
|
|
|
6075
|
|
|
|
|
|
|
=item yesno example 5 |
6076
|
|
|
|
|
|
|
|
6077
|
|
|
|
|
|
|
# given: synopsis |
6078
|
|
|
|
|
|
|
|
6079
|
|
|
|
|
|
|
package main; |
6080
|
|
|
|
|
|
|
|
6081
|
|
|
|
|
|
|
$check = $check->yesno; |
6082
|
|
|
|
|
|
|
|
6083
|
|
|
|
|
|
|
# bless(..., 'Venus::Check') |
6084
|
|
|
|
|
|
|
|
6085
|
|
|
|
|
|
|
# my $result = $check->result('yup'); |
6086
|
|
|
|
|
|
|
|
6087
|
|
|
|
|
|
|
# Exception! (isa Venus::Check::Error) (see error_on_yesno) |
6088
|
|
|
|
|
|
|
|
6089
|
|
|
|
|
|
|
=back |
6090
|
|
|
|
|
|
|
|
6091
|
|
|
|
|
|
|
=cut |
6092
|
|
|
|
|
|
|
|
6093
|
|
|
|
|
|
|
=head1 ERRORS |
6094
|
|
|
|
|
|
|
|
6095
|
|
|
|
|
|
|
This package may raise the following errors: |
6096
|
|
|
|
|
|
|
|
6097
|
|
|
|
|
|
|
=cut |
6098
|
|
|
|
|
|
|
|
6099
|
|
|
|
|
|
|
=over 4 |
6100
|
|
|
|
|
|
|
|
6101
|
|
|
|
|
|
|
=item error: C |
6102
|
|
|
|
|
|
|
|
6103
|
|
|
|
|
|
|
This package may raise an error_on_arrayref exception. |
6104
|
|
|
|
|
|
|
|
6105
|
|
|
|
|
|
|
B |
6106
|
|
|
|
|
|
|
|
6107
|
|
|
|
|
|
|
# given: synopsis; |
6108
|
|
|
|
|
|
|
|
6109
|
|
|
|
|
|
|
my $input = { |
6110
|
|
|
|
|
|
|
at => '.', |
6111
|
|
|
|
|
|
|
from => 'test', |
6112
|
|
|
|
|
|
|
throw => 'error_on_arrayref', |
6113
|
|
|
|
|
|
|
}; |
6114
|
|
|
|
|
|
|
|
6115
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6116
|
|
|
|
|
|
|
|
6117
|
|
|
|
|
|
|
# my $name = $error->name; |
6118
|
|
|
|
|
|
|
|
6119
|
|
|
|
|
|
|
# "on_arrayref" |
6120
|
|
|
|
|
|
|
|
6121
|
|
|
|
|
|
|
# my $message = $error->render; |
6122
|
|
|
|
|
|
|
|
6123
|
|
|
|
|
|
|
# "Failed checking test, value provided is not an arrayref or arrayref derived, at ." |
6124
|
|
|
|
|
|
|
|
6125
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6126
|
|
|
|
|
|
|
|
6127
|
|
|
|
|
|
|
# "test" |
6128
|
|
|
|
|
|
|
|
6129
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6130
|
|
|
|
|
|
|
|
6131
|
|
|
|
|
|
|
# "." |
6132
|
|
|
|
|
|
|
|
6133
|
|
|
|
|
|
|
=back |
6134
|
|
|
|
|
|
|
|
6135
|
|
|
|
|
|
|
=over 4 |
6136
|
|
|
|
|
|
|
|
6137
|
|
|
|
|
|
|
=item error: C |
6138
|
|
|
|
|
|
|
|
6139
|
|
|
|
|
|
|
This package may raise an error_on_arrayref_count exception. |
6140
|
|
|
|
|
|
|
|
6141
|
|
|
|
|
|
|
B |
6142
|
|
|
|
|
|
|
|
6143
|
|
|
|
|
|
|
# given: synopsis; |
6144
|
|
|
|
|
|
|
|
6145
|
|
|
|
|
|
|
my $input = { |
6146
|
|
|
|
|
|
|
at => '.', |
6147
|
|
|
|
|
|
|
from => 'test', |
6148
|
|
|
|
|
|
|
throw => 'error_on_arrayref_count', |
6149
|
|
|
|
|
|
|
}; |
6150
|
|
|
|
|
|
|
|
6151
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6152
|
|
|
|
|
|
|
|
6153
|
|
|
|
|
|
|
# my $name = $error->name; |
6154
|
|
|
|
|
|
|
|
6155
|
|
|
|
|
|
|
# "on_arrayref_count" |
6156
|
|
|
|
|
|
|
|
6157
|
|
|
|
|
|
|
# my $message = $error->render; |
6158
|
|
|
|
|
|
|
|
6159
|
|
|
|
|
|
|
# "Failed checking test, incorrect item count in arrayref or arrayref derived object, at ." |
6160
|
|
|
|
|
|
|
|
6161
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6162
|
|
|
|
|
|
|
|
6163
|
|
|
|
|
|
|
# "test" |
6164
|
|
|
|
|
|
|
|
6165
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6166
|
|
|
|
|
|
|
|
6167
|
|
|
|
|
|
|
# "." |
6168
|
|
|
|
|
|
|
|
6169
|
|
|
|
|
|
|
=back |
6170
|
|
|
|
|
|
|
|
6171
|
|
|
|
|
|
|
=over 4 |
6172
|
|
|
|
|
|
|
|
6173
|
|
|
|
|
|
|
=item error: C |
6174
|
|
|
|
|
|
|
|
6175
|
|
|
|
|
|
|
This package may raise an error_on_coded exception. |
6176
|
|
|
|
|
|
|
|
6177
|
|
|
|
|
|
|
B |
6178
|
|
|
|
|
|
|
|
6179
|
|
|
|
|
|
|
# given: synopsis; |
6180
|
|
|
|
|
|
|
|
6181
|
|
|
|
|
|
|
my $input = { |
6182
|
|
|
|
|
|
|
at => '.', |
6183
|
|
|
|
|
|
|
from => 'test', |
6184
|
|
|
|
|
|
|
expected => 'string', |
6185
|
|
|
|
|
|
|
received => 'number', |
6186
|
|
|
|
|
|
|
throw => 'error_on_coded', |
6187
|
|
|
|
|
|
|
}; |
6188
|
|
|
|
|
|
|
|
6189
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6190
|
|
|
|
|
|
|
|
6191
|
|
|
|
|
|
|
# my $name = $error->name; |
6192
|
|
|
|
|
|
|
|
6193
|
|
|
|
|
|
|
# "on_coded" |
6194
|
|
|
|
|
|
|
|
6195
|
|
|
|
|
|
|
# my $message = $error->render; |
6196
|
|
|
|
|
|
|
|
6197
|
|
|
|
|
|
|
# "Failed checking test, expected string, received number, at ." |
6198
|
|
|
|
|
|
|
|
6199
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6200
|
|
|
|
|
|
|
|
6201
|
|
|
|
|
|
|
# "test" |
6202
|
|
|
|
|
|
|
|
6203
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6204
|
|
|
|
|
|
|
|
6205
|
|
|
|
|
|
|
# "." |
6206
|
|
|
|
|
|
|
|
6207
|
|
|
|
|
|
|
# my $expected = $error->stash('expected'); |
6208
|
|
|
|
|
|
|
|
6209
|
|
|
|
|
|
|
# "string" |
6210
|
|
|
|
|
|
|
|
6211
|
|
|
|
|
|
|
# my $received = $error->stash('received'); |
6212
|
|
|
|
|
|
|
|
6213
|
|
|
|
|
|
|
# "number" |
6214
|
|
|
|
|
|
|
|
6215
|
|
|
|
|
|
|
=back |
6216
|
|
|
|
|
|
|
|
6217
|
|
|
|
|
|
|
=over 4 |
6218
|
|
|
|
|
|
|
|
6219
|
|
|
|
|
|
|
=item error: C |
6220
|
|
|
|
|
|
|
|
6221
|
|
|
|
|
|
|
This package may raise an error_on_consumes exception. |
6222
|
|
|
|
|
|
|
|
6223
|
|
|
|
|
|
|
B |
6224
|
|
|
|
|
|
|
|
6225
|
|
|
|
|
|
|
# given: synopsis; |
6226
|
|
|
|
|
|
|
|
6227
|
|
|
|
|
|
|
my $input = { |
6228
|
|
|
|
|
|
|
at => '.', |
6229
|
|
|
|
|
|
|
from => 'test', |
6230
|
|
|
|
|
|
|
role => 'Example::Role', |
6231
|
|
|
|
|
|
|
throw => 'error_on_consumes', |
6232
|
|
|
|
|
|
|
}; |
6233
|
|
|
|
|
|
|
|
6234
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6235
|
|
|
|
|
|
|
|
6236
|
|
|
|
|
|
|
# my $name = $error->name; |
6237
|
|
|
|
|
|
|
|
6238
|
|
|
|
|
|
|
# "on_consumes" |
6239
|
|
|
|
|
|
|
|
6240
|
|
|
|
|
|
|
# my $message = $error->render; |
6241
|
|
|
|
|
|
|
|
6242
|
|
|
|
|
|
|
# "Failed checking test, object does not consume the role \"Example::Role\", at ." |
6243
|
|
|
|
|
|
|
|
6244
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6245
|
|
|
|
|
|
|
|
6246
|
|
|
|
|
|
|
# "test" |
6247
|
|
|
|
|
|
|
|
6248
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6249
|
|
|
|
|
|
|
|
6250
|
|
|
|
|
|
|
# "." |
6251
|
|
|
|
|
|
|
|
6252
|
|
|
|
|
|
|
# my $role = $error->stash('role'); |
6253
|
|
|
|
|
|
|
|
6254
|
|
|
|
|
|
|
# "Example::Role" |
6255
|
|
|
|
|
|
|
|
6256
|
|
|
|
|
|
|
=back |
6257
|
|
|
|
|
|
|
|
6258
|
|
|
|
|
|
|
=over 4 |
6259
|
|
|
|
|
|
|
|
6260
|
|
|
|
|
|
|
=item error: C |
6261
|
|
|
|
|
|
|
|
6262
|
|
|
|
|
|
|
This package may raise an error_on_defined exception. |
6263
|
|
|
|
|
|
|
|
6264
|
|
|
|
|
|
|
B |
6265
|
|
|
|
|
|
|
|
6266
|
|
|
|
|
|
|
# given: synopsis; |
6267
|
|
|
|
|
|
|
|
6268
|
|
|
|
|
|
|
my $input = { |
6269
|
|
|
|
|
|
|
at => '.', |
6270
|
|
|
|
|
|
|
from => 'test', |
6271
|
|
|
|
|
|
|
throw => 'error_on_defined', |
6272
|
|
|
|
|
|
|
}; |
6273
|
|
|
|
|
|
|
|
6274
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6275
|
|
|
|
|
|
|
|
6276
|
|
|
|
|
|
|
# my $name = $error->name; |
6277
|
|
|
|
|
|
|
|
6278
|
|
|
|
|
|
|
# "on_defined" |
6279
|
|
|
|
|
|
|
|
6280
|
|
|
|
|
|
|
# my $message = $error->render; |
6281
|
|
|
|
|
|
|
|
6282
|
|
|
|
|
|
|
# "Failed checking test, value provided is undefined, at ." |
6283
|
|
|
|
|
|
|
|
6284
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6285
|
|
|
|
|
|
|
|
6286
|
|
|
|
|
|
|
# "test" |
6287
|
|
|
|
|
|
|
|
6288
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6289
|
|
|
|
|
|
|
|
6290
|
|
|
|
|
|
|
# "." |
6291
|
|
|
|
|
|
|
|
6292
|
|
|
|
|
|
|
=back |
6293
|
|
|
|
|
|
|
|
6294
|
|
|
|
|
|
|
=over 4 |
6295
|
|
|
|
|
|
|
|
6296
|
|
|
|
|
|
|
=item error: C |
6297
|
|
|
|
|
|
|
|
6298
|
|
|
|
|
|
|
This package may raise an error_on_either exception. |
6299
|
|
|
|
|
|
|
|
6300
|
|
|
|
|
|
|
B |
6301
|
|
|
|
|
|
|
|
6302
|
|
|
|
|
|
|
# given: synopsis; |
6303
|
|
|
|
|
|
|
|
6304
|
|
|
|
|
|
|
my $input = { |
6305
|
|
|
|
|
|
|
at => '.', |
6306
|
|
|
|
|
|
|
from => 'test', |
6307
|
|
|
|
|
|
|
errors => [ |
6308
|
|
|
|
|
|
|
'Failed condition 1', |
6309
|
|
|
|
|
|
|
'Failed condition 2', |
6310
|
|
|
|
|
|
|
], |
6311
|
|
|
|
|
|
|
throw => 'error_on_either', |
6312
|
|
|
|
|
|
|
}; |
6313
|
|
|
|
|
|
|
|
6314
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6315
|
|
|
|
|
|
|
|
6316
|
|
|
|
|
|
|
# my $name = $error->name; |
6317
|
|
|
|
|
|
|
|
6318
|
|
|
|
|
|
|
# "on_either" |
6319
|
|
|
|
|
|
|
|
6320
|
|
|
|
|
|
|
# my $message = $error->render; |
6321
|
|
|
|
|
|
|
|
6322
|
|
|
|
|
|
|
# "Failed checking either-or condition:\n\nFailed condition 1\n\nFailed condition 2" |
6323
|
|
|
|
|
|
|
|
6324
|
|
|
|
|
|
|
# my $errors = $error->stash('errors'); |
6325
|
|
|
|
|
|
|
|
6326
|
|
|
|
|
|
|
# ['Failed condition 1', Failed condition 2'] |
6327
|
|
|
|
|
|
|
|
6328
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6329
|
|
|
|
|
|
|
|
6330
|
|
|
|
|
|
|
# "test" |
6331
|
|
|
|
|
|
|
|
6332
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6333
|
|
|
|
|
|
|
|
6334
|
|
|
|
|
|
|
# "." |
6335
|
|
|
|
|
|
|
|
6336
|
|
|
|
|
|
|
=back |
6337
|
|
|
|
|
|
|
|
6338
|
|
|
|
|
|
|
=over 4 |
6339
|
|
|
|
|
|
|
|
6340
|
|
|
|
|
|
|
=item error: C |
6341
|
|
|
|
|
|
|
|
6342
|
|
|
|
|
|
|
This package may raise an error_on_enum exception. |
6343
|
|
|
|
|
|
|
|
6344
|
|
|
|
|
|
|
B |
6345
|
|
|
|
|
|
|
|
6346
|
|
|
|
|
|
|
# given: synopsis; |
6347
|
|
|
|
|
|
|
|
6348
|
|
|
|
|
|
|
my $input = { |
6349
|
|
|
|
|
|
|
at => '.', |
6350
|
|
|
|
|
|
|
from => 'test', |
6351
|
|
|
|
|
|
|
data => 'black', |
6352
|
|
|
|
|
|
|
enum => ['this', 'that'], |
6353
|
|
|
|
|
|
|
throw => 'error_on_enum', |
6354
|
|
|
|
|
|
|
}; |
6355
|
|
|
|
|
|
|
|
6356
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6357
|
|
|
|
|
|
|
|
6358
|
|
|
|
|
|
|
# my $name = $error->name; |
6359
|
|
|
|
|
|
|
|
6360
|
|
|
|
|
|
|
# "on_enum" |
6361
|
|
|
|
|
|
|
|
6362
|
|
|
|
|
|
|
# my $message = $error->render; |
6363
|
|
|
|
|
|
|
|
6364
|
|
|
|
|
|
|
# "Failed checking test, received black, valid options are this, that, at ." |
6365
|
|
|
|
|
|
|
|
6366
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6367
|
|
|
|
|
|
|
|
6368
|
|
|
|
|
|
|
# "test" |
6369
|
|
|
|
|
|
|
|
6370
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6371
|
|
|
|
|
|
|
|
6372
|
|
|
|
|
|
|
# "." |
6373
|
|
|
|
|
|
|
|
6374
|
|
|
|
|
|
|
# my $data = $error->stash('data'); |
6375
|
|
|
|
|
|
|
|
6376
|
|
|
|
|
|
|
# "black" |
6377
|
|
|
|
|
|
|
|
6378
|
|
|
|
|
|
|
# my $enum = $error->stash('enum'); |
6379
|
|
|
|
|
|
|
|
6380
|
|
|
|
|
|
|
# ['this', 'that'] |
6381
|
|
|
|
|
|
|
|
6382
|
|
|
|
|
|
|
=back |
6383
|
|
|
|
|
|
|
|
6384
|
|
|
|
|
|
|
=over 4 |
6385
|
|
|
|
|
|
|
|
6386
|
|
|
|
|
|
|
=item error: C |
6387
|
|
|
|
|
|
|
|
6388
|
|
|
|
|
|
|
This package may raise an error_on_hashref exception. |
6389
|
|
|
|
|
|
|
|
6390
|
|
|
|
|
|
|
B |
6391
|
|
|
|
|
|
|
|
6392
|
|
|
|
|
|
|
# given: synopsis; |
6393
|
|
|
|
|
|
|
|
6394
|
|
|
|
|
|
|
my $input = { |
6395
|
|
|
|
|
|
|
at => '.', |
6396
|
|
|
|
|
|
|
from => 'test', |
6397
|
|
|
|
|
|
|
throw => 'error_on_hashref', |
6398
|
|
|
|
|
|
|
}; |
6399
|
|
|
|
|
|
|
|
6400
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6401
|
|
|
|
|
|
|
|
6402
|
|
|
|
|
|
|
# my $name = $error->name; |
6403
|
|
|
|
|
|
|
|
6404
|
|
|
|
|
|
|
# "on_hashref" |
6405
|
|
|
|
|
|
|
|
6406
|
|
|
|
|
|
|
# my $message = $error->render; |
6407
|
|
|
|
|
|
|
|
6408
|
|
|
|
|
|
|
# "Failed checking test, value provided is not a hashref or hashref derived, at ." |
6409
|
|
|
|
|
|
|
|
6410
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6411
|
|
|
|
|
|
|
|
6412
|
|
|
|
|
|
|
# "test" |
6413
|
|
|
|
|
|
|
|
6414
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6415
|
|
|
|
|
|
|
|
6416
|
|
|
|
|
|
|
# "." |
6417
|
|
|
|
|
|
|
|
6418
|
|
|
|
|
|
|
=back |
6419
|
|
|
|
|
|
|
|
6420
|
|
|
|
|
|
|
=over 4 |
6421
|
|
|
|
|
|
|
|
6422
|
|
|
|
|
|
|
=item error: C |
6423
|
|
|
|
|
|
|
|
6424
|
|
|
|
|
|
|
This package may raise an error_on_hashref_empty exception. |
6425
|
|
|
|
|
|
|
|
6426
|
|
|
|
|
|
|
B |
6427
|
|
|
|
|
|
|
|
6428
|
|
|
|
|
|
|
# given: synopsis; |
6429
|
|
|
|
|
|
|
|
6430
|
|
|
|
|
|
|
my $input = { |
6431
|
|
|
|
|
|
|
at => '.', |
6432
|
|
|
|
|
|
|
from => 'test', |
6433
|
|
|
|
|
|
|
throw => 'error_on_hashref_empty', |
6434
|
|
|
|
|
|
|
}; |
6435
|
|
|
|
|
|
|
|
6436
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6437
|
|
|
|
|
|
|
|
6438
|
|
|
|
|
|
|
# my $name = $error->name; |
6439
|
|
|
|
|
|
|
|
6440
|
|
|
|
|
|
|
# "on_hashref_empty" |
6441
|
|
|
|
|
|
|
|
6442
|
|
|
|
|
|
|
# my $message = $error->render; |
6443
|
|
|
|
|
|
|
|
6444
|
|
|
|
|
|
|
# "Failed checking test, no items found in hashref or hashref derived object, at ." |
6445
|
|
|
|
|
|
|
|
6446
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6447
|
|
|
|
|
|
|
|
6448
|
|
|
|
|
|
|
# "test" |
6449
|
|
|
|
|
|
|
|
6450
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6451
|
|
|
|
|
|
|
|
6452
|
|
|
|
|
|
|
# "." |
6453
|
|
|
|
|
|
|
|
6454
|
|
|
|
|
|
|
=back |
6455
|
|
|
|
|
|
|
|
6456
|
|
|
|
|
|
|
=over 4 |
6457
|
|
|
|
|
|
|
|
6458
|
|
|
|
|
|
|
=item error: C |
6459
|
|
|
|
|
|
|
|
6460
|
|
|
|
|
|
|
This package may raise an error_on_identity exception. |
6461
|
|
|
|
|
|
|
|
6462
|
|
|
|
|
|
|
B |
6463
|
|
|
|
|
|
|
|
6464
|
|
|
|
|
|
|
# given: synopsis; |
6465
|
|
|
|
|
|
|
|
6466
|
|
|
|
|
|
|
my $input = { |
6467
|
|
|
|
|
|
|
at => '.', |
6468
|
|
|
|
|
|
|
from => 'test', |
6469
|
|
|
|
|
|
|
name => 'Example', |
6470
|
|
|
|
|
|
|
throw => 'error_on_identity', |
6471
|
|
|
|
|
|
|
}; |
6472
|
|
|
|
|
|
|
|
6473
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6474
|
|
|
|
|
|
|
|
6475
|
|
|
|
|
|
|
# my $name = $error->name; |
6476
|
|
|
|
|
|
|
|
6477
|
|
|
|
|
|
|
# "on_identity" |
6478
|
|
|
|
|
|
|
|
6479
|
|
|
|
|
|
|
# my $message = $error->render; |
6480
|
|
|
|
|
|
|
|
6481
|
|
|
|
|
|
|
# "Failed checking test, object is not a Example or derived object, at ." |
6482
|
|
|
|
|
|
|
|
6483
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6484
|
|
|
|
|
|
|
|
6485
|
|
|
|
|
|
|
# "test" |
6486
|
|
|
|
|
|
|
|
6487
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6488
|
|
|
|
|
|
|
|
6489
|
|
|
|
|
|
|
# "." |
6490
|
|
|
|
|
|
|
|
6491
|
|
|
|
|
|
|
# my $name = $error->stash('name'); |
6492
|
|
|
|
|
|
|
|
6493
|
|
|
|
|
|
|
# "Example" |
6494
|
|
|
|
|
|
|
|
6495
|
|
|
|
|
|
|
=back |
6496
|
|
|
|
|
|
|
|
6497
|
|
|
|
|
|
|
=over 4 |
6498
|
|
|
|
|
|
|
|
6499
|
|
|
|
|
|
|
=item error: C |
6500
|
|
|
|
|
|
|
|
6501
|
|
|
|
|
|
|
This package may raise an error_on_includes exception. |
6502
|
|
|
|
|
|
|
|
6503
|
|
|
|
|
|
|
B |
6504
|
|
|
|
|
|
|
|
6505
|
|
|
|
|
|
|
# given: synopsis; |
6506
|
|
|
|
|
|
|
|
6507
|
|
|
|
|
|
|
my $input = { |
6508
|
|
|
|
|
|
|
at => '.', |
6509
|
|
|
|
|
|
|
from => 'test', |
6510
|
|
|
|
|
|
|
errors => [ |
6511
|
|
|
|
|
|
|
'Failed condition 1', |
6512
|
|
|
|
|
|
|
'Failed condition 2', |
6513
|
|
|
|
|
|
|
], |
6514
|
|
|
|
|
|
|
throw => 'error_on_includes', |
6515
|
|
|
|
|
|
|
}; |
6516
|
|
|
|
|
|
|
|
6517
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6518
|
|
|
|
|
|
|
|
6519
|
|
|
|
|
|
|
# my $name = $error->name; |
6520
|
|
|
|
|
|
|
|
6521
|
|
|
|
|
|
|
# "on_includes" |
6522
|
|
|
|
|
|
|
|
6523
|
|
|
|
|
|
|
# my $message = $error->render; |
6524
|
|
|
|
|
|
|
|
6525
|
|
|
|
|
|
|
# "Failed checking union-includes condition:\n\nFailed condition 1\n\nFailed condition 2" |
6526
|
|
|
|
|
|
|
|
6527
|
|
|
|
|
|
|
# my $errors = $error->stash('errors'); |
6528
|
|
|
|
|
|
|
|
6529
|
|
|
|
|
|
|
# ['Failed condition 1', Failed condition 2'] |
6530
|
|
|
|
|
|
|
|
6531
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6532
|
|
|
|
|
|
|
|
6533
|
|
|
|
|
|
|
# "test" |
6534
|
|
|
|
|
|
|
|
6535
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6536
|
|
|
|
|
|
|
|
6537
|
|
|
|
|
|
|
# "." |
6538
|
|
|
|
|
|
|
|
6539
|
|
|
|
|
|
|
=back |
6540
|
|
|
|
|
|
|
|
6541
|
|
|
|
|
|
|
=over 4 |
6542
|
|
|
|
|
|
|
|
6543
|
|
|
|
|
|
|
=item error: C |
6544
|
|
|
|
|
|
|
|
6545
|
|
|
|
|
|
|
This package may raise an error_on_inherits exception. |
6546
|
|
|
|
|
|
|
|
6547
|
|
|
|
|
|
|
B |
6548
|
|
|
|
|
|
|
|
6549
|
|
|
|
|
|
|
# given: synopsis; |
6550
|
|
|
|
|
|
|
|
6551
|
|
|
|
|
|
|
my $input = { |
6552
|
|
|
|
|
|
|
at => '.', |
6553
|
|
|
|
|
|
|
from => 'test', |
6554
|
|
|
|
|
|
|
name => 'Example', |
6555
|
|
|
|
|
|
|
throw => 'error_on_inherits', |
6556
|
|
|
|
|
|
|
}; |
6557
|
|
|
|
|
|
|
|
6558
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6559
|
|
|
|
|
|
|
|
6560
|
|
|
|
|
|
|
# my $name = $error->name; |
6561
|
|
|
|
|
|
|
|
6562
|
|
|
|
|
|
|
# "on_inherits" |
6563
|
|
|
|
|
|
|
|
6564
|
|
|
|
|
|
|
# my $message = $error->render; |
6565
|
|
|
|
|
|
|
|
6566
|
|
|
|
|
|
|
# "Failed checking test, object is not a Example derived object, at ." |
6567
|
|
|
|
|
|
|
|
6568
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6569
|
|
|
|
|
|
|
|
6570
|
|
|
|
|
|
|
# "test" |
6571
|
|
|
|
|
|
|
|
6572
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6573
|
|
|
|
|
|
|
|
6574
|
|
|
|
|
|
|
# "." |
6575
|
|
|
|
|
|
|
|
6576
|
|
|
|
|
|
|
# my $name = $error->stash('name'); |
6577
|
|
|
|
|
|
|
|
6578
|
|
|
|
|
|
|
# "Example" |
6579
|
|
|
|
|
|
|
|
6580
|
|
|
|
|
|
|
=back |
6581
|
|
|
|
|
|
|
|
6582
|
|
|
|
|
|
|
=over 4 |
6583
|
|
|
|
|
|
|
|
6584
|
|
|
|
|
|
|
=item error: C |
6585
|
|
|
|
|
|
|
|
6586
|
|
|
|
|
|
|
This package may raise an error_on_missing exception. |
6587
|
|
|
|
|
|
|
|
6588
|
|
|
|
|
|
|
B |
6589
|
|
|
|
|
|
|
|
6590
|
|
|
|
|
|
|
# given: synopsis; |
6591
|
|
|
|
|
|
|
|
6592
|
|
|
|
|
|
|
my $input = { |
6593
|
|
|
|
|
|
|
at => '.', |
6594
|
|
|
|
|
|
|
from => 'test', |
6595
|
|
|
|
|
|
|
name => 'execute', |
6596
|
|
|
|
|
|
|
throw => 'error_on_missing', |
6597
|
|
|
|
|
|
|
}; |
6598
|
|
|
|
|
|
|
|
6599
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6600
|
|
|
|
|
|
|
|
6601
|
|
|
|
|
|
|
# my $name = $error->name; |
6602
|
|
|
|
|
|
|
|
6603
|
|
|
|
|
|
|
# "on_missing" |
6604
|
|
|
|
|
|
|
|
6605
|
|
|
|
|
|
|
# my $message = $error->render; |
6606
|
|
|
|
|
|
|
|
6607
|
|
|
|
|
|
|
# "Failed checking test, "execute" is missing, at ." |
6608
|
|
|
|
|
|
|
|
6609
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6610
|
|
|
|
|
|
|
|
6611
|
|
|
|
|
|
|
# "test" |
6612
|
|
|
|
|
|
|
|
6613
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6614
|
|
|
|
|
|
|
|
6615
|
|
|
|
|
|
|
# "." |
6616
|
|
|
|
|
|
|
|
6617
|
|
|
|
|
|
|
# my $name = $error->stash('name'); |
6618
|
|
|
|
|
|
|
|
6619
|
|
|
|
|
|
|
# "execute" |
6620
|
|
|
|
|
|
|
|
6621
|
|
|
|
|
|
|
=back |
6622
|
|
|
|
|
|
|
|
6623
|
|
|
|
|
|
|
=over 4 |
6624
|
|
|
|
|
|
|
|
6625
|
|
|
|
|
|
|
=item error: C |
6626
|
|
|
|
|
|
|
|
6627
|
|
|
|
|
|
|
This package may raise an error_on_package exception. |
6628
|
|
|
|
|
|
|
|
6629
|
|
|
|
|
|
|
B |
6630
|
|
|
|
|
|
|
|
6631
|
|
|
|
|
|
|
# given: synopsis; |
6632
|
|
|
|
|
|
|
|
6633
|
|
|
|
|
|
|
my $input = { |
6634
|
|
|
|
|
|
|
at => '.', |
6635
|
|
|
|
|
|
|
data => 'main', |
6636
|
|
|
|
|
|
|
from => 'test', |
6637
|
|
|
|
|
|
|
throw => 'error_on_package', |
6638
|
|
|
|
|
|
|
}; |
6639
|
|
|
|
|
|
|
|
6640
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6641
|
|
|
|
|
|
|
|
6642
|
|
|
|
|
|
|
# my $name = $error->name; |
6643
|
|
|
|
|
|
|
|
6644
|
|
|
|
|
|
|
# "on_package" |
6645
|
|
|
|
|
|
|
|
6646
|
|
|
|
|
|
|
# my $message = $error->render; |
6647
|
|
|
|
|
|
|
|
6648
|
|
|
|
|
|
|
# "Failed checking test, \"main\" is not a valid package name, at ." |
6649
|
|
|
|
|
|
|
|
6650
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6651
|
|
|
|
|
|
|
|
6652
|
|
|
|
|
|
|
# "test" |
6653
|
|
|
|
|
|
|
|
6654
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6655
|
|
|
|
|
|
|
|
6656
|
|
|
|
|
|
|
# "." |
6657
|
|
|
|
|
|
|
|
6658
|
|
|
|
|
|
|
# my $data = $error->stash('data'); |
6659
|
|
|
|
|
|
|
|
6660
|
|
|
|
|
|
|
# "main" |
6661
|
|
|
|
|
|
|
|
6662
|
|
|
|
|
|
|
=back |
6663
|
|
|
|
|
|
|
|
6664
|
|
|
|
|
|
|
=over 4 |
6665
|
|
|
|
|
|
|
|
6666
|
|
|
|
|
|
|
=item error: C |
6667
|
|
|
|
|
|
|
|
6668
|
|
|
|
|
|
|
This package may raise an error_on_package_loaded exception. |
6669
|
|
|
|
|
|
|
|
6670
|
|
|
|
|
|
|
B |
6671
|
|
|
|
|
|
|
|
6672
|
|
|
|
|
|
|
# given: synopsis; |
6673
|
|
|
|
|
|
|
|
6674
|
|
|
|
|
|
|
my $input = { |
6675
|
|
|
|
|
|
|
at => '.', |
6676
|
|
|
|
|
|
|
data => 'main', |
6677
|
|
|
|
|
|
|
from => 'test', |
6678
|
|
|
|
|
|
|
throw => 'error_on_package_loaded', |
6679
|
|
|
|
|
|
|
}; |
6680
|
|
|
|
|
|
|
|
6681
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6682
|
|
|
|
|
|
|
|
6683
|
|
|
|
|
|
|
# my $name = $error->name; |
6684
|
|
|
|
|
|
|
|
6685
|
|
|
|
|
|
|
# "on_package_loaded" |
6686
|
|
|
|
|
|
|
|
6687
|
|
|
|
|
|
|
# my $message = $error->render; |
6688
|
|
|
|
|
|
|
|
6689
|
|
|
|
|
|
|
# "Failed checking test, \"main\" is not loaded, at ." |
6690
|
|
|
|
|
|
|
|
6691
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6692
|
|
|
|
|
|
|
|
6693
|
|
|
|
|
|
|
# "test" |
6694
|
|
|
|
|
|
|
|
6695
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6696
|
|
|
|
|
|
|
|
6697
|
|
|
|
|
|
|
# "." |
6698
|
|
|
|
|
|
|
|
6699
|
|
|
|
|
|
|
# my $data = $error->stash('data'); |
6700
|
|
|
|
|
|
|
|
6701
|
|
|
|
|
|
|
# "main" |
6702
|
|
|
|
|
|
|
|
6703
|
|
|
|
|
|
|
=back |
6704
|
|
|
|
|
|
|
|
6705
|
|
|
|
|
|
|
=over 4 |
6706
|
|
|
|
|
|
|
|
6707
|
|
|
|
|
|
|
=item error: C |
6708
|
|
|
|
|
|
|
|
6709
|
|
|
|
|
|
|
This package may raise an error_on_pairs exception. |
6710
|
|
|
|
|
|
|
|
6711
|
|
|
|
|
|
|
B |
6712
|
|
|
|
|
|
|
|
6713
|
|
|
|
|
|
|
# given: synopsis; |
6714
|
|
|
|
|
|
|
|
6715
|
|
|
|
|
|
|
my $input = { |
6716
|
|
|
|
|
|
|
at => '.', |
6717
|
|
|
|
|
|
|
from => 'test', |
6718
|
|
|
|
|
|
|
throw => 'error_on_pairs', |
6719
|
|
|
|
|
|
|
}; |
6720
|
|
|
|
|
|
|
|
6721
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6722
|
|
|
|
|
|
|
|
6723
|
|
|
|
|
|
|
# my $name = $error->name; |
6724
|
|
|
|
|
|
|
|
6725
|
|
|
|
|
|
|
# "on_pairs" |
6726
|
|
|
|
|
|
|
|
6727
|
|
|
|
|
|
|
# my $message = $error->render; |
6728
|
|
|
|
|
|
|
|
6729
|
|
|
|
|
|
|
# "Failed checking test, imblanced key/value pairs provided, at ." |
6730
|
|
|
|
|
|
|
|
6731
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6732
|
|
|
|
|
|
|
|
6733
|
|
|
|
|
|
|
# "test" |
6734
|
|
|
|
|
|
|
|
6735
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6736
|
|
|
|
|
|
|
|
6737
|
|
|
|
|
|
|
# "." |
6738
|
|
|
|
|
|
|
|
6739
|
|
|
|
|
|
|
=back |
6740
|
|
|
|
|
|
|
|
6741
|
|
|
|
|
|
|
=over 4 |
6742
|
|
|
|
|
|
|
|
6743
|
|
|
|
|
|
|
=item error: C |
6744
|
|
|
|
|
|
|
|
6745
|
|
|
|
|
|
|
This package may raise an error_on_reference exception. |
6746
|
|
|
|
|
|
|
|
6747
|
|
|
|
|
|
|
B |
6748
|
|
|
|
|
|
|
|
6749
|
|
|
|
|
|
|
# given: synopsis; |
6750
|
|
|
|
|
|
|
|
6751
|
|
|
|
|
|
|
my $input = { |
6752
|
|
|
|
|
|
|
at => '.', |
6753
|
|
|
|
|
|
|
from => 'test', |
6754
|
|
|
|
|
|
|
throw => 'error_on_reference', |
6755
|
|
|
|
|
|
|
}; |
6756
|
|
|
|
|
|
|
|
6757
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6758
|
|
|
|
|
|
|
|
6759
|
|
|
|
|
|
|
# my $name = $error->name; |
6760
|
|
|
|
|
|
|
|
6761
|
|
|
|
|
|
|
# "on_reference" |
6762
|
|
|
|
|
|
|
|
6763
|
|
|
|
|
|
|
# my $message = $error->render; |
6764
|
|
|
|
|
|
|
|
6765
|
|
|
|
|
|
|
# "Failed checking test, value provided is not a reference, at ." |
6766
|
|
|
|
|
|
|
|
6767
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6768
|
|
|
|
|
|
|
|
6769
|
|
|
|
|
|
|
# "test" |
6770
|
|
|
|
|
|
|
|
6771
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6772
|
|
|
|
|
|
|
|
6773
|
|
|
|
|
|
|
# "." |
6774
|
|
|
|
|
|
|
|
6775
|
|
|
|
|
|
|
=back |
6776
|
|
|
|
|
|
|
|
6777
|
|
|
|
|
|
|
=over 4 |
6778
|
|
|
|
|
|
|
|
6779
|
|
|
|
|
|
|
=item error: C |
6780
|
|
|
|
|
|
|
|
6781
|
|
|
|
|
|
|
This package may raise an error_on_unknown exception. |
6782
|
|
|
|
|
|
|
|
6783
|
|
|
|
|
|
|
B |
6784
|
|
|
|
|
|
|
|
6785
|
|
|
|
|
|
|
# given: synopsis; |
6786
|
|
|
|
|
|
|
|
6787
|
|
|
|
|
|
|
my $input = { |
6788
|
|
|
|
|
|
|
throw => 'error_on_unknown', |
6789
|
|
|
|
|
|
|
}; |
6790
|
|
|
|
|
|
|
|
6791
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6792
|
|
|
|
|
|
|
|
6793
|
|
|
|
|
|
|
# my $name = $error->name; |
6794
|
|
|
|
|
|
|
|
6795
|
|
|
|
|
|
|
# "on_unknown" |
6796
|
|
|
|
|
|
|
|
6797
|
|
|
|
|
|
|
# my $message = $error->render; |
6798
|
|
|
|
|
|
|
|
6799
|
|
|
|
|
|
|
# "Failed performing check for unknown reason" |
6800
|
|
|
|
|
|
|
|
6801
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6802
|
|
|
|
|
|
|
|
6803
|
|
|
|
|
|
|
# undef |
6804
|
|
|
|
|
|
|
|
6805
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6806
|
|
|
|
|
|
|
|
6807
|
|
|
|
|
|
|
# "." |
6808
|
|
|
|
|
|
|
|
6809
|
|
|
|
|
|
|
=back |
6810
|
|
|
|
|
|
|
|
6811
|
|
|
|
|
|
|
=over 4 |
6812
|
|
|
|
|
|
|
|
6813
|
|
|
|
|
|
|
=item error: C |
6814
|
|
|
|
|
|
|
|
6815
|
|
|
|
|
|
|
This package may raise an error_on_value exception. |
6816
|
|
|
|
|
|
|
|
6817
|
|
|
|
|
|
|
B |
6818
|
|
|
|
|
|
|
|
6819
|
|
|
|
|
|
|
# given: synopsis; |
6820
|
|
|
|
|
|
|
|
6821
|
|
|
|
|
|
|
my $input = { |
6822
|
|
|
|
|
|
|
at => '.', |
6823
|
|
|
|
|
|
|
from => 'test', |
6824
|
|
|
|
|
|
|
throw => 'error_on_value', |
6825
|
|
|
|
|
|
|
}; |
6826
|
|
|
|
|
|
|
|
6827
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6828
|
|
|
|
|
|
|
|
6829
|
|
|
|
|
|
|
# my $name = $error->name; |
6830
|
|
|
|
|
|
|
|
6831
|
|
|
|
|
|
|
# "on_value" |
6832
|
|
|
|
|
|
|
|
6833
|
|
|
|
|
|
|
# my $message = $error->render; |
6834
|
|
|
|
|
|
|
|
6835
|
|
|
|
|
|
|
# "Failed checking test, value provided is a reference, at ." |
6836
|
|
|
|
|
|
|
|
6837
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6838
|
|
|
|
|
|
|
|
6839
|
|
|
|
|
|
|
# "test" |
6840
|
|
|
|
|
|
|
|
6841
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6842
|
|
|
|
|
|
|
|
6843
|
|
|
|
|
|
|
# "." |
6844
|
|
|
|
|
|
|
|
6845
|
|
|
|
|
|
|
=back |
6846
|
|
|
|
|
|
|
|
6847
|
|
|
|
|
|
|
=over 4 |
6848
|
|
|
|
|
|
|
|
6849
|
|
|
|
|
|
|
=item error: C |
6850
|
|
|
|
|
|
|
|
6851
|
|
|
|
|
|
|
This package may raise an error_on_within exception. |
6852
|
|
|
|
|
|
|
|
6853
|
|
|
|
|
|
|
B |
6854
|
|
|
|
|
|
|
|
6855
|
|
|
|
|
|
|
# given: synopsis; |
6856
|
|
|
|
|
|
|
|
6857
|
|
|
|
|
|
|
my $input = { |
6858
|
|
|
|
|
|
|
at => '.', |
6859
|
|
|
|
|
|
|
from => 'test', |
6860
|
|
|
|
|
|
|
type => 'scalarref', |
6861
|
|
|
|
|
|
|
throw => 'error_on_within', |
6862
|
|
|
|
|
|
|
}; |
6863
|
|
|
|
|
|
|
|
6864
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6865
|
|
|
|
|
|
|
|
6866
|
|
|
|
|
|
|
# my $name = $error->name; |
6867
|
|
|
|
|
|
|
|
6868
|
|
|
|
|
|
|
# "on_within" |
6869
|
|
|
|
|
|
|
|
6870
|
|
|
|
|
|
|
# my $message = $error->render; |
6871
|
|
|
|
|
|
|
|
6872
|
|
|
|
|
|
|
# "Invalid type \"scalarref\" provided to the \"within\" method" |
6873
|
|
|
|
|
|
|
|
6874
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6875
|
|
|
|
|
|
|
|
6876
|
|
|
|
|
|
|
# "test" |
6877
|
|
|
|
|
|
|
|
6878
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6879
|
|
|
|
|
|
|
|
6880
|
|
|
|
|
|
|
# "." |
6881
|
|
|
|
|
|
|
|
6882
|
|
|
|
|
|
|
=back |
6883
|
|
|
|
|
|
|
|
6884
|
|
|
|
|
|
|
=over 4 |
6885
|
|
|
|
|
|
|
|
6886
|
|
|
|
|
|
|
=item error: C |
6887
|
|
|
|
|
|
|
|
6888
|
|
|
|
|
|
|
This package may raise an error_on_yesno exception. |
6889
|
|
|
|
|
|
|
|
6890
|
|
|
|
|
|
|
B |
6891
|
|
|
|
|
|
|
|
6892
|
|
|
|
|
|
|
# given: synopsis; |
6893
|
|
|
|
|
|
|
|
6894
|
|
|
|
|
|
|
my $input = { |
6895
|
|
|
|
|
|
|
at => '.', |
6896
|
|
|
|
|
|
|
from => 'test', |
6897
|
|
|
|
|
|
|
throw => 'error_on_yesno', |
6898
|
|
|
|
|
|
|
}; |
6899
|
|
|
|
|
|
|
|
6900
|
|
|
|
|
|
|
my $error = $check->catch('error', $input); |
6901
|
|
|
|
|
|
|
|
6902
|
|
|
|
|
|
|
# my $name = $error->name; |
6903
|
|
|
|
|
|
|
|
6904
|
|
|
|
|
|
|
# "on_yesno" |
6905
|
|
|
|
|
|
|
|
6906
|
|
|
|
|
|
|
# my $message = $error->render; |
6907
|
|
|
|
|
|
|
|
6908
|
|
|
|
|
|
|
# "Failed checking test, value provided is not a recognized \"yes\" or \"no\" value, at ." |
6909
|
|
|
|
|
|
|
|
6910
|
|
|
|
|
|
|
# my $from = $error->stash('from'); |
6911
|
|
|
|
|
|
|
|
6912
|
|
|
|
|
|
|
# "test" |
6913
|
|
|
|
|
|
|
|
6914
|
|
|
|
|
|
|
# my $at = $error->stash('at'); |
6915
|
|
|
|
|
|
|
|
6916
|
|
|
|
|
|
|
# "." |
6917
|
|
|
|
|
|
|
|
6918
|
|
|
|
|
|
|
=back |
6919
|
|
|
|
|
|
|
|
6920
|
|
|
|
|
|
|
=head1 AUTHORS |
6921
|
|
|
|
|
|
|
|
6922
|
|
|
|
|
|
|
Awncorp, C |
6923
|
|
|
|
|
|
|
|
6924
|
|
|
|
|
|
|
=cut |
6925
|
|
|
|
|
|
|
|
6926
|
|
|
|
|
|
|
=head1 LICENSE |
6927
|
|
|
|
|
|
|
|
6928
|
|
|
|
|
|
|
Copyright (C) 2000, Awncorp, C. |
6929
|
|
|
|
|
|
|
|
6930
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
6931
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
6932
|
|
|
|
|
|
|
|
6933
|
|
|
|
|
|
|
=cut |