line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Sub::HandlesVia::Handler; |
4
|
96
|
|
|
96
|
|
697
|
use strict; |
|
96
|
|
|
|
|
261
|
|
|
96
|
|
|
|
|
2889
|
|
5
|
96
|
|
|
96
|
|
594
|
use warnings; |
|
96
|
|
|
|
|
264
|
|
|
96
|
|
|
|
|
2763
|
|
6
|
96
|
|
|
96
|
|
542
|
no warnings qw( once void ); |
|
96
|
|
|
|
|
382
|
|
|
96
|
|
|
|
|
13785
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
9
|
|
|
|
|
|
|
our $MITE_SHIM = "Sub::HandlesVia::Mite"; |
10
|
|
|
|
|
|
|
our $MITE_VERSION = "0.012000"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Mite keywords |
13
|
|
|
|
|
|
|
BEGIN { |
14
|
96
|
|
|
96
|
|
515
|
my ( $SHIM, $CALLER ) = |
15
|
|
|
|
|
|
|
( "Sub::HandlesVia::Mite", "Sub::HandlesVia::Handler" ); |
16
|
|
|
|
|
|
|
( |
17
|
|
|
|
|
|
|
*after, *around, *before, *extends, *field, |
18
|
|
|
|
|
|
|
*has, *param, *signature_for, *with |
19
|
|
|
|
|
|
|
) |
20
|
96
|
|
|
|
|
378
|
= do { |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
23
|
96
|
|
|
96
|
|
809
|
no warnings 'redefine'; |
|
96
|
|
|
|
|
622
|
|
|
96
|
|
|
|
|
22440
|
|
24
|
|
|
|
|
|
|
( |
25
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
26
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
27
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
28
|
|
|
|
|
|
|
sub { }, |
29
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) }, |
30
|
1536
|
|
|
|
|
4305
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
31
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
32
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
33
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
34
|
96
|
|
|
|
|
19921
|
); |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Mite imports |
39
|
|
|
|
|
|
|
BEGIN { |
40
|
96
|
|
|
96
|
|
913
|
require Scalar::Util; |
41
|
96
|
|
|
|
|
1130
|
*STRICT = \&Sub::HandlesVia::Mite::STRICT; |
42
|
96
|
|
|
|
|
760
|
*bare = \&Sub::HandlesVia::Mite::bare; |
43
|
96
|
|
|
|
|
360
|
*blessed = \&Scalar::Util::blessed; |
44
|
96
|
|
|
|
|
362
|
*carp = \&Sub::HandlesVia::Mite::carp; |
45
|
96
|
|
|
|
|
1385
|
*confess = \&Sub::HandlesVia::Mite::confess; |
46
|
96
|
|
|
|
|
275
|
*croak = \&Sub::HandlesVia::Mite::croak; |
47
|
96
|
|
|
|
|
230
|
*false = \&Sub::HandlesVia::Mite::false; |
48
|
96
|
|
|
|
|
269
|
*guard = \&Sub::HandlesVia::Mite::guard; |
49
|
96
|
|
|
|
|
243
|
*lazy = \&Sub::HandlesVia::Mite::lazy; |
50
|
96
|
|
|
|
|
268
|
*lock = \&Sub::HandlesVia::Mite::lock; |
51
|
96
|
|
|
|
|
236
|
*ro = \&Sub::HandlesVia::Mite::ro; |
52
|
96
|
|
|
|
|
295
|
*rw = \&Sub::HandlesVia::Mite::rw; |
53
|
96
|
|
|
|
|
297
|
*rwp = \&Sub::HandlesVia::Mite::rwp; |
54
|
96
|
|
|
|
|
248
|
*true = \&Sub::HandlesVia::Mite::true; |
55
|
96
|
|
|
|
|
3372
|
*unlock = \&Sub::HandlesVia::Mite::unlock; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
59
|
|
|
|
|
|
|
sub __META__ { |
60
|
96
|
|
|
96
|
|
663
|
no strict 'refs'; |
|
96
|
|
|
|
|
253
|
|
|
96
|
|
|
|
|
218524
|
|
61
|
97
|
|
|
97
|
|
689
|
my $class = shift; |
62
|
97
|
|
33
|
|
|
975
|
$class = ref($class) || $class; |
63
|
97
|
|
|
|
|
958
|
my $linear_isa = mro::get_linear_isa($class); |
64
|
|
|
|
|
|
|
return { |
65
|
|
|
|
|
|
|
BUILD => [ |
66
|
196
|
100
|
|
|
|
1022
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
196
|
|
|
|
|
2260
|
|
|
1
|
|
|
|
|
4
|
|
67
|
196
|
|
|
|
|
1349
|
map { "$_\::BUILD" } reverse @$linear_isa |
68
|
|
|
|
|
|
|
], |
69
|
|
|
|
|
|
|
DEMOLISH => [ |
70
|
196
|
50
|
|
|
|
719
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
196
|
|
|
|
|
3485
|
|
|
0
|
|
|
|
|
0
|
|
71
|
97
|
|
|
|
|
617
|
map { "$_\::DEMOLISH" } @$linear_isa |
|
196
|
|
|
|
|
953
|
|
72
|
|
|
|
|
|
|
], |
73
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
74
|
|
|
|
|
|
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
79
|
|
|
|
|
|
|
sub new { |
80
|
5821
|
50
|
|
5821
|
1
|
15348
|
my $class = ref( $_[0] ) ? ref(shift) : shift; |
81
|
5821
|
|
66
|
|
|
16389
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
82
|
5821
|
|
|
|
|
13677
|
my $self = bless {}, $class; |
83
|
|
|
|
|
|
|
my $args = |
84
|
|
|
|
|
|
|
$meta->{HAS_BUILDARGS} |
85
|
|
|
|
|
|
|
? $class->BUILDARGS(@_) |
86
|
5821
|
50
|
|
|
|
35429
|
: { ( @_ == 1 ) ? %{ $_[0] } : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
87
|
5821
|
|
|
|
|
12558
|
my $no_build = delete $args->{__no_BUILD__}; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# Attribute name (type: Str) |
90
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 12 |
91
|
5821
|
50
|
|
|
|
14337
|
if ( exists $args->{"name"} ) { |
92
|
5821
|
50
|
|
|
|
9845
|
do { |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
95
|
5821
|
50
|
|
|
|
15375
|
defined( $args->{"name"} ) and do { |
96
|
|
|
|
|
|
|
ref( \$args->{"name"} ) eq 'SCALAR' |
97
|
5821
|
50
|
|
|
|
28764
|
or ref( \( my $val = $args->{"name"} ) ) eq 'SCALAR'; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
101
|
|
|
|
|
|
|
"name", "Str"; |
102
|
5821
|
|
|
|
|
16278
|
$self->{"name"} = $args->{"name"}; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Attribute template (type: Str) |
106
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 17 |
107
|
5821
|
50
|
|
|
|
13231
|
if ( exists $args->{"template"} ) { |
108
|
5821
|
50
|
|
|
|
9336
|
do { |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
111
|
5821
|
50
|
|
|
|
14045
|
defined( $args->{"template"} ) and do { |
112
|
|
|
|
|
|
|
ref( \$args->{"template"} ) eq 'SCALAR' |
113
|
5821
|
50
|
|
|
|
23726
|
or ref( \( my $val = $args->{"template"} ) ) eq 'SCALAR'; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
117
|
|
|
|
|
|
|
"template", "Str"; |
118
|
5821
|
|
|
|
|
12778
|
$self->{"template"} = $args->{"template"}; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# Attribute lvalue_template (type: Str) |
122
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 22 |
123
|
5821
|
100
|
|
|
|
12900
|
if ( exists $args->{"lvalue_template"} ) { |
124
|
2476
|
50
|
|
|
|
3728
|
do { |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
127
|
2476
|
50
|
|
|
|
5875
|
defined( $args->{"lvalue_template"} ) and do { |
128
|
|
|
|
|
|
|
ref( \$args->{"lvalue_template"} ) eq 'SCALAR' |
129
|
2476
|
50
|
|
|
|
10019
|
or ref( \( my $val = $args->{"lvalue_template"} ) ) eq |
130
|
|
|
|
|
|
|
'SCALAR'; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
134
|
|
|
|
|
|
|
"lvalue_template", "Str"; |
135
|
2476
|
|
|
|
|
5442
|
$self->{"lvalue_template"} = $args->{"lvalue_template"}; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# Attribute args (type: Int|Undef) |
139
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 27 |
140
|
5821
|
|
|
|
|
8722
|
do { |
141
|
5821
|
100
|
|
|
|
12702
|
my $value = exists( $args->{"args"} ) ? $args->{"args"} : undef; |
142
|
5821
|
50
|
|
|
|
8565
|
do { |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
145
|
|
|
|
|
|
|
( |
146
|
|
|
|
|
|
|
( |
147
|
5821
|
100
|
|
|
|
8369
|
do { |
148
|
5821
|
|
|
|
|
9022
|
my $tmp = $value; |
149
|
5821
|
100
|
66
|
|
|
44062
|
defined($tmp) |
150
|
|
|
|
|
|
|
and !ref($tmp) |
151
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
) |
154
|
|
|
|
|
|
|
or ( !defined($value) ) |
155
|
|
|
|
|
|
|
); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
158
|
|
|
|
|
|
|
"args", "Int|Undef"; |
159
|
5821
|
|
|
|
|
13515
|
$self->{"args"} = $value; |
160
|
|
|
|
|
|
|
}; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
# Attribute min_args (type: Int|Undef) |
163
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37 |
164
|
5821
|
100
|
|
|
|
12561
|
if ( exists $args->{"min_args"} ) { |
165
|
2565
|
50
|
|
|
|
3740
|
do { |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
168
|
|
|
|
|
|
|
( |
169
|
|
|
|
|
|
|
( |
170
|
|
|
|
|
|
|
do { |
171
|
2565
|
|
|
|
|
4385
|
my $tmp = $args->{"min_args"}; |
172
|
2565
|
100
|
66
|
|
|
20665
|
defined($tmp) |
173
|
|
|
|
|
|
|
and !ref($tmp) |
174
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
) |
177
|
2565
|
100
|
|
|
|
3644
|
or do { |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
180
|
84
|
|
|
|
|
335
|
!defined( $args->{"min_args"} ); |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
); |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
185
|
|
|
|
|
|
|
"min_args", "Int|Undef"; |
186
|
2565
|
|
|
|
|
6257
|
$self->{"min_args"} = $args->{"min_args"}; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
# Attribute max_args (type: Int|Undef) |
190
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37 |
191
|
5821
|
100
|
|
|
|
12745
|
if ( exists $args->{"max_args"} ) { |
192
|
2233
|
50
|
|
|
|
3263
|
do { |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
195
|
|
|
|
|
|
|
( |
196
|
|
|
|
|
|
|
( |
197
|
|
|
|
|
|
|
do { |
198
|
2233
|
|
|
|
|
4020
|
my $tmp = $args->{"max_args"}; |
199
|
2233
|
100
|
66
|
|
|
14812
|
defined($tmp) |
200
|
|
|
|
|
|
|
and !ref($tmp) |
201
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
) |
204
|
2233
|
100
|
|
|
|
3125
|
or do { |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
207
|
213
|
|
|
|
|
846
|
!defined( $args->{"max_args"} ); |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
); |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
212
|
|
|
|
|
|
|
"max_args", "Int|Undef"; |
213
|
2233
|
|
|
|
|
5145
|
$self->{"max_args"} = $args->{"max_args"}; |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
# Attribute signature (type: ArrayRef|Undef) |
217
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 43 |
218
|
5821
|
100
|
|
|
|
12353
|
if ( exists $args->{"signature"} ) { |
219
|
4032
|
50
|
|
|
|
5891
|
do { |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
222
|
|
|
|
|
|
|
( |
223
|
|
|
|
|
|
|
do { |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
226
|
4032
|
|
|
|
|
13836
|
ref( $args->{"signature"} ) eq 'ARRAY'; |
227
|
|
|
|
|
|
|
} |
228
|
4032
|
100
|
|
|
|
5644
|
or do { |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
231
|
213
|
|
|
|
|
703
|
!defined( $args->{"signature"} ); |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
); |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
236
|
|
|
|
|
|
|
"signature", "ArrayRef|Undef"; |
237
|
4032
|
|
|
|
|
8398
|
$self->{"signature"} = $args->{"signature"}; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
# Attribute usage (type: Str) |
241
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 48 |
242
|
5821
|
100
|
|
|
|
12096
|
if ( exists $args->{"usage"} ) { |
243
|
3235
|
50
|
|
|
|
5102
|
do { |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
246
|
3235
|
50
|
|
|
|
7946
|
defined( $args->{"usage"} ) and do { |
247
|
|
|
|
|
|
|
ref( \$args->{"usage"} ) eq 'SCALAR' |
248
|
3235
|
50
|
|
|
|
13121
|
or ref( \( my $val = $args->{"usage"} ) ) eq 'SCALAR'; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
252
|
|
|
|
|
|
|
"usage", "Str"; |
253
|
3235
|
|
|
|
|
7402
|
$self->{"usage"} = $args->{"usage"}; |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
# Attribute curried (type: ArrayRef) |
257
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 54 |
258
|
5821
|
100
|
|
|
|
12408
|
if ( exists $args->{"curried"} ) { |
259
|
1402
|
50
|
|
|
|
2245
|
do { |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
262
|
1402
|
|
|
|
|
3920
|
ref( $args->{"curried"} ) eq 'ARRAY'; |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
265
|
|
|
|
|
|
|
"curried", "ArrayRef"; |
266
|
1402
|
|
|
|
|
3435
|
$self->{"curried"} = $args->{"curried"}; |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
# Attribute is_chainable (type: Bool) |
270
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59 |
271
|
5821
|
100
|
|
|
|
12243
|
if ( exists $args->{"is_chainable"} ) { |
272
|
20
|
|
|
|
|
61
|
do { |
273
|
20
|
|
|
|
|
40
|
my $coerced_value = do { |
274
|
20
|
|
|
|
|
56
|
my $to_coerce = $args->{"is_chainable"}; |
275
|
|
|
|
|
|
|
( |
276
|
|
|
|
|
|
|
( |
277
|
|
|
|
|
|
|
!ref $to_coerce |
278
|
|
|
|
|
|
|
and (!defined $to_coerce |
279
|
|
|
|
|
|
|
or $to_coerce eq q() |
280
|
|
|
|
|
|
|
or $to_coerce eq '0' |
281
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
282
|
|
|
|
|
|
|
) |
283
|
|
|
|
|
|
|
) ? $to_coerce |
284
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
285
|
20
|
50
|
33
|
|
|
303
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
286
|
|
|
|
|
|
|
: $to_coerce; |
287
|
|
|
|
|
|
|
}; |
288
|
|
|
|
|
|
|
( |
289
|
20
|
50
|
33
|
|
|
431
|
!ref $coerced_value |
|
|
|
33
|
|
|
|
|
290
|
|
|
|
|
|
|
and (!defined $coerced_value |
291
|
|
|
|
|
|
|
or $coerced_value eq q() |
292
|
|
|
|
|
|
|
or $coerced_value eq '0' |
293
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
294
|
|
|
|
|
|
|
) |
295
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
296
|
|
|
|
|
|
|
"is_chainable", "Bool"; |
297
|
20
|
|
|
|
|
84
|
$self->{"is_chainable"} = $coerced_value; |
298
|
|
|
|
|
|
|
}; |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
# Attribute no_validation_needed (type: Bool) |
302
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59 |
303
|
5821
|
50
|
|
|
|
12009
|
if ( exists $args->{"no_validation_needed"} ) { |
304
|
0
|
|
|
|
|
0
|
do { |
305
|
0
|
|
|
|
|
0
|
my $coerced_value = do { |
306
|
0
|
|
|
|
|
0
|
my $to_coerce = $args->{"no_validation_needed"}; |
307
|
|
|
|
|
|
|
( |
308
|
|
|
|
|
|
|
( |
309
|
|
|
|
|
|
|
!ref $to_coerce |
310
|
|
|
|
|
|
|
and (!defined $to_coerce |
311
|
|
|
|
|
|
|
or $to_coerce eq q() |
312
|
|
|
|
|
|
|
or $to_coerce eq '0' |
313
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
314
|
|
|
|
|
|
|
) |
315
|
|
|
|
|
|
|
) ? $to_coerce |
316
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
317
|
0
|
0
|
0
|
|
|
0
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
318
|
|
|
|
|
|
|
: $to_coerce; |
319
|
|
|
|
|
|
|
}; |
320
|
|
|
|
|
|
|
( |
321
|
0
|
0
|
0
|
|
|
0
|
!ref $coerced_value |
|
|
|
0
|
|
|
|
|
322
|
|
|
|
|
|
|
and (!defined $coerced_value |
323
|
|
|
|
|
|
|
or $coerced_value eq q() |
324
|
|
|
|
|
|
|
or $coerced_value eq '0' |
325
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
326
|
|
|
|
|
|
|
) |
327
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
328
|
|
|
|
|
|
|
"no_validation_needed", "Bool"; |
329
|
0
|
|
|
|
|
0
|
$self->{"no_validation_needed"} = $coerced_value; |
330
|
|
|
|
|
|
|
}; |
331
|
|
|
|
|
|
|
} |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
# Attribute is_mutator (type: Bool) |
334
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 70 |
335
|
5821
|
100
|
|
|
|
11551
|
if ( exists $args->{"is_mutator"} ) { |
336
|
3
|
|
|
|
|
5
|
do { |
337
|
3
|
|
|
|
|
5
|
my $coerced_value = do { |
338
|
3
|
|
|
|
|
7
|
my $to_coerce = $args->{"is_mutator"}; |
339
|
|
|
|
|
|
|
( |
340
|
|
|
|
|
|
|
( |
341
|
|
|
|
|
|
|
!ref $to_coerce |
342
|
|
|
|
|
|
|
and (!defined $to_coerce |
343
|
|
|
|
|
|
|
or $to_coerce eq q() |
344
|
|
|
|
|
|
|
or $to_coerce eq '0' |
345
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
346
|
|
|
|
|
|
|
) |
347
|
|
|
|
|
|
|
) ? $to_coerce |
348
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
349
|
3
|
50
|
33
|
|
|
27
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
350
|
|
|
|
|
|
|
: $to_coerce; |
351
|
|
|
|
|
|
|
}; |
352
|
|
|
|
|
|
|
( |
353
|
3
|
50
|
33
|
|
|
23
|
!ref $coerced_value |
|
|
|
33
|
|
|
|
|
354
|
|
|
|
|
|
|
and (!defined $coerced_value |
355
|
|
|
|
|
|
|
or $coerced_value eq q() |
356
|
|
|
|
|
|
|
or $coerced_value eq '0' |
357
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
358
|
|
|
|
|
|
|
) |
359
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
360
|
|
|
|
|
|
|
"is_mutator", "Bool"; |
361
|
3
|
|
|
|
|
11
|
$self->{"is_mutator"} = $coerced_value; |
362
|
|
|
|
|
|
|
}; |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
# Attribute allow_getter_shortcuts (type: Bool) |
366
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 72 |
367
|
5821
|
|
|
|
|
8275
|
do { |
368
|
|
|
|
|
|
|
my $value = |
369
|
|
|
|
|
|
|
exists( $args->{"allow_getter_shortcuts"} ) |
370
|
5821
|
100
|
|
|
|
12951
|
? $args->{"allow_getter_shortcuts"} |
371
|
|
|
|
|
|
|
: true; |
372
|
5821
|
|
|
|
|
8513
|
do { |
373
|
5821
|
|
|
|
|
8084
|
my $coerced_value = do { |
374
|
5821
|
|
|
|
|
8934
|
my $to_coerce = $value; |
375
|
|
|
|
|
|
|
( |
376
|
|
|
|
|
|
|
( |
377
|
|
|
|
|
|
|
!ref $to_coerce |
378
|
|
|
|
|
|
|
and (!defined $to_coerce |
379
|
|
|
|
|
|
|
or $to_coerce eq q() |
380
|
|
|
|
|
|
|
or $to_coerce eq '0' |
381
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
382
|
|
|
|
|
|
|
) |
383
|
|
|
|
|
|
|
) ? $to_coerce |
384
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
385
|
5821
|
50
|
33
|
|
|
42146
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
386
|
|
|
|
|
|
|
: $to_coerce; |
387
|
|
|
|
|
|
|
}; |
388
|
|
|
|
|
|
|
( |
389
|
5821
|
50
|
66
|
|
|
38859
|
!ref $coerced_value |
|
|
|
66
|
|
|
|
|
390
|
|
|
|
|
|
|
and (!defined $coerced_value |
391
|
|
|
|
|
|
|
or $coerced_value eq q() |
392
|
|
|
|
|
|
|
or $coerced_value eq '0' |
393
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
394
|
|
|
|
|
|
|
) |
395
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
396
|
|
|
|
|
|
|
"allow_getter_shortcuts", "Bool"; |
397
|
5821
|
|
|
|
|
14042
|
$self->{"allow_getter_shortcuts"} = $coerced_value; |
398
|
|
|
|
|
|
|
}; |
399
|
|
|
|
|
|
|
}; |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
# Attribute prefer_shift_self (type: Bool) |
402
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 79 |
403
|
5821
|
|
|
|
|
8876
|
do { |
404
|
|
|
|
|
|
|
my $value = |
405
|
|
|
|
|
|
|
exists( $args->{"prefer_shift_self"} ) |
406
|
5821
|
100
|
|
|
|
12281
|
? $args->{"prefer_shift_self"} |
407
|
|
|
|
|
|
|
: false; |
408
|
5821
|
|
|
|
|
8609
|
do { |
409
|
5821
|
|
|
|
|
8147
|
my $coerced_value = do { |
410
|
5821
|
|
|
|
|
9066
|
my $to_coerce = $value; |
411
|
|
|
|
|
|
|
( |
412
|
|
|
|
|
|
|
( |
413
|
|
|
|
|
|
|
!ref $to_coerce |
414
|
|
|
|
|
|
|
and (!defined $to_coerce |
415
|
|
|
|
|
|
|
or $to_coerce eq q() |
416
|
|
|
|
|
|
|
or $to_coerce eq '0' |
417
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
418
|
|
|
|
|
|
|
) |
419
|
|
|
|
|
|
|
) ? $to_coerce |
420
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
421
|
5821
|
50
|
33
|
|
|
33478
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
422
|
|
|
|
|
|
|
: $to_coerce; |
423
|
|
|
|
|
|
|
}; |
424
|
|
|
|
|
|
|
( |
425
|
5821
|
50
|
66
|
|
|
27453
|
!ref $coerced_value |
|
|
|
66
|
|
|
|
|
426
|
|
|
|
|
|
|
and (!defined $coerced_value |
427
|
|
|
|
|
|
|
or $coerced_value eq q() |
428
|
|
|
|
|
|
|
or $coerced_value eq '0' |
429
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
430
|
|
|
|
|
|
|
) |
431
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
432
|
|
|
|
|
|
|
"prefer_shift_self", "Bool"; |
433
|
5821
|
|
|
|
|
13362
|
$self->{"prefer_shift_self"} = $coerced_value; |
434
|
|
|
|
|
|
|
}; |
435
|
|
|
|
|
|
|
}; |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
# Attribute additional_validation (type: CodeRef|Str|Undef) |
438
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 86 |
439
|
5821
|
100
|
|
|
|
12560
|
if ( exists $args->{"additional_validation"} ) { |
440
|
2002
|
50
|
|
|
|
3001
|
do { |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
443
|
|
|
|
|
|
|
( |
444
|
|
|
|
|
|
|
do { |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
447
|
2002
|
|
|
|
|
6846
|
ref( $args->{"additional_validation"} ) eq 'CODE'; |
448
|
|
|
|
|
|
|
} |
449
|
|
|
|
|
|
|
or do { |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
452
|
673
|
50
|
|
|
|
1953
|
defined( $args->{"additional_validation"} ) and do { |
453
|
|
|
|
|
|
|
ref( \$args->{"additional_validation"} ) eq 'SCALAR' |
454
|
|
|
|
|
|
|
or ref( |
455
|
673
|
50
|
|
|
|
3945
|
\( my $val = $args->{"additional_validation"} ) |
456
|
|
|
|
|
|
|
) eq 'SCALAR'; |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
} |
459
|
2002
|
50
|
66
|
|
|
2888
|
or do { |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
462
|
0
|
|
|
|
|
0
|
!defined( $args->{"additional_validation"} ); |
463
|
|
|
|
|
|
|
} |
464
|
|
|
|
|
|
|
); |
465
|
|
|
|
|
|
|
} |
466
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
467
|
|
|
|
|
|
|
"additional_validation", "CodeRef|Str|Undef"; |
468
|
2002
|
|
|
|
|
4471
|
$self->{"additional_validation"} = $args->{"additional_validation"}; |
469
|
|
|
|
|
|
|
} |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
# Attribute default_for_reset (type: CodeRef) |
472
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 91 |
473
|
5821
|
100
|
|
|
|
11943
|
if ( exists $args->{"default_for_reset"} ) { |
474
|
60
|
50
|
|
|
|
147
|
do { |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
477
|
60
|
|
|
|
|
266
|
ref( $args->{"default_for_reset"} ) eq 'CODE'; |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
480
|
|
|
|
|
|
|
"default_for_reset", "CodeRef"; |
481
|
60
|
|
|
|
|
169
|
$self->{"default_for_reset"} = $args->{"default_for_reset"}; |
482
|
|
|
|
|
|
|
} |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
# Attribute documentation (type: Str) |
485
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 96 |
486
|
5821
|
100
|
|
|
|
11724
|
if ( exists $args->{"documentation"} ) { |
487
|
5818
|
50
|
|
|
|
8085
|
do { |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
490
|
5818
|
50
|
|
|
|
13066
|
defined( $args->{"documentation"} ) and do { |
491
|
|
|
|
|
|
|
ref( \$args->{"documentation"} ) eq 'SCALAR' |
492
|
5818
|
50
|
|
|
|
23316
|
or ref( \( my $val = $args->{"documentation"} ) ) eq |
493
|
|
|
|
|
|
|
'SCALAR'; |
494
|
|
|
|
|
|
|
} |
495
|
|
|
|
|
|
|
} |
496
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
497
|
|
|
|
|
|
|
"documentation", "Str"; |
498
|
5818
|
|
|
|
|
14010
|
$self->{"documentation"} = $args->{"documentation"}; |
499
|
|
|
|
|
|
|
} |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
# Attribute _examples (type: CodeRef) |
502
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 101 |
503
|
5821
|
100
|
|
|
|
12302
|
if ( exists $args->{"_examples"} ) { |
504
|
3866
|
50
|
|
|
|
5684
|
do { |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
507
|
3866
|
|
|
|
|
10238
|
ref( $args->{"_examples"} ) eq 'CODE'; |
508
|
|
|
|
|
|
|
} |
509
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
510
|
|
|
|
|
|
|
"_examples", "CodeRef"; |
511
|
3866
|
|
|
|
|
7682
|
$self->{"_examples"} = $args->{"_examples"}; |
512
|
|
|
|
|
|
|
} |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
# Call BUILD methods |
515
|
5821
|
50
|
33
|
|
|
12768
|
$self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } ); |
|
5821
|
50
|
|
|
|
21278
|
|
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
# Unrecognized parameters |
518
|
|
|
|
|
|
|
my @unknown = grep not( |
519
|
|
|
|
|
|
|
/\A(?:_examples|a(?:dditional_validation|llow_getter_shortcuts|rgs)|curried|d(?:efault_for_reset|ocumentation)|is_(?:chainable|mutator)|lvalue_template|m(?:ax_args|in_args)|n(?:ame|o_validation_needed)|prefer_shift_self|signature|template|usage)\z/ |
520
|
5821
|
|
|
|
|
9712
|
), keys %{$args}; |
|
5821
|
|
|
|
|
69508
|
|
521
|
|
|
|
|
|
|
@unknown |
522
|
5821
|
50
|
|
|
|
17883
|
and croak( |
523
|
|
|
|
|
|
|
"Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
524
|
|
|
|
|
|
|
|
525
|
5821
|
|
|
|
|
46007
|
return $self; |
526
|
|
|
|
|
|
|
} |
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
529
|
|
|
|
|
|
|
sub BUILDALL { |
530
|
2
|
|
|
2
|
0
|
6
|
my $class = ref( $_[0] ); |
531
|
2
|
|
33
|
|
|
7
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
532
|
2
|
50
|
|
|
|
4
|
$_->(@_) for @{ $meta->{BUILD} || [] }; |
|
2
|
|
|
|
|
14
|
|
533
|
|
|
|
|
|
|
} |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
536
|
|
|
|
|
|
|
sub DESTROY { |
537
|
5824
|
|
|
5824
|
|
94788
|
my $self = shift; |
538
|
5824
|
|
33
|
|
|
16879
|
my $class = ref($self) || $self; |
539
|
5824
|
|
33
|
|
|
16667
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
540
|
5824
|
50
|
|
|
|
21308
|
my $in_global_destruction = |
541
|
|
|
|
|
|
|
defined ${^GLOBAL_PHASE} |
542
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
543
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
544
|
5824
|
50
|
|
|
|
9482
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
|
5824
|
|
|
|
|
19442
|
|
545
|
0
|
|
|
|
|
0
|
my $e = do { |
546
|
0
|
|
|
|
|
0
|
local ( $?, $@ ); |
547
|
0
|
|
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
|
0
|
|
|
|
|
0
|
|
548
|
0
|
|
|
|
|
0
|
$@; |
549
|
|
|
|
|
|
|
}; |
550
|
96
|
|
|
96
|
|
922
|
no warnings 'misc'; # avoid (in cleanup) warnings |
|
96
|
|
|
|
|
1600
|
|
|
96
|
|
|
|
|
182372
|
|
551
|
0
|
0
|
|
|
|
0
|
die $e if $e; # rethrow |
552
|
|
|
|
|
|
|
} |
553
|
5824
|
|
|
|
|
52781
|
return; |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} |
557
|
|
|
|
|
|
|
&& eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
# Accessors for _examples |
560
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 101 |
561
|
|
|
|
|
|
|
if ($__XS) { |
562
|
|
|
|
|
|
|
Class::XSAccessor->import( |
563
|
|
|
|
|
|
|
chained => 1, |
564
|
|
|
|
|
|
|
"getters" => { "_examples" => "_examples" }, |
565
|
|
|
|
|
|
|
); |
566
|
|
|
|
|
|
|
} |
567
|
|
|
|
|
|
|
else { |
568
|
|
|
|
|
|
|
*_examples = sub { |
569
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "_examples" usage: $self->_examples()'); |
570
|
|
|
|
|
|
|
$_[0]{"_examples"}; |
571
|
|
|
|
|
|
|
}; |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
# Accessors for additional_validation |
575
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 86 |
576
|
|
|
|
|
|
|
if ($__XS) { |
577
|
|
|
|
|
|
|
Class::XSAccessor->import( |
578
|
|
|
|
|
|
|
chained => 1, |
579
|
|
|
|
|
|
|
"getters" => { "additional_validation" => "additional_validation" }, |
580
|
|
|
|
|
|
|
); |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
else { |
583
|
|
|
|
|
|
|
*additional_validation = sub { |
584
|
|
|
|
|
|
|
@_ == 1 |
585
|
|
|
|
|
|
|
or croak( |
586
|
|
|
|
|
|
|
'Reader "additional_validation" usage: $self->additional_validation()' |
587
|
|
|
|
|
|
|
); |
588
|
|
|
|
|
|
|
$_[0]{"additional_validation"}; |
589
|
|
|
|
|
|
|
}; |
590
|
|
|
|
|
|
|
} |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
# Accessors for allow_getter_shortcuts |
593
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 72 |
594
|
|
|
|
|
|
|
if ($__XS) { |
595
|
|
|
|
|
|
|
Class::XSAccessor->import( |
596
|
|
|
|
|
|
|
chained => 1, |
597
|
|
|
|
|
|
|
"getters" => |
598
|
|
|
|
|
|
|
{ "allow_getter_shortcuts" => "allow_getter_shortcuts" }, |
599
|
|
|
|
|
|
|
); |
600
|
|
|
|
|
|
|
} |
601
|
|
|
|
|
|
|
else { |
602
|
|
|
|
|
|
|
*allow_getter_shortcuts = sub { |
603
|
|
|
|
|
|
|
@_ == 1 |
604
|
|
|
|
|
|
|
or croak( |
605
|
|
|
|
|
|
|
'Reader "allow_getter_shortcuts" usage: $self->allow_getter_shortcuts()' |
606
|
|
|
|
|
|
|
); |
607
|
|
|
|
|
|
|
$_[0]{"allow_getter_shortcuts"}; |
608
|
|
|
|
|
|
|
}; |
609
|
|
|
|
|
|
|
} |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
# Accessors for args |
612
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 27 |
613
|
|
|
|
|
|
|
if ($__XS) { |
614
|
|
|
|
|
|
|
Class::XSAccessor->import( |
615
|
|
|
|
|
|
|
chained => 1, |
616
|
|
|
|
|
|
|
"getters" => { "args" => "args" }, |
617
|
|
|
|
|
|
|
); |
618
|
|
|
|
|
|
|
} |
619
|
|
|
|
|
|
|
else { |
620
|
|
|
|
|
|
|
*args = sub { |
621
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "args" usage: $self->args()'); |
622
|
|
|
|
|
|
|
$_[0]{"args"}; |
623
|
|
|
|
|
|
|
}; |
624
|
|
|
|
|
|
|
} |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
# Accessors for curried |
627
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 54 |
628
|
|
|
|
|
|
|
if ($__XS) { |
629
|
|
|
|
|
|
|
Class::XSAccessor->import( |
630
|
|
|
|
|
|
|
chained => 1, |
631
|
|
|
|
|
|
|
"getters" => { "curried" => "curried" }, |
632
|
|
|
|
|
|
|
); |
633
|
|
|
|
|
|
|
} |
634
|
|
|
|
|
|
|
else { |
635
|
|
|
|
|
|
|
*curried = sub { |
636
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "curried" usage: $self->curried()'); |
637
|
|
|
|
|
|
|
$_[0]{"curried"}; |
638
|
|
|
|
|
|
|
}; |
639
|
|
|
|
|
|
|
} |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
# Accessors for default_for_reset |
642
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 91 |
643
|
|
|
|
|
|
|
if ($__XS) { |
644
|
|
|
|
|
|
|
Class::XSAccessor->import( |
645
|
|
|
|
|
|
|
chained => 1, |
646
|
|
|
|
|
|
|
"getters" => { "default_for_reset" => "default_for_reset" }, |
647
|
|
|
|
|
|
|
); |
648
|
|
|
|
|
|
|
} |
649
|
|
|
|
|
|
|
else { |
650
|
|
|
|
|
|
|
*default_for_reset = sub { |
651
|
|
|
|
|
|
|
@_ == 1 |
652
|
|
|
|
|
|
|
or croak( |
653
|
|
|
|
|
|
|
'Reader "default_for_reset" usage: $self->default_for_reset()'); |
654
|
|
|
|
|
|
|
$_[0]{"default_for_reset"}; |
655
|
|
|
|
|
|
|
}; |
656
|
|
|
|
|
|
|
} |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
# Accessors for documentation |
659
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 96 |
660
|
|
|
|
|
|
|
if ($__XS) { |
661
|
|
|
|
|
|
|
Class::XSAccessor->import( |
662
|
|
|
|
|
|
|
chained => 1, |
663
|
|
|
|
|
|
|
"getters" => { "documentation" => "documentation" }, |
664
|
|
|
|
|
|
|
); |
665
|
|
|
|
|
|
|
} |
666
|
|
|
|
|
|
|
else { |
667
|
|
|
|
|
|
|
*documentation = sub { |
668
|
|
|
|
|
|
|
@_ == 1 |
669
|
|
|
|
|
|
|
or croak('Reader "documentation" usage: $self->documentation()'); |
670
|
|
|
|
|
|
|
$_[0]{"documentation"}; |
671
|
|
|
|
|
|
|
}; |
672
|
|
|
|
|
|
|
} |
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
# Accessors for is_chainable |
675
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59 |
676
|
|
|
|
|
|
|
if ($__XS) { |
677
|
|
|
|
|
|
|
Class::XSAccessor->import( |
678
|
|
|
|
|
|
|
chained => 1, |
679
|
|
|
|
|
|
|
"getters" => { "is_chainable" => "is_chainable" }, |
680
|
|
|
|
|
|
|
); |
681
|
|
|
|
|
|
|
} |
682
|
|
|
|
|
|
|
else { |
683
|
|
|
|
|
|
|
*is_chainable = sub { |
684
|
|
|
|
|
|
|
@_ == 1 |
685
|
|
|
|
|
|
|
or croak('Reader "is_chainable" usage: $self->is_chainable()'); |
686
|
|
|
|
|
|
|
$_[0]{"is_chainable"}; |
687
|
|
|
|
|
|
|
}; |
688
|
|
|
|
|
|
|
} |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
# Accessors for is_mutator |
691
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 70 |
692
|
|
|
|
|
|
|
sub is_mutator { |
693
|
4244
|
50
|
|
4244
|
1
|
10289
|
@_ == 1 or croak('Reader "is_mutator" usage: $self->is_mutator()'); |
694
|
|
|
|
|
|
|
( |
695
|
|
|
|
|
|
|
exists( $_[0]{"is_mutator"} ) ? $_[0]{"is_mutator"} : ( |
696
|
4244
|
100
|
|
|
|
10759
|
$_[0]{"is_mutator"} = do { |
697
|
4240
|
|
|
|
|
6305
|
my $default_value = do { |
698
|
4240
|
|
|
|
|
11377
|
my $to_coerce = |
699
|
|
|
|
|
|
|
$Sub::HandlesVia::Handler::__is_mutator_DEFAULT__->( |
700
|
|
|
|
|
|
|
$_[0] ); |
701
|
|
|
|
|
|
|
( |
702
|
|
|
|
|
|
|
( |
703
|
|
|
|
|
|
|
!ref $to_coerce |
704
|
|
|
|
|
|
|
and (!defined $to_coerce |
705
|
|
|
|
|
|
|
or $to_coerce eq q() |
706
|
|
|
|
|
|
|
or $to_coerce eq '0' |
707
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
708
|
|
|
|
|
|
|
) |
709
|
|
|
|
|
|
|
) ? $to_coerce |
710
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
711
|
4240
|
50
|
33
|
|
|
31484
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
712
|
|
|
|
|
|
|
: $to_coerce; |
713
|
|
|
|
|
|
|
}; |
714
|
|
|
|
|
|
|
( |
715
|
4240
|
50
|
66
|
|
|
24957
|
!ref $default_value |
|
|
|
66
|
|
|
|
|
716
|
|
|
|
|
|
|
and (!defined $default_value |
717
|
|
|
|
|
|
|
or $default_value eq q() |
718
|
|
|
|
|
|
|
or $default_value eq '0' |
719
|
|
|
|
|
|
|
or $default_value eq '1' ) |
720
|
|
|
|
|
|
|
) |
721
|
|
|
|
|
|
|
or croak( "Type check failed in default: %s should be %s", |
722
|
|
|
|
|
|
|
"is_mutator", "Bool" ); |
723
|
4240
|
|
|
|
|
17651
|
$default_value; |
724
|
|
|
|
|
|
|
} |
725
|
|
|
|
|
|
|
) |
726
|
|
|
|
|
|
|
); |
727
|
|
|
|
|
|
|
} |
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
# Accessors for lvalue_template |
730
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 22 |
731
|
|
|
|
|
|
|
if ($__XS) { |
732
|
|
|
|
|
|
|
Class::XSAccessor->import( |
733
|
|
|
|
|
|
|
chained => 1, |
734
|
|
|
|
|
|
|
"getters" => { "lvalue_template" => "lvalue_template" }, |
735
|
|
|
|
|
|
|
); |
736
|
|
|
|
|
|
|
} |
737
|
|
|
|
|
|
|
else { |
738
|
|
|
|
|
|
|
*lvalue_template = sub { |
739
|
|
|
|
|
|
|
@_ == 1 |
740
|
|
|
|
|
|
|
or |
741
|
|
|
|
|
|
|
croak('Reader "lvalue_template" usage: $self->lvalue_template()'); |
742
|
|
|
|
|
|
|
$_[0]{"lvalue_template"}; |
743
|
|
|
|
|
|
|
}; |
744
|
|
|
|
|
|
|
} |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
# Accessors for max_args |
747
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37 |
748
|
|
|
|
|
|
|
sub max_args { |
749
|
12563
|
50
|
|
12563
|
1
|
25948
|
@_ == 1 or croak('Reader "max_args" usage: $self->max_args()'); |
750
|
|
|
|
|
|
|
( |
751
|
|
|
|
|
|
|
exists( $_[0]{"max_args"} ) ? $_[0]{"max_args"} : ( |
752
|
12563
|
100
|
|
|
|
44742
|
$_[0]{"max_args"} = do { |
753
|
2438
|
|
|
|
|
6588
|
my $default_value = $_[0]->_build_max_args; |
754
|
2438
|
50
|
|
|
|
3873
|
do { |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
757
|
|
|
|
|
|
|
( |
758
|
|
|
|
|
|
|
( |
759
|
2438
|
100
|
|
|
|
3545
|
do { |
760
|
2438
|
|
|
|
|
3808
|
my $tmp = $default_value; |
761
|
2438
|
100
|
66
|
|
|
18351
|
defined($tmp) |
762
|
|
|
|
|
|
|
and !ref($tmp) |
763
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
764
|
|
|
|
|
|
|
} |
765
|
|
|
|
|
|
|
) |
766
|
|
|
|
|
|
|
or ( !defined($default_value) ) |
767
|
|
|
|
|
|
|
); |
768
|
|
|
|
|
|
|
} |
769
|
|
|
|
|
|
|
or croak( "Type check failed in default: %s should be %s", |
770
|
|
|
|
|
|
|
"max_args", "Int|Undef" ); |
771
|
2438
|
|
|
|
|
9763
|
$default_value; |
772
|
|
|
|
|
|
|
} |
773
|
|
|
|
|
|
|
) |
774
|
|
|
|
|
|
|
); |
775
|
|
|
|
|
|
|
} |
776
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
# Accessors for min_args |
778
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37 |
779
|
|
|
|
|
|
|
sub min_args { |
780
|
6036
|
50
|
|
6036
|
1
|
13176
|
@_ == 1 or croak('Reader "min_args" usage: $self->min_args()'); |
781
|
|
|
|
|
|
|
( |
782
|
|
|
|
|
|
|
exists( $_[0]{"min_args"} ) ? $_[0]{"min_args"} : ( |
783
|
6036
|
100
|
|
|
|
20807
|
$_[0]{"min_args"} = do { |
784
|
2122
|
|
|
|
|
6077
|
my $default_value = $_[0]->_build_min_args; |
785
|
2122
|
50
|
|
|
|
3539
|
do { |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
788
|
|
|
|
|
|
|
( |
789
|
|
|
|
|
|
|
( |
790
|
2122
|
100
|
|
|
|
3066
|
do { |
791
|
2122
|
|
|
|
|
3441
|
my $tmp = $default_value; |
792
|
2122
|
100
|
66
|
|
|
18875
|
defined($tmp) |
793
|
|
|
|
|
|
|
and !ref($tmp) |
794
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
795
|
|
|
|
|
|
|
} |
796
|
|
|
|
|
|
|
) |
797
|
|
|
|
|
|
|
or ( !defined($default_value) ) |
798
|
|
|
|
|
|
|
); |
799
|
|
|
|
|
|
|
} |
800
|
|
|
|
|
|
|
or croak( "Type check failed in default: %s should be %s", |
801
|
|
|
|
|
|
|
"min_args", "Int|Undef" ); |
802
|
2122
|
|
|
|
|
10700
|
$default_value; |
803
|
|
|
|
|
|
|
} |
804
|
|
|
|
|
|
|
) |
805
|
|
|
|
|
|
|
); |
806
|
|
|
|
|
|
|
} |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
# Accessors for name |
809
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 12 |
810
|
|
|
|
|
|
|
if ($__XS) { |
811
|
|
|
|
|
|
|
Class::XSAccessor->import( |
812
|
|
|
|
|
|
|
chained => 1, |
813
|
|
|
|
|
|
|
"getters" => { "name" => "name" }, |
814
|
|
|
|
|
|
|
); |
815
|
|
|
|
|
|
|
} |
816
|
|
|
|
|
|
|
else { |
817
|
|
|
|
|
|
|
*name = sub { |
818
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "name" usage: $self->name()'); |
819
|
|
|
|
|
|
|
$_[0]{"name"}; |
820
|
|
|
|
|
|
|
}; |
821
|
|
|
|
|
|
|
} |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
# Accessors for no_validation_needed |
824
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59 |
825
|
|
|
|
|
|
|
if ($__XS) { |
826
|
|
|
|
|
|
|
Class::XSAccessor->import( |
827
|
|
|
|
|
|
|
chained => 1, |
828
|
|
|
|
|
|
|
"getters" => { "no_validation_needed" => "no_validation_needed" }, |
829
|
|
|
|
|
|
|
); |
830
|
|
|
|
|
|
|
} |
831
|
|
|
|
|
|
|
else { |
832
|
|
|
|
|
|
|
*no_validation_needed = sub { |
833
|
|
|
|
|
|
|
@_ == 1 |
834
|
|
|
|
|
|
|
or croak( |
835
|
|
|
|
|
|
|
'Reader "no_validation_needed" usage: $self->no_validation_needed()' |
836
|
|
|
|
|
|
|
); |
837
|
|
|
|
|
|
|
$_[0]{"no_validation_needed"}; |
838
|
|
|
|
|
|
|
}; |
839
|
|
|
|
|
|
|
} |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
# Accessors for prefer_shift_self |
842
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 79 |
843
|
|
|
|
|
|
|
if ($__XS) { |
844
|
|
|
|
|
|
|
Class::XSAccessor->import( |
845
|
|
|
|
|
|
|
chained => 1, |
846
|
|
|
|
|
|
|
"getters" => { "prefer_shift_self" => "prefer_shift_self" }, |
847
|
|
|
|
|
|
|
); |
848
|
|
|
|
|
|
|
} |
849
|
|
|
|
|
|
|
else { |
850
|
|
|
|
|
|
|
*prefer_shift_self = sub { |
851
|
|
|
|
|
|
|
@_ == 1 |
852
|
|
|
|
|
|
|
or croak( |
853
|
|
|
|
|
|
|
'Reader "prefer_shift_self" usage: $self->prefer_shift_self()'); |
854
|
|
|
|
|
|
|
$_[0]{"prefer_shift_self"}; |
855
|
|
|
|
|
|
|
}; |
856
|
|
|
|
|
|
|
} |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
# Accessors for signature |
859
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 43 |
860
|
|
|
|
|
|
|
if ($__XS) { |
861
|
|
|
|
|
|
|
Class::XSAccessor->import( |
862
|
|
|
|
|
|
|
chained => 1, |
863
|
|
|
|
|
|
|
"getters" => { "signature" => "signature" }, |
864
|
|
|
|
|
|
|
); |
865
|
|
|
|
|
|
|
} |
866
|
|
|
|
|
|
|
else { |
867
|
|
|
|
|
|
|
*signature = sub { |
868
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "signature" usage: $self->signature()'); |
869
|
|
|
|
|
|
|
$_[0]{"signature"}; |
870
|
|
|
|
|
|
|
}; |
871
|
|
|
|
|
|
|
} |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
# Accessors for template |
874
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 17 |
875
|
|
|
|
|
|
|
if ($__XS) { |
876
|
|
|
|
|
|
|
Class::XSAccessor->import( |
877
|
|
|
|
|
|
|
chained => 1, |
878
|
|
|
|
|
|
|
"getters" => { "template" => "template" }, |
879
|
|
|
|
|
|
|
); |
880
|
|
|
|
|
|
|
} |
881
|
|
|
|
|
|
|
else { |
882
|
|
|
|
|
|
|
*template = sub { |
883
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "template" usage: $self->template()'); |
884
|
|
|
|
|
|
|
$_[0]{"template"}; |
885
|
|
|
|
|
|
|
}; |
886
|
|
|
|
|
|
|
} |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
# Accessors for usage |
889
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 48 |
890
|
|
|
|
|
|
|
sub usage { |
891
|
2661
|
50
|
|
2661
|
1
|
6188
|
@_ == 1 or croak('Reader "usage" usage: $self->usage()'); |
892
|
|
|
|
|
|
|
( |
893
|
|
|
|
|
|
|
exists( $_[0]{"usage"} ) ? $_[0]{"usage"} : ( |
894
|
2661
|
100
|
|
|
|
6562
|
$_[0]{"usage"} = do { |
895
|
2292
|
|
|
|
|
6492
|
my $default_value = $_[0]->_build_usage; |
896
|
2292
|
50
|
|
|
|
3764
|
do { |
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
899
|
2292
|
50
|
|
|
|
5537
|
defined($default_value) and do { |
900
|
2292
|
50
|
|
|
|
10101
|
ref( \$default_value ) eq 'SCALAR' |
901
|
|
|
|
|
|
|
or ref( \( my $val = $default_value ) ) eq |
902
|
|
|
|
|
|
|
'SCALAR'; |
903
|
|
|
|
|
|
|
} |
904
|
|
|
|
|
|
|
} |
905
|
|
|
|
|
|
|
or croak( "Type check failed in default: %s should be %s", |
906
|
|
|
|
|
|
|
"usage", "Str" ); |
907
|
2292
|
|
|
|
|
9090
|
$default_value; |
908
|
|
|
|
|
|
|
} |
909
|
|
|
|
|
|
|
) |
910
|
|
|
|
|
|
|
); |
911
|
|
|
|
|
|
|
} |
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
# See UNIVERSAL |
914
|
|
|
|
|
|
|
sub DOES { |
915
|
6912
|
|
|
6912
|
0
|
12124
|
my ( $self, $role ) = @_; |
916
|
6912
|
|
|
|
|
9104
|
our %DOES; |
917
|
6912
|
50
|
|
|
|
12930
|
return $DOES{$role} if exists $DOES{$role}; |
918
|
6912
|
50
|
|
|
|
12213
|
return 1 if $role eq __PACKAGE__; |
919
|
6912
|
50
|
33
|
|
|
18446
|
if ( $INC{'Moose/Util.pm'} |
|
|
|
66
|
|
|
|
|
920
|
|
|
|
|
|
|
and my $meta = Moose::Util::find_meta( ref $self or $self ) ) |
921
|
|
|
|
|
|
|
{ |
922
|
0
|
0
|
0
|
|
|
0
|
$meta->can('does_role') and $meta->does_role($role) and return 1; |
923
|
|
|
|
|
|
|
} |
924
|
6912
|
|
|
|
|
42680
|
return $self->SUPER::DOES($role); |
925
|
|
|
|
|
|
|
} |
926
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
928
|
|
|
|
|
|
|
sub does { |
929
|
2304
|
|
|
2304
|
0
|
317855
|
shift->DOES(@_); |
930
|
|
|
|
|
|
|
} |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
1; |
933
|
|
|
|
|
|
|
} |
934
|
|
|
|
|
|
|
{ |
935
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
package Sub::HandlesVia::Handler::Traditional; |
937
|
96
|
|
|
96
|
|
900
|
use strict; |
|
96
|
|
|
|
|
330
|
|
|
96
|
|
|
|
|
2994
|
|
938
|
96
|
|
|
96
|
|
641
|
use warnings; |
|
96
|
|
|
|
|
270
|
|
|
96
|
|
|
|
|
3320
|
|
939
|
96
|
|
|
96
|
|
1960
|
no warnings qw( once void ); |
|
96
|
|
|
|
|
320
|
|
|
96
|
|
|
|
|
13530
|
|
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
942
|
|
|
|
|
|
|
our $MITE_SHIM = "Sub::HandlesVia::Mite"; |
943
|
|
|
|
|
|
|
our $MITE_VERSION = "0.012000"; |
944
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
# Mite keywords |
946
|
|
|
|
|
|
|
BEGIN { |
947
|
96
|
|
|
96
|
|
532
|
my ( $SHIM, $CALLER ) = |
948
|
|
|
|
|
|
|
( "Sub::HandlesVia::Mite", "Sub::HandlesVia::Handler::Traditional" ); |
949
|
|
|
|
|
|
|
( |
950
|
|
|
|
|
|
|
*after, *around, *before, *extends, *field, |
951
|
|
|
|
|
|
|
*has, *param, *signature_for, *with |
952
|
|
|
|
|
|
|
) |
953
|
96
|
|
|
|
|
292
|
= do { |
954
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
956
|
96
|
|
|
96
|
|
765
|
no warnings 'redefine'; |
|
96
|
|
|
|
|
216
|
|
|
96
|
|
|
|
|
22758
|
|
957
|
|
|
|
|
|
|
( |
958
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
959
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
960
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
961
|
|
|
|
|
|
|
sub { }, |
962
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) }, |
963
|
96
|
|
|
|
|
453
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
964
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
965
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
966
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
967
|
96
|
|
|
|
|
19144
|
); |
968
|
|
|
|
|
|
|
}; |
969
|
|
|
|
|
|
|
} |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
# Mite imports |
972
|
|
|
|
|
|
|
BEGIN { |
973
|
96
|
|
|
96
|
|
746
|
require Scalar::Util; |
974
|
96
|
|
|
|
|
1794
|
*STRICT = \&Sub::HandlesVia::Mite::STRICT; |
975
|
96
|
|
|
|
|
313
|
*bare = \&Sub::HandlesVia::Mite::bare; |
976
|
96
|
|
|
|
|
302
|
*blessed = \&Scalar::Util::blessed; |
977
|
96
|
|
|
|
|
261
|
*carp = \&Sub::HandlesVia::Mite::carp; |
978
|
96
|
|
|
|
|
239
|
*confess = \&Sub::HandlesVia::Mite::confess; |
979
|
96
|
|
|
|
|
255
|
*croak = \&Sub::HandlesVia::Mite::croak; |
980
|
96
|
|
|
|
|
264
|
*false = \&Sub::HandlesVia::Mite::false; |
981
|
96
|
|
|
|
|
291
|
*guard = \&Sub::HandlesVia::Mite::guard; |
982
|
96
|
|
|
|
|
232
|
*lazy = \&Sub::HandlesVia::Mite::lazy; |
983
|
96
|
|
|
|
|
235
|
*lock = \&Sub::HandlesVia::Mite::lock; |
984
|
96
|
|
|
|
|
245
|
*ro = \&Sub::HandlesVia::Mite::ro; |
985
|
96
|
|
|
|
|
217
|
*rw = \&Sub::HandlesVia::Mite::rw; |
986
|
96
|
|
|
|
|
238
|
*rwp = \&Sub::HandlesVia::Mite::rwp; |
987
|
96
|
|
|
|
|
264
|
*true = \&Sub::HandlesVia::Mite::true; |
988
|
96
|
|
|
|
|
3618
|
*unlock = \&Sub::HandlesVia::Mite::unlock; |
989
|
|
|
|
|
|
|
} |
990
|
|
|
|
|
|
|
|
991
|
|
|
|
|
|
|
BEGIN { |
992
|
|
|
|
|
|
|
|
993
|
96
|
|
|
96
|
|
689
|
use mro 'c3'; |
|
96
|
|
|
|
|
263
|
|
|
96
|
|
|
|
|
998
|
|
994
|
96
|
|
|
96
|
|
5061
|
our @ISA; |
995
|
96
|
|
|
|
|
214226
|
push @ISA, "Sub::HandlesVia::Handler"; |
996
|
|
|
|
|
|
|
} |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
999
|
|
|
|
|
|
|
sub new { |
1000
|
1
|
50
|
|
1
|
|
5
|
my $class = ref( $_[0] ) ? ref(shift) : shift; |
1001
|
1
|
|
33
|
|
|
11
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
1002
|
1
|
|
|
|
|
4
|
my $self = bless {}, $class; |
1003
|
|
|
|
|
|
|
my $args = |
1004
|
|
|
|
|
|
|
$meta->{HAS_BUILDARGS} |
1005
|
|
|
|
|
|
|
? $class->BUILDARGS(@_) |
1006
|
1
|
50
|
|
|
|
8
|
: { ( @_ == 1 ) ? %{ $_[0] } : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
1007
|
1
|
|
|
|
|
3
|
my $no_build = delete $args->{__no_BUILD__}; |
1008
|
|
|
|
|
|
|
|
1009
|
|
|
|
|
|
|
# Attribute template (type: Str) |
1010
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 17 |
1011
|
1
|
50
|
|
|
|
4
|
if ( exists $args->{"template"} ) { |
1012
|
0
|
0
|
|
|
|
0
|
do { |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1015
|
0
|
0
|
|
|
|
0
|
defined( $args->{"template"} ) and do { |
1016
|
|
|
|
|
|
|
ref( \$args->{"template"} ) eq 'SCALAR' |
1017
|
0
|
0
|
|
|
|
0
|
or ref( \( my $val = $args->{"template"} ) ) eq 'SCALAR'; |
1018
|
|
|
|
|
|
|
} |
1019
|
|
|
|
|
|
|
} |
1020
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1021
|
|
|
|
|
|
|
"template", "Str"; |
1022
|
0
|
|
|
|
|
0
|
$self->{"template"} = $args->{"template"}; |
1023
|
|
|
|
|
|
|
} |
1024
|
|
|
|
|
|
|
|
1025
|
|
|
|
|
|
|
# Attribute lvalue_template (type: Str) |
1026
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 22 |
1027
|
1
|
50
|
|
|
|
4
|
if ( exists $args->{"lvalue_template"} ) { |
1028
|
0
|
0
|
|
|
|
0
|
do { |
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1031
|
0
|
0
|
|
|
|
0
|
defined( $args->{"lvalue_template"} ) and do { |
1032
|
|
|
|
|
|
|
ref( \$args->{"lvalue_template"} ) eq 'SCALAR' |
1033
|
0
|
0
|
|
|
|
0
|
or ref( \( my $val = $args->{"lvalue_template"} ) ) eq |
1034
|
|
|
|
|
|
|
'SCALAR'; |
1035
|
|
|
|
|
|
|
} |
1036
|
|
|
|
|
|
|
} |
1037
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1038
|
|
|
|
|
|
|
"lvalue_template", "Str"; |
1039
|
0
|
|
|
|
|
0
|
$self->{"lvalue_template"} = $args->{"lvalue_template"}; |
1040
|
|
|
|
|
|
|
} |
1041
|
|
|
|
|
|
|
|
1042
|
|
|
|
|
|
|
# Attribute args (type: Int|Undef) |
1043
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 27 |
1044
|
1
|
|
|
|
|
2
|
do { |
1045
|
1
|
50
|
|
|
|
4
|
my $value = exists( $args->{"args"} ) ? $args->{"args"} : undef; |
1046
|
1
|
50
|
|
|
|
3
|
do { |
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1049
|
|
|
|
|
|
|
( |
1050
|
|
|
|
|
|
|
( |
1051
|
1
|
50
|
|
|
|
2
|
do { |
1052
|
1
|
|
|
|
|
2
|
my $tmp = $value; |
1053
|
1
|
50
|
33
|
|
|
11
|
defined($tmp) |
1054
|
|
|
|
|
|
|
and !ref($tmp) |
1055
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
1056
|
|
|
|
|
|
|
} |
1057
|
|
|
|
|
|
|
) |
1058
|
|
|
|
|
|
|
or ( !defined($value) ) |
1059
|
|
|
|
|
|
|
); |
1060
|
|
|
|
|
|
|
} |
1061
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1062
|
|
|
|
|
|
|
"args", "Int|Undef"; |
1063
|
1
|
|
|
|
|
7
|
$self->{"args"} = $value; |
1064
|
|
|
|
|
|
|
}; |
1065
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
# Attribute min_args (type: Int|Undef) |
1067
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37 |
1068
|
1
|
50
|
|
|
|
16
|
if ( exists $args->{"min_args"} ) { |
1069
|
0
|
0
|
|
|
|
0
|
do { |
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1072
|
|
|
|
|
|
|
( |
1073
|
|
|
|
|
|
|
( |
1074
|
|
|
|
|
|
|
do { |
1075
|
0
|
|
|
|
|
0
|
my $tmp = $args->{"min_args"}; |
1076
|
0
|
0
|
0
|
|
|
0
|
defined($tmp) |
1077
|
|
|
|
|
|
|
and !ref($tmp) |
1078
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
1079
|
|
|
|
|
|
|
} |
1080
|
|
|
|
|
|
|
) |
1081
|
0
|
0
|
|
|
|
0
|
or do { |
1082
|
|
|
|
|
|
|
|
1083
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1084
|
0
|
|
|
|
|
0
|
!defined( $args->{"min_args"} ); |
1085
|
|
|
|
|
|
|
} |
1086
|
|
|
|
|
|
|
); |
1087
|
|
|
|
|
|
|
} |
1088
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1089
|
|
|
|
|
|
|
"min_args", "Int|Undef"; |
1090
|
0
|
|
|
|
|
0
|
$self->{"min_args"} = $args->{"min_args"}; |
1091
|
|
|
|
|
|
|
} |
1092
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
# Attribute max_args (type: Int|Undef) |
1094
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37 |
1095
|
1
|
50
|
|
|
|
5
|
if ( exists $args->{"max_args"} ) { |
1096
|
0
|
0
|
|
|
|
0
|
do { |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1099
|
|
|
|
|
|
|
( |
1100
|
|
|
|
|
|
|
( |
1101
|
|
|
|
|
|
|
do { |
1102
|
0
|
|
|
|
|
0
|
my $tmp = $args->{"max_args"}; |
1103
|
0
|
0
|
0
|
|
|
0
|
defined($tmp) |
1104
|
|
|
|
|
|
|
and !ref($tmp) |
1105
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
1106
|
|
|
|
|
|
|
} |
1107
|
|
|
|
|
|
|
) |
1108
|
0
|
0
|
|
|
|
0
|
or do { |
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1111
|
0
|
|
|
|
|
0
|
!defined( $args->{"max_args"} ); |
1112
|
|
|
|
|
|
|
} |
1113
|
|
|
|
|
|
|
); |
1114
|
|
|
|
|
|
|
} |
1115
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1116
|
|
|
|
|
|
|
"max_args", "Int|Undef"; |
1117
|
0
|
|
|
|
|
0
|
$self->{"max_args"} = $args->{"max_args"}; |
1118
|
|
|
|
|
|
|
} |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
# Attribute signature (type: ArrayRef|Undef) |
1121
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 43 |
1122
|
1
|
50
|
|
|
|
4
|
if ( exists $args->{"signature"} ) { |
1123
|
0
|
0
|
|
|
|
0
|
do { |
1124
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1126
|
|
|
|
|
|
|
( |
1127
|
|
|
|
|
|
|
do { |
1128
|
|
|
|
|
|
|
|
1129
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1130
|
0
|
|
|
|
|
0
|
ref( $args->{"signature"} ) eq 'ARRAY'; |
1131
|
|
|
|
|
|
|
} |
1132
|
0
|
0
|
|
|
|
0
|
or do { |
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1135
|
0
|
|
|
|
|
0
|
!defined( $args->{"signature"} ); |
1136
|
|
|
|
|
|
|
} |
1137
|
|
|
|
|
|
|
); |
1138
|
|
|
|
|
|
|
} |
1139
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1140
|
|
|
|
|
|
|
"signature", "ArrayRef|Undef"; |
1141
|
0
|
|
|
|
|
0
|
$self->{"signature"} = $args->{"signature"}; |
1142
|
|
|
|
|
|
|
} |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
# Attribute usage (type: Str) |
1145
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 48 |
1146
|
1
|
50
|
|
|
|
21
|
if ( exists $args->{"usage"} ) { |
1147
|
0
|
0
|
|
|
|
0
|
do { |
1148
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1150
|
0
|
0
|
|
|
|
0
|
defined( $args->{"usage"} ) and do { |
1151
|
|
|
|
|
|
|
ref( \$args->{"usage"} ) eq 'SCALAR' |
1152
|
0
|
0
|
|
|
|
0
|
or ref( \( my $val = $args->{"usage"} ) ) eq 'SCALAR'; |
1153
|
|
|
|
|
|
|
} |
1154
|
|
|
|
|
|
|
} |
1155
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1156
|
|
|
|
|
|
|
"usage", "Str"; |
1157
|
0
|
|
|
|
|
0
|
$self->{"usage"} = $args->{"usage"}; |
1158
|
|
|
|
|
|
|
} |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
# Attribute curried (type: ArrayRef) |
1161
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 54 |
1162
|
1
|
50
|
|
|
|
5
|
if ( exists $args->{"curried"} ) { |
1163
|
0
|
0
|
|
|
|
0
|
do { |
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1166
|
0
|
|
|
|
|
0
|
ref( $args->{"curried"} ) eq 'ARRAY'; |
1167
|
|
|
|
|
|
|
} |
1168
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1169
|
|
|
|
|
|
|
"curried", "ArrayRef"; |
1170
|
0
|
|
|
|
|
0
|
$self->{"curried"} = $args->{"curried"}; |
1171
|
|
|
|
|
|
|
} |
1172
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
# Attribute is_chainable (type: Bool) |
1174
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59 |
1175
|
1
|
50
|
|
|
|
3
|
if ( exists $args->{"is_chainable"} ) { |
1176
|
0
|
|
|
|
|
0
|
do { |
1177
|
0
|
|
|
|
|
0
|
my $coerced_value = do { |
1178
|
0
|
|
|
|
|
0
|
my $to_coerce = $args->{"is_chainable"}; |
1179
|
|
|
|
|
|
|
( |
1180
|
|
|
|
|
|
|
( |
1181
|
|
|
|
|
|
|
!ref $to_coerce |
1182
|
|
|
|
|
|
|
and (!defined $to_coerce |
1183
|
|
|
|
|
|
|
or $to_coerce eq q() |
1184
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1185
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1186
|
|
|
|
|
|
|
) |
1187
|
|
|
|
|
|
|
) ? $to_coerce |
1188
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1189
|
0
|
0
|
0
|
|
|
0
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1190
|
|
|
|
|
|
|
: $to_coerce; |
1191
|
|
|
|
|
|
|
}; |
1192
|
|
|
|
|
|
|
( |
1193
|
0
|
0
|
0
|
|
|
0
|
!ref $coerced_value |
|
|
|
0
|
|
|
|
|
1194
|
|
|
|
|
|
|
and (!defined $coerced_value |
1195
|
|
|
|
|
|
|
or $coerced_value eq q() |
1196
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1197
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1198
|
|
|
|
|
|
|
) |
1199
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1200
|
|
|
|
|
|
|
"is_chainable", "Bool"; |
1201
|
0
|
|
|
|
|
0
|
$self->{"is_chainable"} = $coerced_value; |
1202
|
|
|
|
|
|
|
}; |
1203
|
|
|
|
|
|
|
} |
1204
|
|
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
# Attribute no_validation_needed (type: Bool) |
1206
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59 |
1207
|
1
|
50
|
|
|
|
4
|
if ( exists $args->{"no_validation_needed"} ) { |
1208
|
0
|
|
|
|
|
0
|
do { |
1209
|
0
|
|
|
|
|
0
|
my $coerced_value = do { |
1210
|
0
|
|
|
|
|
0
|
my $to_coerce = $args->{"no_validation_needed"}; |
1211
|
|
|
|
|
|
|
( |
1212
|
|
|
|
|
|
|
( |
1213
|
|
|
|
|
|
|
!ref $to_coerce |
1214
|
|
|
|
|
|
|
and (!defined $to_coerce |
1215
|
|
|
|
|
|
|
or $to_coerce eq q() |
1216
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1217
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1218
|
|
|
|
|
|
|
) |
1219
|
|
|
|
|
|
|
) ? $to_coerce |
1220
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1221
|
0
|
0
|
0
|
|
|
0
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1222
|
|
|
|
|
|
|
: $to_coerce; |
1223
|
|
|
|
|
|
|
}; |
1224
|
|
|
|
|
|
|
( |
1225
|
0
|
0
|
0
|
|
|
0
|
!ref $coerced_value |
|
|
|
0
|
|
|
|
|
1226
|
|
|
|
|
|
|
and (!defined $coerced_value |
1227
|
|
|
|
|
|
|
or $coerced_value eq q() |
1228
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1229
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1230
|
|
|
|
|
|
|
) |
1231
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1232
|
|
|
|
|
|
|
"no_validation_needed", "Bool"; |
1233
|
0
|
|
|
|
|
0
|
$self->{"no_validation_needed"} = $coerced_value; |
1234
|
|
|
|
|
|
|
}; |
1235
|
|
|
|
|
|
|
} |
1236
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
# Attribute is_mutator (type: Bool) |
1238
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 70 |
1239
|
1
|
50
|
|
|
|
3
|
if ( exists $args->{"is_mutator"} ) { |
1240
|
0
|
|
|
|
|
0
|
do { |
1241
|
0
|
|
|
|
|
0
|
my $coerced_value = do { |
1242
|
0
|
|
|
|
|
0
|
my $to_coerce = $args->{"is_mutator"}; |
1243
|
|
|
|
|
|
|
( |
1244
|
|
|
|
|
|
|
( |
1245
|
|
|
|
|
|
|
!ref $to_coerce |
1246
|
|
|
|
|
|
|
and (!defined $to_coerce |
1247
|
|
|
|
|
|
|
or $to_coerce eq q() |
1248
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1249
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1250
|
|
|
|
|
|
|
) |
1251
|
|
|
|
|
|
|
) ? $to_coerce |
1252
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1253
|
0
|
0
|
0
|
|
|
0
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1254
|
|
|
|
|
|
|
: $to_coerce; |
1255
|
|
|
|
|
|
|
}; |
1256
|
|
|
|
|
|
|
( |
1257
|
0
|
0
|
0
|
|
|
0
|
!ref $coerced_value |
|
|
|
0
|
|
|
|
|
1258
|
|
|
|
|
|
|
and (!defined $coerced_value |
1259
|
|
|
|
|
|
|
or $coerced_value eq q() |
1260
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1261
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1262
|
|
|
|
|
|
|
) |
1263
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1264
|
|
|
|
|
|
|
"is_mutator", "Bool"; |
1265
|
0
|
|
|
|
|
0
|
$self->{"is_mutator"} = $coerced_value; |
1266
|
|
|
|
|
|
|
}; |
1267
|
|
|
|
|
|
|
} |
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
# Attribute allow_getter_shortcuts (type: Bool) |
1270
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 72 |
1271
|
1
|
|
|
|
|
2
|
do { |
1272
|
|
|
|
|
|
|
my $value = |
1273
|
|
|
|
|
|
|
exists( $args->{"allow_getter_shortcuts"} ) |
1274
|
1
|
50
|
|
|
|
5
|
? $args->{"allow_getter_shortcuts"} |
1275
|
|
|
|
|
|
|
: true; |
1276
|
1
|
|
|
|
|
2
|
do { |
1277
|
1
|
|
|
|
|
2
|
my $coerced_value = do { |
1278
|
1
|
|
|
|
|
2
|
my $to_coerce = $value; |
1279
|
|
|
|
|
|
|
( |
1280
|
|
|
|
|
|
|
( |
1281
|
|
|
|
|
|
|
!ref $to_coerce |
1282
|
|
|
|
|
|
|
and (!defined $to_coerce |
1283
|
|
|
|
|
|
|
or $to_coerce eq q() |
1284
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1285
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1286
|
|
|
|
|
|
|
) |
1287
|
|
|
|
|
|
|
) ? $to_coerce |
1288
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1289
|
1
|
50
|
33
|
|
|
24
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1290
|
|
|
|
|
|
|
: $to_coerce; |
1291
|
|
|
|
|
|
|
}; |
1292
|
|
|
|
|
|
|
( |
1293
|
1
|
50
|
33
|
|
|
13
|
!ref $coerced_value |
|
|
|
33
|
|
|
|
|
1294
|
|
|
|
|
|
|
and (!defined $coerced_value |
1295
|
|
|
|
|
|
|
or $coerced_value eq q() |
1296
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1297
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1298
|
|
|
|
|
|
|
) |
1299
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1300
|
|
|
|
|
|
|
"allow_getter_shortcuts", "Bool"; |
1301
|
1
|
|
|
|
|
4
|
$self->{"allow_getter_shortcuts"} = $coerced_value; |
1302
|
|
|
|
|
|
|
}; |
1303
|
|
|
|
|
|
|
}; |
1304
|
|
|
|
|
|
|
|
1305
|
|
|
|
|
|
|
# Attribute prefer_shift_self (type: Bool) |
1306
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 79 |
1307
|
1
|
|
|
|
|
7
|
do { |
1308
|
|
|
|
|
|
|
my $value = |
1309
|
|
|
|
|
|
|
exists( $args->{"prefer_shift_self"} ) |
1310
|
1
|
50
|
|
|
|
6
|
? $args->{"prefer_shift_self"} |
1311
|
|
|
|
|
|
|
: false; |
1312
|
1
|
|
|
|
|
2
|
do { |
1313
|
1
|
|
|
|
|
2
|
my $coerced_value = do { |
1314
|
1
|
|
|
|
|
2
|
my $to_coerce = $value; |
1315
|
|
|
|
|
|
|
( |
1316
|
|
|
|
|
|
|
( |
1317
|
|
|
|
|
|
|
!ref $to_coerce |
1318
|
|
|
|
|
|
|
and (!defined $to_coerce |
1319
|
|
|
|
|
|
|
or $to_coerce eq q() |
1320
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1321
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1322
|
|
|
|
|
|
|
) |
1323
|
|
|
|
|
|
|
) ? $to_coerce |
1324
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1325
|
1
|
50
|
33
|
|
|
18
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1326
|
|
|
|
|
|
|
: $to_coerce; |
1327
|
|
|
|
|
|
|
}; |
1328
|
|
|
|
|
|
|
( |
1329
|
1
|
0
|
33
|
|
|
15
|
!ref $coerced_value |
|
|
|
33
|
|
|
|
|
1330
|
|
|
|
|
|
|
and (!defined $coerced_value |
1331
|
|
|
|
|
|
|
or $coerced_value eq q() |
1332
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1333
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1334
|
|
|
|
|
|
|
) |
1335
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1336
|
|
|
|
|
|
|
"prefer_shift_self", "Bool"; |
1337
|
1
|
|
|
|
|
4
|
$self->{"prefer_shift_self"} = $coerced_value; |
1338
|
|
|
|
|
|
|
}; |
1339
|
|
|
|
|
|
|
}; |
1340
|
|
|
|
|
|
|
|
1341
|
|
|
|
|
|
|
# Attribute additional_validation (type: CodeRef|Str|Undef) |
1342
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 86 |
1343
|
1
|
50
|
|
|
|
4
|
if ( exists $args->{"additional_validation"} ) { |
1344
|
0
|
0
|
|
|
|
0
|
do { |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1347
|
|
|
|
|
|
|
( |
1348
|
|
|
|
|
|
|
do { |
1349
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1351
|
0
|
|
|
|
|
0
|
ref( $args->{"additional_validation"} ) eq 'CODE'; |
1352
|
|
|
|
|
|
|
} |
1353
|
|
|
|
|
|
|
or do { |
1354
|
|
|
|
|
|
|
|
1355
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1356
|
0
|
0
|
|
|
|
0
|
defined( $args->{"additional_validation"} ) and do { |
1357
|
|
|
|
|
|
|
ref( \$args->{"additional_validation"} ) eq 'SCALAR' |
1358
|
|
|
|
|
|
|
or ref( |
1359
|
0
|
0
|
|
|
|
0
|
\( my $val = $args->{"additional_validation"} ) |
1360
|
|
|
|
|
|
|
) eq 'SCALAR'; |
1361
|
|
|
|
|
|
|
} |
1362
|
|
|
|
|
|
|
} |
1363
|
0
|
0
|
0
|
|
|
0
|
or do { |
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1366
|
0
|
|
|
|
|
0
|
!defined( $args->{"additional_validation"} ); |
1367
|
|
|
|
|
|
|
} |
1368
|
|
|
|
|
|
|
); |
1369
|
|
|
|
|
|
|
} |
1370
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1371
|
|
|
|
|
|
|
"additional_validation", "CodeRef|Str|Undef"; |
1372
|
0
|
|
|
|
|
0
|
$self->{"additional_validation"} = $args->{"additional_validation"}; |
1373
|
|
|
|
|
|
|
} |
1374
|
|
|
|
|
|
|
|
1375
|
|
|
|
|
|
|
# Attribute default_for_reset (type: CodeRef) |
1376
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 91 |
1377
|
1
|
50
|
|
|
|
3
|
if ( exists $args->{"default_for_reset"} ) { |
1378
|
0
|
0
|
|
|
|
0
|
do { |
1379
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1381
|
0
|
|
|
|
|
0
|
ref( $args->{"default_for_reset"} ) eq 'CODE'; |
1382
|
|
|
|
|
|
|
} |
1383
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1384
|
|
|
|
|
|
|
"default_for_reset", "CodeRef"; |
1385
|
0
|
|
|
|
|
0
|
$self->{"default_for_reset"} = $args->{"default_for_reset"}; |
1386
|
|
|
|
|
|
|
} |
1387
|
|
|
|
|
|
|
|
1388
|
|
|
|
|
|
|
# Attribute documentation (type: Str) |
1389
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 96 |
1390
|
1
|
50
|
|
|
|
2
|
if ( exists $args->{"documentation"} ) { |
1391
|
0
|
0
|
|
|
|
0
|
do { |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1394
|
0
|
0
|
|
|
|
0
|
defined( $args->{"documentation"} ) and do { |
1395
|
|
|
|
|
|
|
ref( \$args->{"documentation"} ) eq 'SCALAR' |
1396
|
0
|
0
|
|
|
|
0
|
or ref( \( my $val = $args->{"documentation"} ) ) eq |
1397
|
|
|
|
|
|
|
'SCALAR'; |
1398
|
|
|
|
|
|
|
} |
1399
|
|
|
|
|
|
|
} |
1400
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1401
|
|
|
|
|
|
|
"documentation", "Str"; |
1402
|
0
|
|
|
|
|
0
|
$self->{"documentation"} = $args->{"documentation"}; |
1403
|
|
|
|
|
|
|
} |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
# Attribute _examples (type: CodeRef) |
1406
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 101 |
1407
|
1
|
50
|
|
|
|
4
|
if ( exists $args->{"_examples"} ) { |
1408
|
0
|
0
|
|
|
|
0
|
do { |
1409
|
|
|
|
|
|
|
|
1410
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1411
|
0
|
|
|
|
|
0
|
ref( $args->{"_examples"} ) eq 'CODE'; |
1412
|
|
|
|
|
|
|
} |
1413
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1414
|
|
|
|
|
|
|
"_examples", "CodeRef"; |
1415
|
0
|
|
|
|
|
0
|
$self->{"_examples"} = $args->{"_examples"}; |
1416
|
|
|
|
|
|
|
} |
1417
|
|
|
|
|
|
|
|
1418
|
|
|
|
|
|
|
# Attribute name (type: Str) |
1419
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 282 |
1420
|
1
|
50
|
|
|
|
4
|
croak "Missing key in constructor: name" unless exists $args->{"name"}; |
1421
|
1
|
50
|
|
|
|
2
|
do { |
1422
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1424
|
1
|
50
|
|
|
|
3
|
defined( $args->{"name"} ) and do { |
1425
|
|
|
|
|
|
|
ref( \$args->{"name"} ) eq 'SCALAR' |
1426
|
1
|
50
|
|
|
|
7
|
or ref( \( my $val = $args->{"name"} ) ) eq 'SCALAR'; |
1427
|
|
|
|
|
|
|
} |
1428
|
|
|
|
|
|
|
} |
1429
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", "name", |
1430
|
|
|
|
|
|
|
"Str"; |
1431
|
1
|
|
|
|
|
4
|
$self->{"name"} = $args->{"name"}; |
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
# Call BUILD methods |
1434
|
1
|
50
|
33
|
|
|
18
|
$self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } ); |
|
1
|
50
|
|
|
|
14
|
|
1435
|
|
|
|
|
|
|
|
1436
|
|
|
|
|
|
|
# Unrecognized parameters |
1437
|
|
|
|
|
|
|
my @unknown = grep not( |
1438
|
|
|
|
|
|
|
/\A(?:_examples|a(?:dditional_validation|llow_getter_shortcuts|rgs)|curried|d(?:efault_for_reset|ocumentation)|is_(?:chainable|mutator)|lvalue_template|m(?:ax_args|in_args)|n(?:ame|o_validation_needed)|prefer_shift_self|signature|template|usage)\z/ |
1439
|
1
|
|
|
|
|
3
|
), keys %{$args}; |
|
1
|
|
|
|
|
11
|
|
1440
|
|
|
|
|
|
|
@unknown |
1441
|
1
|
50
|
|
|
|
4
|
and croak( |
1442
|
|
|
|
|
|
|
"Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
1443
|
|
|
|
|
|
|
|
1444
|
1
|
|
|
|
|
6
|
return $self; |
1445
|
|
|
|
|
|
|
} |
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} |
1448
|
|
|
|
|
|
|
&& eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
1449
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
# Accessors for name |
1451
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 282 |
1452
|
|
|
|
|
|
|
if ($__XS) { |
1453
|
|
|
|
|
|
|
Class::XSAccessor->import( |
1454
|
|
|
|
|
|
|
chained => 1, |
1455
|
|
|
|
|
|
|
"getters" => { "name" => "name" }, |
1456
|
|
|
|
|
|
|
); |
1457
|
|
|
|
|
|
|
} |
1458
|
|
|
|
|
|
|
else { |
1459
|
|
|
|
|
|
|
*name = sub { |
1460
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "name" usage: $self->name()'); |
1461
|
|
|
|
|
|
|
$_[0]{"name"}; |
1462
|
|
|
|
|
|
|
}; |
1463
|
|
|
|
|
|
|
} |
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
# See UNIVERSAL |
1466
|
|
|
|
|
|
|
sub DOES { |
1467
|
2304
|
|
|
2304
|
|
4422
|
my ( $self, $role ) = @_; |
1468
|
2304
|
|
|
|
|
3179
|
our %DOES; |
1469
|
2304
|
50
|
|
|
|
4705
|
return $DOES{$role} if exists $DOES{$role}; |
1470
|
2304
|
50
|
|
|
|
5681
|
return 1 if $role eq __PACKAGE__; |
1471
|
2304
|
50
|
33
|
|
|
5732
|
if ( $INC{'Moose/Util.pm'} |
|
|
|
66
|
|
|
|
|
1472
|
|
|
|
|
|
|
and my $meta = Moose::Util::find_meta( ref $self or $self ) ) |
1473
|
|
|
|
|
|
|
{ |
1474
|
0
|
0
|
0
|
|
|
0
|
$meta->can('does_role') and $meta->does_role($role) and return 1; |
1475
|
|
|
|
|
|
|
} |
1476
|
2304
|
|
|
|
|
8312
|
return $self->SUPER::DOES($role); |
1477
|
|
|
|
|
|
|
} |
1478
|
|
|
|
|
|
|
|
1479
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
1480
|
|
|
|
|
|
|
sub does { |
1481
|
2304
|
|
|
2304
|
|
170515
|
shift->DOES(@_); |
1482
|
|
|
|
|
|
|
} |
1483
|
|
|
|
|
|
|
|
1484
|
|
|
|
|
|
|
1; |
1485
|
|
|
|
|
|
|
} |
1486
|
|
|
|
|
|
|
{ |
1487
|
|
|
|
|
|
|
|
1488
|
|
|
|
|
|
|
package Sub::HandlesVia::Handler::CodeRef; |
1489
|
96
|
|
|
96
|
|
880
|
use strict; |
|
96
|
|
|
|
|
1198
|
|
|
96
|
|
|
|
|
2715
|
|
1490
|
96
|
|
|
96
|
|
577
|
use warnings; |
|
96
|
|
|
|
|
325
|
|
|
96
|
|
|
|
|
3389
|
|
1491
|
96
|
|
|
96
|
|
670
|
no warnings qw( once void ); |
|
96
|
|
|
|
|
296
|
|
|
96
|
|
|
|
|
13257
|
|
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
1494
|
|
|
|
|
|
|
our $MITE_SHIM = "Sub::HandlesVia::Mite"; |
1495
|
|
|
|
|
|
|
our $MITE_VERSION = "0.012000"; |
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
# Mite keywords |
1498
|
|
|
|
|
|
|
BEGIN { |
1499
|
96
|
|
|
96
|
|
622
|
my ( $SHIM, $CALLER ) = |
1500
|
|
|
|
|
|
|
( "Sub::HandlesVia::Mite", "Sub::HandlesVia::Handler::CodeRef" ); |
1501
|
|
|
|
|
|
|
( |
1502
|
|
|
|
|
|
|
*after, *around, *before, *extends, *field, |
1503
|
|
|
|
|
|
|
*has, *param, *signature_for, *with |
1504
|
|
|
|
|
|
|
) |
1505
|
96
|
|
|
|
|
272
|
= do { |
1506
|
|
|
|
|
|
|
|
1507
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1508
|
96
|
|
|
96
|
|
784
|
no warnings 'redefine'; |
|
96
|
|
|
|
|
249
|
|
|
96
|
|
|
|
|
23261
|
|
1509
|
|
|
|
|
|
|
( |
1510
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
1511
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
1512
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
1513
|
|
|
|
|
|
|
sub { }, |
1514
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) }, |
1515
|
96
|
|
|
|
|
861
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
1516
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
1517
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
1518
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
1519
|
96
|
|
|
|
|
19067
|
); |
1520
|
|
|
|
|
|
|
}; |
1521
|
|
|
|
|
|
|
} |
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
# Mite imports |
1524
|
|
|
|
|
|
|
BEGIN { |
1525
|
96
|
|
|
96
|
|
734
|
require Scalar::Util; |
1526
|
96
|
|
|
|
|
440
|
*STRICT = \&Sub::HandlesVia::Mite::STRICT; |
1527
|
96
|
|
|
|
|
260
|
*bare = \&Sub::HandlesVia::Mite::bare; |
1528
|
96
|
|
|
|
|
258
|
*blessed = \&Scalar::Util::blessed; |
1529
|
96
|
|
|
|
|
307
|
*carp = \&Sub::HandlesVia::Mite::carp; |
1530
|
96
|
|
|
|
|
276
|
*confess = \&Sub::HandlesVia::Mite::confess; |
1531
|
96
|
|
|
|
|
273
|
*croak = \&Sub::HandlesVia::Mite::croak; |
1532
|
96
|
|
|
|
|
247
|
*false = \&Sub::HandlesVia::Mite::false; |
1533
|
96
|
|
|
|
|
250
|
*guard = \&Sub::HandlesVia::Mite::guard; |
1534
|
96
|
|
|
|
|
226
|
*lazy = \&Sub::HandlesVia::Mite::lazy; |
1535
|
96
|
|
|
|
|
295
|
*lock = \&Sub::HandlesVia::Mite::lock; |
1536
|
96
|
|
|
|
|
247
|
*ro = \&Sub::HandlesVia::Mite::ro; |
1537
|
96
|
|
|
|
|
315
|
*rw = \&Sub::HandlesVia::Mite::rw; |
1538
|
96
|
|
|
|
|
222
|
*rwp = \&Sub::HandlesVia::Mite::rwp; |
1539
|
96
|
|
|
|
|
230
|
*true = \&Sub::HandlesVia::Mite::true; |
1540
|
96
|
|
|
|
|
3727
|
*unlock = \&Sub::HandlesVia::Mite::unlock; |
1541
|
|
|
|
|
|
|
} |
1542
|
|
|
|
|
|
|
|
1543
|
|
|
|
|
|
|
BEGIN { |
1544
|
|
|
|
|
|
|
|
1545
|
96
|
|
|
96
|
|
660
|
use mro 'c3'; |
|
96
|
|
|
|
|
2817
|
|
|
96
|
|
|
|
|
2100
|
|
1546
|
96
|
|
|
96
|
|
4474
|
our @ISA; |
1547
|
96
|
|
|
|
|
219717
|
push @ISA, "Sub::HandlesVia::Handler"; |
1548
|
|
|
|
|
|
|
} |
1549
|
|
|
|
|
|
|
|
1550
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
1551
|
|
|
|
|
|
|
sub new { |
1552
|
2
|
50
|
|
2
|
|
8
|
my $class = ref( $_[0] ) ? ref(shift) : shift; |
1553
|
2
|
|
66
|
|
|
13
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
1554
|
2
|
|
|
|
|
6
|
my $self = bless {}, $class; |
1555
|
|
|
|
|
|
|
my $args = |
1556
|
|
|
|
|
|
|
$meta->{HAS_BUILDARGS} |
1557
|
|
|
|
|
|
|
? $class->BUILDARGS(@_) |
1558
|
2
|
50
|
|
|
|
26
|
: { ( @_ == 1 ) ? %{ $_[0] } : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
1559
|
2
|
|
|
|
|
5
|
my $no_build = delete $args->{__no_BUILD__}; |
1560
|
|
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
# Attribute name (type: Str) |
1562
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 12 |
1563
|
2
|
50
|
|
|
|
7
|
if ( exists $args->{"name"} ) { |
1564
|
2
|
50
|
|
|
|
4
|
do { |
1565
|
|
|
|
|
|
|
|
1566
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1567
|
2
|
50
|
|
|
|
7
|
defined( $args->{"name"} ) and do { |
1568
|
|
|
|
|
|
|
ref( \$args->{"name"} ) eq 'SCALAR' |
1569
|
2
|
50
|
|
|
|
13
|
or ref( \( my $val = $args->{"name"} ) ) eq 'SCALAR'; |
1570
|
|
|
|
|
|
|
} |
1571
|
|
|
|
|
|
|
} |
1572
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1573
|
|
|
|
|
|
|
"name", "Str"; |
1574
|
2
|
|
|
|
|
9
|
$self->{"name"} = $args->{"name"}; |
1575
|
|
|
|
|
|
|
} |
1576
|
|
|
|
|
|
|
|
1577
|
|
|
|
|
|
|
# Attribute template (type: Str) |
1578
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 17 |
1579
|
2
|
50
|
|
|
|
8
|
if ( exists $args->{"template"} ) { |
1580
|
0
|
0
|
|
|
|
0
|
do { |
1581
|
|
|
|
|
|
|
|
1582
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1583
|
0
|
0
|
|
|
|
0
|
defined( $args->{"template"} ) and do { |
1584
|
|
|
|
|
|
|
ref( \$args->{"template"} ) eq 'SCALAR' |
1585
|
0
|
0
|
|
|
|
0
|
or ref( \( my $val = $args->{"template"} ) ) eq 'SCALAR'; |
1586
|
|
|
|
|
|
|
} |
1587
|
|
|
|
|
|
|
} |
1588
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1589
|
|
|
|
|
|
|
"template", "Str"; |
1590
|
0
|
|
|
|
|
0
|
$self->{"template"} = $args->{"template"}; |
1591
|
|
|
|
|
|
|
} |
1592
|
|
|
|
|
|
|
|
1593
|
|
|
|
|
|
|
# Attribute lvalue_template (type: Str) |
1594
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 22 |
1595
|
2
|
50
|
|
|
|
16
|
if ( exists $args->{"lvalue_template"} ) { |
1596
|
0
|
0
|
|
|
|
0
|
do { |
1597
|
|
|
|
|
|
|
|
1598
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1599
|
0
|
0
|
|
|
|
0
|
defined( $args->{"lvalue_template"} ) and do { |
1600
|
|
|
|
|
|
|
ref( \$args->{"lvalue_template"} ) eq 'SCALAR' |
1601
|
0
|
0
|
|
|
|
0
|
or ref( \( my $val = $args->{"lvalue_template"} ) ) eq |
1602
|
|
|
|
|
|
|
'SCALAR'; |
1603
|
|
|
|
|
|
|
} |
1604
|
|
|
|
|
|
|
} |
1605
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1606
|
|
|
|
|
|
|
"lvalue_template", "Str"; |
1607
|
0
|
|
|
|
|
0
|
$self->{"lvalue_template"} = $args->{"lvalue_template"}; |
1608
|
|
|
|
|
|
|
} |
1609
|
|
|
|
|
|
|
|
1610
|
|
|
|
|
|
|
# Attribute args (type: Int|Undef) |
1611
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 27 |
1612
|
2
|
|
|
|
|
4
|
do { |
1613
|
2
|
100
|
|
|
|
6
|
my $value = exists( $args->{"args"} ) ? $args->{"args"} : undef; |
1614
|
2
|
50
|
|
|
|
4
|
do { |
1615
|
|
|
|
|
|
|
|
1616
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1617
|
|
|
|
|
|
|
( |
1618
|
|
|
|
|
|
|
( |
1619
|
2
|
50
|
|
|
|
2
|
do { |
1620
|
2
|
|
|
|
|
4
|
my $tmp = $value; |
1621
|
2
|
50
|
33
|
|
|
15
|
defined($tmp) |
1622
|
|
|
|
|
|
|
and !ref($tmp) |
1623
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
1624
|
|
|
|
|
|
|
} |
1625
|
|
|
|
|
|
|
) |
1626
|
|
|
|
|
|
|
or ( !defined($value) ) |
1627
|
|
|
|
|
|
|
); |
1628
|
|
|
|
|
|
|
} |
1629
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1630
|
|
|
|
|
|
|
"args", "Int|Undef"; |
1631
|
2
|
|
|
|
|
5
|
$self->{"args"} = $value; |
1632
|
|
|
|
|
|
|
}; |
1633
|
|
|
|
|
|
|
|
1634
|
|
|
|
|
|
|
# Attribute min_args (type: Int|Undef) |
1635
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37 |
1636
|
2
|
100
|
|
|
|
7
|
if ( exists $args->{"min_args"} ) { |
1637
|
1
|
50
|
|
|
|
2
|
do { |
1638
|
|
|
|
|
|
|
|
1639
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1640
|
|
|
|
|
|
|
( |
1641
|
|
|
|
|
|
|
( |
1642
|
|
|
|
|
|
|
do { |
1643
|
1
|
|
|
|
|
3
|
my $tmp = $args->{"min_args"}; |
1644
|
1
|
50
|
33
|
|
|
7
|
defined($tmp) |
1645
|
|
|
|
|
|
|
and !ref($tmp) |
1646
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
1647
|
|
|
|
|
|
|
} |
1648
|
|
|
|
|
|
|
) |
1649
|
1
|
50
|
|
|
|
1
|
or do { |
1650
|
|
|
|
|
|
|
|
1651
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1652
|
1
|
|
|
|
|
19
|
!defined( $args->{"min_args"} ); |
1653
|
|
|
|
|
|
|
} |
1654
|
|
|
|
|
|
|
); |
1655
|
|
|
|
|
|
|
} |
1656
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1657
|
|
|
|
|
|
|
"min_args", "Int|Undef"; |
1658
|
1
|
|
|
|
|
4
|
$self->{"min_args"} = $args->{"min_args"}; |
1659
|
|
|
|
|
|
|
} |
1660
|
|
|
|
|
|
|
|
1661
|
|
|
|
|
|
|
# Attribute max_args (type: Int|Undef) |
1662
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37 |
1663
|
2
|
100
|
|
|
|
6
|
if ( exists $args->{"max_args"} ) { |
1664
|
1
|
50
|
|
|
|
2
|
do { |
1665
|
|
|
|
|
|
|
|
1666
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1667
|
|
|
|
|
|
|
( |
1668
|
|
|
|
|
|
|
( |
1669
|
|
|
|
|
|
|
do { |
1670
|
1
|
|
|
|
|
3
|
my $tmp = $args->{"max_args"}; |
1671
|
1
|
50
|
33
|
|
|
6
|
defined($tmp) |
1672
|
|
|
|
|
|
|
and !ref($tmp) |
1673
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
1674
|
|
|
|
|
|
|
} |
1675
|
|
|
|
|
|
|
) |
1676
|
1
|
50
|
|
|
|
2
|
or do { |
1677
|
|
|
|
|
|
|
|
1678
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1679
|
1
|
|
|
|
|
7
|
!defined( $args->{"max_args"} ); |
1680
|
|
|
|
|
|
|
} |
1681
|
|
|
|
|
|
|
); |
1682
|
|
|
|
|
|
|
} |
1683
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1684
|
|
|
|
|
|
|
"max_args", "Int|Undef"; |
1685
|
1
|
|
|
|
|
2
|
$self->{"max_args"} = $args->{"max_args"}; |
1686
|
|
|
|
|
|
|
} |
1687
|
|
|
|
|
|
|
|
1688
|
|
|
|
|
|
|
# Attribute signature (type: ArrayRef|Undef) |
1689
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 43 |
1690
|
2
|
100
|
|
|
|
6
|
if ( exists $args->{"signature"} ) { |
1691
|
1
|
50
|
|
|
|
2
|
do { |
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1694
|
|
|
|
|
|
|
( |
1695
|
|
|
|
|
|
|
do { |
1696
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1698
|
1
|
|
|
|
|
4
|
ref( $args->{"signature"} ) eq 'ARRAY'; |
1699
|
|
|
|
|
|
|
} |
1700
|
1
|
50
|
|
|
|
2
|
or do { |
1701
|
|
|
|
|
|
|
|
1702
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1703
|
1
|
|
|
|
|
13
|
!defined( $args->{"signature"} ); |
1704
|
|
|
|
|
|
|
} |
1705
|
|
|
|
|
|
|
); |
1706
|
|
|
|
|
|
|
} |
1707
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1708
|
|
|
|
|
|
|
"signature", "ArrayRef|Undef"; |
1709
|
1
|
|
|
|
|
4
|
$self->{"signature"} = $args->{"signature"}; |
1710
|
|
|
|
|
|
|
} |
1711
|
|
|
|
|
|
|
|
1712
|
|
|
|
|
|
|
# Attribute usage (type: Str) |
1713
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 48 |
1714
|
2
|
50
|
|
|
|
5
|
if ( exists $args->{"usage"} ) { |
1715
|
0
|
0
|
|
|
|
0
|
do { |
1716
|
|
|
|
|
|
|
|
1717
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1718
|
0
|
0
|
|
|
|
0
|
defined( $args->{"usage"} ) and do { |
1719
|
|
|
|
|
|
|
ref( \$args->{"usage"} ) eq 'SCALAR' |
1720
|
0
|
0
|
|
|
|
0
|
or ref( \( my $val = $args->{"usage"} ) ) eq 'SCALAR'; |
1721
|
|
|
|
|
|
|
} |
1722
|
|
|
|
|
|
|
} |
1723
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1724
|
|
|
|
|
|
|
"usage", "Str"; |
1725
|
0
|
|
|
|
|
0
|
$self->{"usage"} = $args->{"usage"}; |
1726
|
|
|
|
|
|
|
} |
1727
|
|
|
|
|
|
|
|
1728
|
|
|
|
|
|
|
# Attribute curried (type: ArrayRef) |
1729
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 54 |
1730
|
2
|
100
|
|
|
|
6
|
if ( exists $args->{"curried"} ) { |
1731
|
1
|
50
|
|
|
|
2
|
do { |
1732
|
|
|
|
|
|
|
|
1733
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1734
|
1
|
|
|
|
|
4
|
ref( $args->{"curried"} ) eq 'ARRAY'; |
1735
|
|
|
|
|
|
|
} |
1736
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1737
|
|
|
|
|
|
|
"curried", "ArrayRef"; |
1738
|
1
|
|
|
|
|
3
|
$self->{"curried"} = $args->{"curried"}; |
1739
|
|
|
|
|
|
|
} |
1740
|
|
|
|
|
|
|
|
1741
|
|
|
|
|
|
|
# Attribute is_chainable (type: Bool) |
1742
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59 |
1743
|
2
|
50
|
|
|
|
13
|
if ( exists $args->{"is_chainable"} ) { |
1744
|
0
|
|
|
|
|
0
|
do { |
1745
|
0
|
|
|
|
|
0
|
my $coerced_value = do { |
1746
|
0
|
|
|
|
|
0
|
my $to_coerce = $args->{"is_chainable"}; |
1747
|
|
|
|
|
|
|
( |
1748
|
|
|
|
|
|
|
( |
1749
|
|
|
|
|
|
|
!ref $to_coerce |
1750
|
|
|
|
|
|
|
and (!defined $to_coerce |
1751
|
|
|
|
|
|
|
or $to_coerce eq q() |
1752
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1753
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1754
|
|
|
|
|
|
|
) |
1755
|
|
|
|
|
|
|
) ? $to_coerce |
1756
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1757
|
0
|
0
|
0
|
|
|
0
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1758
|
|
|
|
|
|
|
: $to_coerce; |
1759
|
|
|
|
|
|
|
}; |
1760
|
|
|
|
|
|
|
( |
1761
|
0
|
0
|
0
|
|
|
0
|
!ref $coerced_value |
|
|
|
0
|
|
|
|
|
1762
|
|
|
|
|
|
|
and (!defined $coerced_value |
1763
|
|
|
|
|
|
|
or $coerced_value eq q() |
1764
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1765
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1766
|
|
|
|
|
|
|
) |
1767
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1768
|
|
|
|
|
|
|
"is_chainable", "Bool"; |
1769
|
0
|
|
|
|
|
0
|
$self->{"is_chainable"} = $coerced_value; |
1770
|
|
|
|
|
|
|
}; |
1771
|
|
|
|
|
|
|
} |
1772
|
|
|
|
|
|
|
|
1773
|
|
|
|
|
|
|
# Attribute no_validation_needed (type: Bool) |
1774
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59 |
1775
|
2
|
50
|
|
|
|
7
|
if ( exists $args->{"no_validation_needed"} ) { |
1776
|
0
|
|
|
|
|
0
|
do { |
1777
|
0
|
|
|
|
|
0
|
my $coerced_value = do { |
1778
|
0
|
|
|
|
|
0
|
my $to_coerce = $args->{"no_validation_needed"}; |
1779
|
|
|
|
|
|
|
( |
1780
|
|
|
|
|
|
|
( |
1781
|
|
|
|
|
|
|
!ref $to_coerce |
1782
|
|
|
|
|
|
|
and (!defined $to_coerce |
1783
|
|
|
|
|
|
|
or $to_coerce eq q() |
1784
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1785
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1786
|
|
|
|
|
|
|
) |
1787
|
|
|
|
|
|
|
) ? $to_coerce |
1788
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1789
|
0
|
0
|
0
|
|
|
0
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1790
|
|
|
|
|
|
|
: $to_coerce; |
1791
|
|
|
|
|
|
|
}; |
1792
|
|
|
|
|
|
|
( |
1793
|
0
|
0
|
0
|
|
|
0
|
!ref $coerced_value |
|
|
|
0
|
|
|
|
|
1794
|
|
|
|
|
|
|
and (!defined $coerced_value |
1795
|
|
|
|
|
|
|
or $coerced_value eq q() |
1796
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1797
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1798
|
|
|
|
|
|
|
) |
1799
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1800
|
|
|
|
|
|
|
"no_validation_needed", "Bool"; |
1801
|
0
|
|
|
|
|
0
|
$self->{"no_validation_needed"} = $coerced_value; |
1802
|
|
|
|
|
|
|
}; |
1803
|
|
|
|
|
|
|
} |
1804
|
|
|
|
|
|
|
|
1805
|
|
|
|
|
|
|
# Attribute is_mutator (type: Bool) |
1806
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 70 |
1807
|
2
|
50
|
|
|
|
14
|
if ( exists $args->{"is_mutator"} ) { |
1808
|
0
|
|
|
|
|
0
|
do { |
1809
|
0
|
|
|
|
|
0
|
my $coerced_value = do { |
1810
|
0
|
|
|
|
|
0
|
my $to_coerce = $args->{"is_mutator"}; |
1811
|
|
|
|
|
|
|
( |
1812
|
|
|
|
|
|
|
( |
1813
|
|
|
|
|
|
|
!ref $to_coerce |
1814
|
|
|
|
|
|
|
and (!defined $to_coerce |
1815
|
|
|
|
|
|
|
or $to_coerce eq q() |
1816
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1817
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1818
|
|
|
|
|
|
|
) |
1819
|
|
|
|
|
|
|
) ? $to_coerce |
1820
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1821
|
0
|
0
|
0
|
|
|
0
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1822
|
|
|
|
|
|
|
: $to_coerce; |
1823
|
|
|
|
|
|
|
}; |
1824
|
|
|
|
|
|
|
( |
1825
|
0
|
0
|
0
|
|
|
0
|
!ref $coerced_value |
|
|
|
0
|
|
|
|
|
1826
|
|
|
|
|
|
|
and (!defined $coerced_value |
1827
|
|
|
|
|
|
|
or $coerced_value eq q() |
1828
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1829
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1830
|
|
|
|
|
|
|
) |
1831
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1832
|
|
|
|
|
|
|
"is_mutator", "Bool"; |
1833
|
0
|
|
|
|
|
0
|
$self->{"is_mutator"} = $coerced_value; |
1834
|
|
|
|
|
|
|
}; |
1835
|
|
|
|
|
|
|
} |
1836
|
|
|
|
|
|
|
|
1837
|
|
|
|
|
|
|
# Attribute allow_getter_shortcuts (type: Bool) |
1838
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 72 |
1839
|
2
|
|
|
|
|
4
|
do { |
1840
|
|
|
|
|
|
|
my $value = |
1841
|
|
|
|
|
|
|
exists( $args->{"allow_getter_shortcuts"} ) |
1842
|
2
|
100
|
|
|
|
6
|
? $args->{"allow_getter_shortcuts"} |
1843
|
|
|
|
|
|
|
: true; |
1844
|
2
|
|
|
|
|
4
|
do { |
1845
|
2
|
|
|
|
|
3
|
my $coerced_value = do { |
1846
|
2
|
|
|
|
|
5
|
my $to_coerce = $value; |
1847
|
|
|
|
|
|
|
( |
1848
|
|
|
|
|
|
|
( |
1849
|
|
|
|
|
|
|
!ref $to_coerce |
1850
|
|
|
|
|
|
|
and (!defined $to_coerce |
1851
|
|
|
|
|
|
|
or $to_coerce eq q() |
1852
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1853
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1854
|
|
|
|
|
|
|
) |
1855
|
|
|
|
|
|
|
) ? $to_coerce |
1856
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1857
|
2
|
50
|
33
|
|
|
21
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1858
|
|
|
|
|
|
|
: $to_coerce; |
1859
|
|
|
|
|
|
|
}; |
1860
|
|
|
|
|
|
|
( |
1861
|
2
|
50
|
33
|
|
|
26
|
!ref $coerced_value |
|
|
|
33
|
|
|
|
|
1862
|
|
|
|
|
|
|
and (!defined $coerced_value |
1863
|
|
|
|
|
|
|
or $coerced_value eq q() |
1864
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1865
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1866
|
|
|
|
|
|
|
) |
1867
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1868
|
|
|
|
|
|
|
"allow_getter_shortcuts", "Bool"; |
1869
|
2
|
|
|
|
|
6
|
$self->{"allow_getter_shortcuts"} = $coerced_value; |
1870
|
|
|
|
|
|
|
}; |
1871
|
|
|
|
|
|
|
}; |
1872
|
|
|
|
|
|
|
|
1873
|
|
|
|
|
|
|
# Attribute prefer_shift_self (type: Bool) |
1874
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 79 |
1875
|
2
|
|
|
|
|
3
|
do { |
1876
|
|
|
|
|
|
|
my $value = |
1877
|
|
|
|
|
|
|
exists( $args->{"prefer_shift_self"} ) |
1878
|
2
|
100
|
|
|
|
7
|
? $args->{"prefer_shift_self"} |
1879
|
|
|
|
|
|
|
: false; |
1880
|
2
|
|
|
|
|
4
|
do { |
1881
|
2
|
|
|
|
|
3
|
my $coerced_value = do { |
1882
|
2
|
|
|
|
|
2
|
my $to_coerce = $value; |
1883
|
|
|
|
|
|
|
( |
1884
|
|
|
|
|
|
|
( |
1885
|
|
|
|
|
|
|
!ref $to_coerce |
1886
|
|
|
|
|
|
|
and (!defined $to_coerce |
1887
|
|
|
|
|
|
|
or $to_coerce eq q() |
1888
|
|
|
|
|
|
|
or $to_coerce eq '0' |
1889
|
|
|
|
|
|
|
or $to_coerce eq '1' ) |
1890
|
|
|
|
|
|
|
) |
1891
|
|
|
|
|
|
|
) ? $to_coerce |
1892
|
|
|
|
|
|
|
: ( ( !!1 ) ) |
1893
|
2
|
50
|
33
|
|
|
25
|
? scalar( do { local $_ = $to_coerce; !!$_ } ) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
1894
|
|
|
|
|
|
|
: $to_coerce; |
1895
|
|
|
|
|
|
|
}; |
1896
|
|
|
|
|
|
|
( |
1897
|
2
|
0
|
33
|
|
|
13
|
!ref $coerced_value |
|
|
|
33
|
|
|
|
|
1898
|
|
|
|
|
|
|
and (!defined $coerced_value |
1899
|
|
|
|
|
|
|
or $coerced_value eq q() |
1900
|
|
|
|
|
|
|
or $coerced_value eq '0' |
1901
|
|
|
|
|
|
|
or $coerced_value eq '1' ) |
1902
|
|
|
|
|
|
|
) |
1903
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1904
|
|
|
|
|
|
|
"prefer_shift_self", "Bool"; |
1905
|
2
|
|
|
|
|
6
|
$self->{"prefer_shift_self"} = $coerced_value; |
1906
|
|
|
|
|
|
|
}; |
1907
|
|
|
|
|
|
|
}; |
1908
|
|
|
|
|
|
|
|
1909
|
|
|
|
|
|
|
# Attribute additional_validation (type: CodeRef|Str|Undef) |
1910
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 86 |
1911
|
2
|
50
|
|
|
|
6
|
if ( exists $args->{"additional_validation"} ) { |
1912
|
0
|
0
|
|
|
|
0
|
do { |
1913
|
|
|
|
|
|
|
|
1914
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1915
|
|
|
|
|
|
|
( |
1916
|
|
|
|
|
|
|
do { |
1917
|
|
|
|
|
|
|
|
1918
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1919
|
0
|
|
|
|
|
0
|
ref( $args->{"additional_validation"} ) eq 'CODE'; |
1920
|
|
|
|
|
|
|
} |
1921
|
|
|
|
|
|
|
or do { |
1922
|
|
|
|
|
|
|
|
1923
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1924
|
0
|
0
|
|
|
|
0
|
defined( $args->{"additional_validation"} ) and do { |
1925
|
|
|
|
|
|
|
ref( \$args->{"additional_validation"} ) eq 'SCALAR' |
1926
|
|
|
|
|
|
|
or ref( |
1927
|
0
|
0
|
|
|
|
0
|
\( my $val = $args->{"additional_validation"} ) |
1928
|
|
|
|
|
|
|
) eq 'SCALAR'; |
1929
|
|
|
|
|
|
|
} |
1930
|
|
|
|
|
|
|
} |
1931
|
0
|
0
|
0
|
|
|
0
|
or do { |
1932
|
|
|
|
|
|
|
|
1933
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1934
|
0
|
|
|
|
|
0
|
!defined( $args->{"additional_validation"} ); |
1935
|
|
|
|
|
|
|
} |
1936
|
|
|
|
|
|
|
); |
1937
|
|
|
|
|
|
|
} |
1938
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1939
|
|
|
|
|
|
|
"additional_validation", "CodeRef|Str|Undef"; |
1940
|
0
|
|
|
|
|
0
|
$self->{"additional_validation"} = $args->{"additional_validation"}; |
1941
|
|
|
|
|
|
|
} |
1942
|
|
|
|
|
|
|
|
1943
|
|
|
|
|
|
|
# Attribute default_for_reset (type: CodeRef) |
1944
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 91 |
1945
|
2
|
50
|
|
|
|
5
|
if ( exists $args->{"default_for_reset"} ) { |
1946
|
0
|
0
|
|
|
|
0
|
do { |
1947
|
|
|
|
|
|
|
|
1948
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1949
|
0
|
|
|
|
|
0
|
ref( $args->{"default_for_reset"} ) eq 'CODE'; |
1950
|
|
|
|
|
|
|
} |
1951
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1952
|
|
|
|
|
|
|
"default_for_reset", "CodeRef"; |
1953
|
0
|
|
|
|
|
0
|
$self->{"default_for_reset"} = $args->{"default_for_reset"}; |
1954
|
|
|
|
|
|
|
} |
1955
|
|
|
|
|
|
|
|
1956
|
|
|
|
|
|
|
# Attribute documentation (type: Str) |
1957
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 96 |
1958
|
2
|
50
|
|
|
|
6
|
if ( exists $args->{"documentation"} ) { |
1959
|
0
|
0
|
|
|
|
0
|
do { |
1960
|
|
|
|
|
|
|
|
1961
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1962
|
0
|
0
|
|
|
|
0
|
defined( $args->{"documentation"} ) and do { |
1963
|
|
|
|
|
|
|
ref( \$args->{"documentation"} ) eq 'SCALAR' |
1964
|
0
|
0
|
|
|
|
0
|
or ref( \( my $val = $args->{"documentation"} ) ) eq |
1965
|
|
|
|
|
|
|
'SCALAR'; |
1966
|
|
|
|
|
|
|
} |
1967
|
|
|
|
|
|
|
} |
1968
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1969
|
|
|
|
|
|
|
"documentation", "Str"; |
1970
|
0
|
|
|
|
|
0
|
$self->{"documentation"} = $args->{"documentation"}; |
1971
|
|
|
|
|
|
|
} |
1972
|
|
|
|
|
|
|
|
1973
|
|
|
|
|
|
|
# Attribute _examples (type: CodeRef) |
1974
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 101 |
1975
|
2
|
50
|
|
|
|
6
|
if ( exists $args->{"_examples"} ) { |
1976
|
0
|
0
|
|
|
|
0
|
do { |
1977
|
|
|
|
|
|
|
|
1978
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1979
|
0
|
|
|
|
|
0
|
ref( $args->{"_examples"} ) eq 'CODE'; |
1980
|
|
|
|
|
|
|
} |
1981
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1982
|
|
|
|
|
|
|
"_examples", "CodeRef"; |
1983
|
0
|
|
|
|
|
0
|
$self->{"_examples"} = $args->{"_examples"}; |
1984
|
|
|
|
|
|
|
} |
1985
|
|
|
|
|
|
|
|
1986
|
|
|
|
|
|
|
# Attribute delegated_coderef (type: CodeRef) |
1987
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 303 |
1988
|
|
|
|
|
|
|
croak "Missing key in constructor: delegated_coderef" |
1989
|
2
|
50
|
|
|
|
12
|
unless exists $args->{"delegated_coderef"}; |
1990
|
2
|
50
|
|
|
|
4
|
do { |
1991
|
|
|
|
|
|
|
|
1992
|
|
|
|
|
|
|
package Sub::HandlesVia::Mite; |
1993
|
2
|
|
|
|
|
8
|
ref( $args->{"delegated_coderef"} ) eq 'CODE'; |
1994
|
|
|
|
|
|
|
} |
1995
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
1996
|
|
|
|
|
|
|
"delegated_coderef", "CodeRef"; |
1997
|
2
|
|
|
|
|
5
|
$self->{"delegated_coderef"} = $args->{"delegated_coderef"}; |
1998
|
|
|
|
|
|
|
|
1999
|
|
|
|
|
|
|
# Call BUILD methods |
2000
|
2
|
50
|
33
|
|
|
17
|
$self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } ); |
|
2
|
50
|
|
|
|
19
|
|
2001
|
|
|
|
|
|
|
|
2002
|
|
|
|
|
|
|
# Unrecognized parameters |
2003
|
|
|
|
|
|
|
my @unknown = grep not( |
2004
|
|
|
|
|
|
|
/\A(?:_examples|a(?:dditional_validation|llow_getter_shortcuts|rgs)|curried|d(?:e(?:fault_for_reset|legated_coderef)|ocumentation)|is_(?:chainable|mutator)|lvalue_template|m(?:ax_args|in_args)|n(?:ame|o_validation_needed)|prefer_shift_self|signature|template|usage)\z/ |
2005
|
2
|
|
|
|
|
5
|
), keys %{$args}; |
|
2
|
|
|
|
|
38
|
|
2006
|
|
|
|
|
|
|
@unknown |
2007
|
2
|
50
|
|
|
|
8
|
and croak( |
2008
|
|
|
|
|
|
|
"Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
2009
|
|
|
|
|
|
|
|
2010
|
2
|
|
|
|
|
14
|
return $self; |
2011
|
|
|
|
|
|
|
} |
2012
|
|
|
|
|
|
|
|
2013
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} |
2014
|
|
|
|
|
|
|
&& eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
2015
|
|
|
|
|
|
|
|
2016
|
|
|
|
|
|
|
# Accessors for delegated_coderef |
2017
|
|
|
|
|
|
|
# has declaration, file lib/Sub/HandlesVia/Handler.pm, line 303 |
2018
|
|
|
|
|
|
|
if ($__XS) { |
2019
|
|
|
|
|
|
|
Class::XSAccessor->import( |
2020
|
|
|
|
|
|
|
chained => 1, |
2021
|
|
|
|
|
|
|
"getters" => { "delegated_coderef" => "delegated_coderef" }, |
2022
|
|
|
|
|
|
|
); |
2023
|
|
|
|
|
|
|
} |
2024
|
|
|
|
|
|
|
else { |
2025
|
|
|
|
|
|
|
*delegated_coderef = sub { |
2026
|
|
|
|
|
|
|
@_ == 1 |
2027
|
|
|
|
|
|
|
or croak( |
2028
|
|
|
|
|
|
|
'Reader "delegated_coderef" usage: $self->delegated_coderef()'); |
2029
|
|
|
|
|
|
|
$_[0]{"delegated_coderef"}; |
2030
|
|
|
|
|
|
|
}; |
2031
|
|
|
|
|
|
|
} |
2032
|
|
|
|
|
|
|
|
2033
|
|
|
|
|
|
|
# See UNIVERSAL |
2034
|
|
|
|
|
|
|
sub DOES { |
2035
|
2304
|
|
|
2304
|
|
4654
|
my ( $self, $role ) = @_; |
2036
|
2304
|
|
|
|
|
3131
|
our %DOES; |
2037
|
2304
|
50
|
|
|
|
4669
|
return $DOES{$role} if exists $DOES{$role}; |
2038
|
2304
|
50
|
|
|
|
4199
|
return 1 if $role eq __PACKAGE__; |
2039
|
2304
|
50
|
33
|
|
|
5686
|
if ( $INC{'Moose/Util.pm'} |
|
|
|
66
|
|
|
|
|
2040
|
|
|
|
|
|
|
and my $meta = Moose::Util::find_meta( ref $self or $self ) ) |
2041
|
|
|
|
|
|
|
{ |
2042
|
0
|
0
|
0
|
|
|
0
|
$meta->can('does_role') and $meta->does_role($role) and return 1; |
2043
|
|
|
|
|
|
|
} |
2044
|
2304
|
|
|
|
|
8414
|
return $self->SUPER::DOES($role); |
2045
|
|
|
|
|
|
|
} |
2046
|
|
|
|
|
|
|
|
2047
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
2048
|
|
|
|
|
|
|
sub does { |
2049
|
2304
|
|
|
2304
|
|
166469
|
shift->DOES(@_); |
2050
|
|
|
|
|
|
|
} |
2051
|
|
|
|
|
|
|
|
2052
|
|
|
|
|
|
|
1; |
2053
|
|
|
|
|
|
|
} |