File Coverage

blib/lib/Sub/HandlesVia/Handler.pm.mite.pm
Criterion Covered Total %
statement 422 609 69.2
branch 213 480 44.3
condition 70 243 28.8
subroutine 40 40 100.0
pod 5 8 62.5
total 750 1380 54.3


line stmt bran cond sub pod time code
1             {
2              
3             use strict;
4 94     94   713 use warnings;
  94         243  
  94         2850  
5 94     94   537 no warnings qw( once void );
  94         244  
  94         2765  
6 94     94   543  
  94         341  
  94         13139  
7             our $USES_MITE = "Mite::Class";
8             our $MITE_SHIM = "Sub::HandlesVia::Mite";
9             our $MITE_VERSION = "0.010008";
10              
11             # Mite keywords
12             BEGIN {
13             my ( $SHIM, $CALLER ) =
14 94     94   515 ( "Sub::HandlesVia::Mite", "Sub::HandlesVia::Handler" );
15             (
16             *after, *around, *before, *extends, *field,
17             *has, *param, *signature_for, *with
18             )
19             = do {
20 94         373  
21             no warnings 'redefine';
22             (
23 94     94   761 sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
  94         569  
  94         22679  
24             sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) },
25 0         0 sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) },
26 0         0 sub { },
27 0         0 sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) },
28             sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) },
29 0         0 sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) },
30 1504         5548 sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) },
31 0         0 sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
32 0         0 );
33 0         0 }
34 94         17956  
35             # Mite imports
36             BEGIN {
37             require Scalar::Util;
38             *STRICT = \&Sub::HandlesVia::Mite::STRICT;
39             *bare = \&Sub::HandlesVia::Mite::bare;
40 94     94   878 *blessed = \&Scalar::Util::blessed;
41 94         1030 *carp = \&Sub::HandlesVia::Mite::carp;
42 94         718 *confess = \&Sub::HandlesVia::Mite::confess;
43 94         344 *croak = \&Sub::HandlesVia::Mite::croak;
44 94         268 *false = \&Sub::HandlesVia::Mite::false;
45 94         220 *guard = \&Sub::HandlesVia::Mite::guard;
46 94         241 *lazy = \&Sub::HandlesVia::Mite::lazy;
47 94         230 *ro = \&Sub::HandlesVia::Mite::ro;
48 94         238 *rw = \&Sub::HandlesVia::Mite::rw;
49 94         213 *rwp = \&Sub::HandlesVia::Mite::rwp;
50 94         223 *true = \&Sub::HandlesVia::Mite::true;
51 94         197 }
52 94         238  
53 94         3327 # Gather metadata for constructor and destructor
54             no strict 'refs';
55             my $class = shift;
56             $class = ref($class) || $class;
57             my $linear_isa = mro::get_linear_isa($class);
58 94     94   652 return {
  94         238  
  94         211003  
59 95     95   261 BUILD => [
60 95   33     570 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
61 95         489 map { "$_\::BUILD" } reverse @$linear_isa
62             ],
63             DEMOLISH => [
64 192 100       406 map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
  192         1556  
  1         5  
65 192         754 map { "$_\::DEMOLISH" } @$linear_isa
66             ],
67             HAS_BUILDARGS => $class->can('BUILDARGS'),
68 192 50       391 HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
  192         2439  
  0         0  
69 95         442 };
  192         676  
70             }
71              
72             # Standard Moose/Moo-style constructor
73             my $class = ref( $_[0] ) ? ref(shift) : shift;
74             my $meta = ( $Mite::META{$class} ||= $class->__META__ );
75             my $self = bless {}, $class;
76             my $args =
77             $meta->{HAS_BUILDARGS}
78 5780 50   5780 1 14805 ? $class->BUILDARGS(@_)
79 5780   66     16451 : { ( @_ == 1 ) ? %{ $_[0] } : @_ };
80 5780         13279 my $no_build = delete $args->{__no_BUILD__};
81              
82             # Attribute name (type: Str)
83             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 12
84 5780 50       34652 if ( exists $args->{"name"} ) {
  0 50       0  
85 5780         11760 do {
86              
87             defined( $args->{"name"} ) and do {
88             ref( \$args->{"name"} ) eq 'SCALAR'
89 5780 50       13245 or ref( \( my $val = $args->{"name"} ) ) eq 'SCALAR';
90 5780 50       8654 }
91             or croak "Type check failed in constructor: %s should be %s",
92             "name", "Str";
93 5780 50       14537 $self->{"name"} = $args->{"name"};
94             }
95 5780 50       28831  
96             # Attribute template (type: Str)
97             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 17
98             if ( exists $args->{"template"} ) {
99             do {
100 5780         15500  
101             defined( $args->{"template"} ) and do {
102             ref( \$args->{"template"} ) eq 'SCALAR'
103             or ref( \( my $val = $args->{"template"} ) ) eq 'SCALAR';
104             }
105 5780 50       13114 or croak "Type check failed in constructor: %s should be %s",
106 5780 50       8562 "template", "Str";
107             $self->{"template"} = $args->{"template"};
108             }
109 5780 50       13506  
110             # Attribute lvalue_template (type: Str)
111 5780 50       22683 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 22
112             if ( exists $args->{"lvalue_template"} ) {
113             do {
114              
115             defined( $args->{"lvalue_template"} ) and do {
116 5780         12064 ref( \$args->{"lvalue_template"} ) eq 'SCALAR'
117             or ref( \( my $val = $args->{"lvalue_template"} ) ) eq
118             'SCALAR';
119             }
120             or croak "Type check failed in constructor: %s should be %s",
121 5780 100       12759 "lvalue_template", "Str";
122 2457 50       3905 $self->{"lvalue_template"} = $args->{"lvalue_template"};
123             }
124              
125 2457 50       5949 # Attribute args (type: Int|Undef)
126             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 27
127 2457 50       9524 do {
128             my $value = exists( $args->{"args"} ) ? $args->{"args"} : undef;
129             do {
130              
131             (
132             (
133 2457         5152 do {
134             my $tmp = $value;
135             defined($tmp)
136             and !ref($tmp)
137             and $tmp =~ /\A-?[0-9]+\z/;
138 5780         9225 }
139 5780 100       12759 )
140 5780 50       8584 or ( !defined($value) )
141             );
142             or croak "Type check failed in constructor: %s should be %s",
143             "args", "Int|Undef";
144             $self->{"args"} = $value;
145 5780 100       8046 };
146 5780         9196  
147 5780 100 66     43944 # Attribute min_args (type: Int|Undef)
148             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37
149             if ( exists $args->{"min_args"} ) {
150             do {
151              
152             (
153             (
154             do {
155             my $tmp = $args->{"min_args"};
156             defined($tmp)
157 5780         13685 and !ref($tmp)
158             and $tmp =~ /\A-?[0-9]+\z/;
159             }
160             )
161             or do {
162 5780 100       12517  
163 2551 50       3951 !defined( $args->{"min_args"} );
164             }
165             );
166             or croak "Type check failed in constructor: %s should be %s",
167             "min_args", "Int|Undef";
168             $self->{"min_args"} = $args->{"min_args"};
169 2551         4382 }
170 2551 100 66     20842  
171             # Attribute max_args (type: Int|Undef)
172             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37
173             if ( exists $args->{"max_args"} ) {
174             do {
175 2551 100       3692  
176             (
177             (
178 84         360 do {
179             my $tmp = $args->{"max_args"};
180             defined($tmp)
181             and !ref($tmp)
182             and $tmp =~ /\A-?[0-9]+\z/;
183             }
184 2551         5967 )
185             or do {
186              
187             !defined( $args->{"max_args"} );
188             }
189 5780 100       12339 );
190 2219 50       3370 or croak "Type check failed in constructor: %s should be %s",
191             "max_args", "Int|Undef";
192             $self->{"max_args"} = $args->{"max_args"};
193             }
194              
195             # Attribute signature (type: ArrayRef|Undef)
196 2219         3706 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 43
197 2219 100 66     14857 if ( exists $args->{"signature"} ) {
198             do {
199              
200             (
201             do {
202 2219 100       3243  
203             ref( $args->{"signature"} ) eq 'ARRAY';
204             }
205 213         748 or do {
206              
207             !defined( $args->{"signature"} );
208             }
209             );
210             or croak "Type check failed in constructor: %s should be %s",
211 2219         4956 "signature", "ArrayRef|Undef";
212             $self->{"signature"} = $args->{"signature"};
213             }
214              
215             # Attribute usage (type: Str)
216 5780 100       13643 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 48
217 4002 50       6084 if ( exists $args->{"usage"} ) {
218             do {
219              
220             defined( $args->{"usage"} ) and do {
221             ref( \$args->{"usage"} ) eq 'SCALAR'
222             or ref( \( my $val = $args->{"usage"} ) ) eq 'SCALAR';
223             }
224 4002         12945 or croak "Type check failed in constructor: %s should be %s",
225             "usage", "Str";
226 4002 100       5694 $self->{"usage"} = $args->{"usage"};
227             }
228              
229 213         691 # Attribute curried (type: ArrayRef)
230             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 54
231             if ( exists $args->{"curried"} ) {
232             do {
233              
234             ref( $args->{"curried"} ) eq 'ARRAY';
235 4002         8636 or croak "Type check failed in constructor: %s should be %s",
236             "curried", "ArrayRef";
237             $self->{"curried"} = $args->{"curried"};
238             }
239              
240 5780 100       12477 # Attribute is_chainable (type: Bool)
241 3222 50       4849 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59
242             if ( exists $args->{"is_chainable"} ) {
243             do {
244 3222 50       7820 my $coerced_value = do {
245             my $to_coerce = $args->{"is_chainable"};
246 3222 50       12742 (
247             (
248             !ref $to_coerce
249             and (!defined $to_coerce
250             or $to_coerce eq q()
251 3222         7250 or $to_coerce eq '0'
252             or $to_coerce eq '1' )
253             )
254             ) ? $to_coerce
255             : ( ( !!1 ) )
256 5780 100       12204 ? scalar( do { local $_ = $to_coerce; !!$_ } )
257 1388 50       2149 : $to_coerce;
258             };
259             (
260 1388         3744 !ref $coerced_value
261             and (!defined $coerced_value
262             or $coerced_value eq q()
263             or $coerced_value eq '0'
264 1388         3351 or $coerced_value eq '1' )
265             )
266             or croak "Type check failed in constructor: %s should be %s",
267             "is_chainable", "Bool";
268             $self->{"is_chainable"} = $coerced_value;
269 5780 100       11971 };
270 18         39 }
271 18         47  
272 18         49 # Attribute no_validation_needed (type: Bool)
273             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59
274             if ( exists $args->{"no_validation_needed"} ) {
275             do {
276             my $coerced_value = do {
277             my $to_coerce = $args->{"no_validation_needed"};
278             (
279             (
280             !ref $to_coerce
281             and (!defined $to_coerce
282             or $to_coerce eq q()
283 18 50 33     318 or $to_coerce eq '0'
  0         0  
  0         0  
284             or $to_coerce eq '1' )
285             )
286             ) ? $to_coerce
287 18 50 33     309 : ( ( !!1 ) )
      33        
288             ? scalar( do { local $_ = $to_coerce; !!$_ } )
289             : $to_coerce;
290             };
291             (
292             !ref $coerced_value
293             and (!defined $coerced_value
294             or $coerced_value eq q()
295 18         117 or $coerced_value eq '0'
296             or $coerced_value eq '1' )
297             )
298             or croak "Type check failed in constructor: %s should be %s",
299             "no_validation_needed", "Bool";
300             $self->{"no_validation_needed"} = $coerced_value;
301 5780 50       11975 };
302 0         0 }
303 0         0  
304 0         0 # Attribute is_mutator (type: Bool)
305             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 70
306             if ( exists $args->{"is_mutator"} ) {
307             do {
308             my $coerced_value = do {
309             my $to_coerce = $args->{"is_mutator"};
310             (
311             (
312             !ref $to_coerce
313             and (!defined $to_coerce
314             or $to_coerce eq q()
315 0 0 0     0 or $to_coerce eq '0'
  0         0  
  0         0  
316             or $to_coerce eq '1' )
317             )
318             ) ? $to_coerce
319 0 0 0     0 : ( ( !!1 ) )
      0        
320             ? scalar( do { local $_ = $to_coerce; !!$_ } )
321             : $to_coerce;
322             };
323             (
324             !ref $coerced_value
325             and (!defined $coerced_value
326             or $coerced_value eq q()
327 0         0 or $coerced_value eq '0'
328             or $coerced_value eq '1' )
329             )
330             or croak "Type check failed in constructor: %s should be %s",
331             "is_mutator", "Bool";
332             $self->{"is_mutator"} = $coerced_value;
333 5780 100       12594 };
334 3         6 }
335 3         5  
336 3         8 # Attribute allow_getter_shortcuts (type: Bool)
337             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 72
338             do {
339             my $value =
340             exists( $args->{"allow_getter_shortcuts"} )
341             ? $args->{"allow_getter_shortcuts"}
342             : true;
343             do {
344             my $coerced_value = do {
345             my $to_coerce = $value;
346             (
347 3 50 33     28 (
  0         0  
  0         0  
348             !ref $to_coerce
349             and (!defined $to_coerce
350             or $to_coerce eq q()
351 3 50 33     23 or $to_coerce eq '0'
      33        
352             or $to_coerce eq '1' )
353             )
354             ) ? $to_coerce
355             : ( ( !!1 ) )
356             ? scalar( do { local $_ = $to_coerce; !!$_ } )
357             : $to_coerce;
358             };
359 3         7 (
360             !ref $coerced_value
361             and (!defined $coerced_value
362             or $coerced_value eq q()
363             or $coerced_value eq '0'
364             or $coerced_value eq '1' )
365 5780         8697 )
366             or croak "Type check failed in constructor: %s should be %s",
367             "allow_getter_shortcuts", "Bool";
368 5780 100       13135 $self->{"allow_getter_shortcuts"} = $coerced_value;
369             };
370 5780         8678 };
371 5780         8659  
372 5780         9460 # Attribute prefer_shift_self (type: Bool)
373             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 79
374             do {
375             my $value =
376             exists( $args->{"prefer_shift_self"} )
377             ? $args->{"prefer_shift_self"}
378             : false;
379             do {
380             my $coerced_value = do {
381             my $to_coerce = $value;
382             (
383 5780 50 33     41703 (
  0         0  
  0         0  
384             !ref $to_coerce
385             and (!defined $to_coerce
386             or $to_coerce eq q()
387 5780 50 66     38007 or $to_coerce eq '0'
      66        
388             or $to_coerce eq '1' )
389             )
390             ) ? $to_coerce
391             : ( ( !!1 ) )
392             ? scalar( do { local $_ = $to_coerce; !!$_ } )
393             : $to_coerce;
394             };
395 5780         14360 (
396             !ref $coerced_value
397             and (!defined $coerced_value
398             or $coerced_value eq q()
399             or $coerced_value eq '0'
400             or $coerced_value eq '1' )
401 5780         9010 )
402             or croak "Type check failed in constructor: %s should be %s",
403             "prefer_shift_self", "Bool";
404 5780 100       12168 $self->{"prefer_shift_self"} = $coerced_value;
405             };
406 5780         8884 };
407 5780         8328  
408 5780         8897 # Attribute additional_validation (type: CodeRef|Str|Undef)
409             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 86
410             if ( exists $args->{"additional_validation"} ) {
411             do {
412              
413             (
414             do {
415              
416             ref( $args->{"additional_validation"} ) eq 'CODE';
417             }
418             or do {
419 5780 50 33     33110  
  0         0  
  0         0  
420             defined( $args->{"additional_validation"} ) and do {
421             ref( \$args->{"additional_validation"} ) eq 'SCALAR'
422             or ref(
423 5780 50 66     27944 \( my $val = $args->{"additional_validation"} )
      66        
424             ) eq 'SCALAR';
425             }
426             }
427             or do {
428              
429             !defined( $args->{"additional_validation"} );
430             }
431 5780         13133 );
432             or croak "Type check failed in constructor: %s should be %s",
433             "additional_validation", "CodeRef|Str|Undef";
434             $self->{"additional_validation"} = $args->{"additional_validation"};
435             }
436              
437 5780 100       12572 # Attribute default_for_reset (type: CodeRef)
438 1996 50       3259 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 91
439             if ( exists $args->{"default_for_reset"} ) {
440             do {
441              
442             ref( $args->{"default_for_reset"} ) eq 'CODE';
443             or croak "Type check failed in constructor: %s should be %s",
444             "default_for_reset", "CodeRef";
445 1996         6931 $self->{"default_for_reset"} = $args->{"default_for_reset"};
446             }
447              
448             # Attribute documentation (type: Str)
449             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 96
450 671 50       1902 if ( exists $args->{"documentation"} ) {
451             do {
452              
453 671 50       4085 defined( $args->{"documentation"} ) and do {
454             ref( \$args->{"documentation"} ) eq 'SCALAR'
455             or ref( \( my $val = $args->{"documentation"} ) ) eq
456             'SCALAR';
457 1996 50 66     3147 }
458             or croak "Type check failed in constructor: %s should be %s",
459             "documentation", "Str";
460 0         0 $self->{"documentation"} = $args->{"documentation"};
461             }
462              
463             # Attribute _examples (type: CodeRef)
464             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 101
465             if ( exists $args->{"_examples"} ) {
466 1996         4328 do {
467              
468             ref( $args->{"_examples"} ) eq 'CODE';
469             or croak "Type check failed in constructor: %s should be %s",
470             "_examples", "CodeRef";
471 5780 100       12118 $self->{"_examples"} = $args->{"_examples"};
472 60 50       180 }
473              
474             # Call BUILD methods
475 60         325 $self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } );
476              
477             # Unrecognized parameters
478             my @unknown = grep not(
479 60         159 /\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/
480             ), keys %{$args};
481             @unknown
482             and croak(
483             "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
484 5780 100       12259  
485 5777 50       8090 return $self;
486             }
487              
488 5777 50       12450 # Used by constructor to call BUILD methods
489             my $class = ref( $_[0] );
490 5777 50       22758 my $meta = ( $Mite::META{$class} ||= $class->__META__ );
491             $_->(@_) for @{ $meta->{BUILD} || [] };
492             }
493              
494             # Destructor should call DEMOLISH methods
495             my $self = shift;
496 5777         13969 my $class = ref($self) || $self;
497             my $meta = ( $Mite::META{$class} ||= $class->__META__ );
498             my $in_global_destruction =
499             defined ${^GLOBAL_PHASE}
500             ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
501 5780 100       12208 : Devel::GlobalDestruction::in_global_destruction();
502 3851 50       5624 for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
503             my $e = do {
504             local ( $?, $@ );
505 3851         10090 eval { $demolisher->( $self, $in_global_destruction ) };
506             $@;
507             };
508             no warnings 'misc'; # avoid (in cleanup) warnings
509 3851         7932 die $e if $e; # rethrow
510             }
511             return;
512             }
513 5780 50 33     12654  
  5780 50       20890  
514             my $__XS = !$ENV{PERL_ONLY}
515             && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
516              
517             # Accessors for _examples
518 5780         9622 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 101
  5780         68826  
519             if ($__XS) {
520 5780 50       17453 Class::XSAccessor->import(
521             chained => 1,
522             "getters" => { "_examples" => "_examples" },
523 5780         45162 );
524             }
525             else {
526             *_examples = sub {
527             @_ == 1 or croak('Reader "_examples" usage: $self->_examples()');
528 2     2 0 4 $_[0]{"_examples"};
529 2   33     8 };
530 2 50       3 }
  2         20  
531              
532             # Accessors for additional_validation
533             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 86
534             if ($__XS) {
535 5783     5783   73238 Class::XSAccessor->import(
536 5783   33     16533 chained => 1,
537 5783   33     16070 "getters" => { "additional_validation" => "additional_validation" },
538 5783 50       20767 );
539             }
540             else {
541             *additional_validation = sub {
542 5783 50       9291 @_ == 1
  5783         19178  
543 0         0 or croak(
544 0         0 'Reader "additional_validation" usage: $self->additional_validation()'
545 0         0 );
  0         0  
546 0         0 $_[0]{"additional_validation"};
547             };
548 94     94   874 }
  94         309  
  94         180374  
549 0 0       0  
550             # Accessors for allow_getter_shortcuts
551 5783         51705 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 72
552             if ($__XS) {
553             Class::XSAccessor->import(
554             chained => 1,
555             "getters" =>
556             { "allow_getter_shortcuts" => "allow_getter_shortcuts" },
557             );
558             }
559             else {
560             *allow_getter_shortcuts = sub {
561             @_ == 1
562             or croak(
563             'Reader "allow_getter_shortcuts" usage: $self->allow_getter_shortcuts()'
564             );
565             $_[0]{"allow_getter_shortcuts"};
566             };
567             }
568              
569             # Accessors for args
570             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 27
571             if ($__XS) {
572             Class::XSAccessor->import(
573             chained => 1,
574             "getters" => { "args" => "args" },
575             );
576             }
577             else {
578             *args = sub {
579             @_ == 1 or croak('Reader "args" usage: $self->args()');
580             $_[0]{"args"};
581             };
582             }
583              
584             # Accessors for curried
585             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 54
586             if ($__XS) {
587             Class::XSAccessor->import(
588             chained => 1,
589             "getters" => { "curried" => "curried" },
590             );
591             }
592             else {
593             *curried = sub {
594             @_ == 1 or croak('Reader "curried" usage: $self->curried()');
595             $_[0]{"curried"};
596             };
597             }
598              
599             # Accessors for default_for_reset
600             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 91
601             if ($__XS) {
602             Class::XSAccessor->import(
603             chained => 1,
604             "getters" => { "default_for_reset" => "default_for_reset" },
605             );
606             }
607             else {
608             *default_for_reset = sub {
609             @_ == 1
610             or croak(
611             'Reader "default_for_reset" usage: $self->default_for_reset()');
612             $_[0]{"default_for_reset"};
613             };
614             }
615              
616             # Accessors for documentation
617             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 96
618             if ($__XS) {
619             Class::XSAccessor->import(
620             chained => 1,
621             "getters" => { "documentation" => "documentation" },
622             );
623             }
624             else {
625             *documentation = sub {
626             @_ == 1
627             or croak('Reader "documentation" usage: $self->documentation()');
628             $_[0]{"documentation"};
629             };
630             }
631              
632             # Accessors for is_chainable
633             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59
634             if ($__XS) {
635             Class::XSAccessor->import(
636             chained => 1,
637             "getters" => { "is_chainable" => "is_chainable" },
638             );
639             }
640             else {
641             *is_chainable = sub {
642             @_ == 1
643             or croak('Reader "is_chainable" usage: $self->is_chainable()');
644             $_[0]{"is_chainable"};
645             };
646             }
647              
648             # Accessors for is_mutator
649             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 70
650             @_ == 1 or croak('Reader "is_mutator" usage: $self->is_mutator()');
651             (
652             exists( $_[0]{"is_mutator"} ) ? $_[0]{"is_mutator"} : (
653             $_[0]{"is_mutator"} = do {
654             my $default_value = do {
655             my $to_coerce =
656             $Sub::HandlesVia::Handler::__is_mutator_DEFAULT__->(
657             $_[0] );
658             (
659             (
660             !ref $to_coerce
661             and (!defined $to_coerce
662             or $to_coerce eq q()
663             or $to_coerce eq '0'
664             or $to_coerce eq '1' )
665             )
666             ) ? $to_coerce
667             : ( ( !!1 ) )
668             ? scalar( do { local $_ = $to_coerce; !!$_ } )
669             : $to_coerce;
670             };
671             (
672             !ref $default_value
673             and (!defined $default_value
674             or $default_value eq q()
675             or $default_value eq '0'
676             or $default_value eq '1' )
677             )
678             or croak( "Type check failed in default: %s should be %s",
679             "is_mutator", "Bool" );
680             $default_value;
681             }
682             )
683             );
684             }
685              
686             # Accessors for lvalue_template
687             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 22
688             if ($__XS) {
689             Class::XSAccessor->import(
690             chained => 1,
691 4219 50   4219 1 10368 "getters" => { "lvalue_template" => "lvalue_template" },
692             );
693             }
694 4219 100       10855 else {
695 4215         6294 *lvalue_template = sub {
696 4215         11324 @_ == 1
697             or
698             croak('Reader "lvalue_template" usage: $self->lvalue_template()');
699             $_[0]{"lvalue_template"};
700             };
701             }
702              
703             # Accessors for max_args
704             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37
705             @_ == 1 or croak('Reader "max_args" usage: $self->max_args()');
706             (
707             exists( $_[0]{"max_args"} ) ? $_[0]{"max_args"} : (
708             $_[0]{"max_args"} = do {
709 4215 50 33     31796 my $default_value = $_[0]->_build_max_args;
  0         0  
  0         0  
710             do {
711              
712             (
713 4215 50 66     24447 (
      66        
714             do {
715             my $tmp = $default_value;
716             defined($tmp)
717             and !ref($tmp)
718             and $tmp =~ /\A-?[0-9]+\z/;
719             }
720             )
721 4215         17367 or ( !defined($default_value) )
722             );
723             or croak( "Type check failed in default: %s should be %s",
724             "max_args", "Int|Undef" );
725             $default_value;
726             }
727             )
728             );
729             }
730              
731             # Accessors for min_args
732             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37
733             @_ == 1 or croak('Reader "min_args" usage: $self->min_args()');
734             (
735             exists( $_[0]{"min_args"} ) ? $_[0]{"min_args"} : (
736             $_[0]{"min_args"} = do {
737             my $default_value = $_[0]->_build_min_args;
738             do {
739              
740             (
741             (
742             do {
743             my $tmp = $default_value;
744             defined($tmp)
745             and !ref($tmp)
746             and $tmp =~ /\A-?[0-9]+\z/;
747 12442 50   12442 1 25681 }
748             )
749             or ( !defined($default_value) )
750 12442 100       44229 );
751 2415         6542 or croak( "Type check failed in default: %s should be %s",
752 2415 50       3913 "min_args", "Int|Undef" );
753             $default_value;
754             }
755             )
756             );
757 2415 100       3568 }
758 2415         3771  
759 2415 100 66     18095 # Accessors for name
760             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 12
761             if ($__XS) {
762             Class::XSAccessor->import(
763             chained => 1,
764             "getters" => { "name" => "name" },
765             );
766             }
767             else {
768             *name = sub {
769 2415         9430 @_ == 1 or croak('Reader "name" usage: $self->name()');
770             $_[0]{"name"};
771             };
772             }
773              
774             # Accessors for no_validation_needed
775             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59
776             if ($__XS) {
777             Class::XSAccessor->import(
778 5985 50   5985 1 13277 chained => 1,
779             "getters" => { "no_validation_needed" => "no_validation_needed" },
780             );
781 5985 100       21152 }
782 2099         5842 else {
783 2099 50       3662 *no_validation_needed = sub {
784             @_ == 1
785             or croak(
786             'Reader "no_validation_needed" usage: $self->no_validation_needed()'
787             );
788 2099 100       3101 $_[0]{"no_validation_needed"};
789 2099         3630 };
790 2099 100 66     18795 }
791              
792             # Accessors for prefer_shift_self
793             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 79
794             if ($__XS) {
795             Class::XSAccessor->import(
796             chained => 1,
797             "getters" => { "prefer_shift_self" => "prefer_shift_self" },
798             );
799             }
800 2099         10547 else {
801             *prefer_shift_self = sub {
802             @_ == 1
803             or croak(
804             'Reader "prefer_shift_self" usage: $self->prefer_shift_self()');
805             $_[0]{"prefer_shift_self"};
806             };
807             }
808              
809             # Accessors for signature
810             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 43
811             if ($__XS) {
812             Class::XSAccessor->import(
813             chained => 1,
814             "getters" => { "signature" => "signature" },
815             );
816             }
817             else {
818             *signature = sub {
819             @_ == 1 or croak('Reader "signature" usage: $self->signature()');
820             $_[0]{"signature"};
821             };
822             }
823              
824             # Accessors for template
825             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 17
826             if ($__XS) {
827             Class::XSAccessor->import(
828             chained => 1,
829             "getters" => { "template" => "template" },
830             );
831             }
832             else {
833             *template = sub {
834             @_ == 1 or croak('Reader "template" usage: $self->template()');
835             $_[0]{"template"};
836             };
837             }
838              
839             # Accessors for usage
840             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 48
841             @_ == 1 or croak('Reader "usage" usage: $self->usage()');
842             (
843             exists( $_[0]{"usage"} ) ? $_[0]{"usage"} : (
844             $_[0]{"usage"} = do {
845             my $default_value = $_[0]->_build_usage;
846             do {
847              
848             defined($default_value) and do {
849             ref( \$default_value ) eq 'SCALAR'
850             or ref( \( my $val = $default_value ) ) eq
851             'SCALAR';
852             }
853             or croak( "Type check failed in default: %s should be %s",
854             "usage", "Str" );
855             $default_value;
856             }
857             )
858             );
859             }
860              
861             # See UNIVERSAL
862             my ( $self, $role ) = @_;
863             our %DOES;
864             return $DOES{$role} if exists $DOES{$role};
865             return 1 if $role eq __PACKAGE__;
866             if ( $INC{'Moose/Util.pm'}
867             and my $meta = Moose::Util::find_meta( ref $self or $self ) )
868             {
869             $meta->can('does_role') and $meta->does_role($role) and return 1;
870             }
871             return $self->SUPER::DOES($role);
872             }
873              
874             # Alias for Moose/Moo-compatibility
875             shift->DOES(@_);
876             }
877              
878             1;
879             {
880              
881             use strict;
882             use warnings;
883             no warnings qw( once void );
884              
885             our $USES_MITE = "Mite::Class";
886             our $MITE_SHIM = "Sub::HandlesVia::Mite";
887             our $MITE_VERSION = "0.010008";
888              
889 2638 50   2638 1 6157 # Mite keywords
890             BEGIN {
891             my ( $SHIM, $CALLER ) =
892 2638 100       6379 ( "Sub::HandlesVia::Mite", "Sub::HandlesVia::Handler::Traditional" );
893 2271         6270 (
894 2271 50       3751 *after, *around, *before, *extends, *field,
895             *has, *param, *signature_for, *with
896             )
897 2271 50       5803 = do {
898 2271 50       9848  
899             no warnings 'redefine';
900             (
901             sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
902             sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) },
903             sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) },
904             sub { },
905 2271         8961 sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) },
906             sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) },
907             sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) },
908             sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) },
909             sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
910             );
911             }
912              
913 6204     6204 0 10767 # Mite imports
914 6204         8183 BEGIN {
915 6204 50       11632 require Scalar::Util;
916 6204 50       10974 *STRICT = \&Sub::HandlesVia::Mite::STRICT;
917 6204 50 33     14440 *bare = \&Sub::HandlesVia::Mite::bare;
      66        
918             *blessed = \&Scalar::Util::blessed;
919             *carp = \&Sub::HandlesVia::Mite::carp;
920 0 0 0     0 *confess = \&Sub::HandlesVia::Mite::confess;
921             *croak = \&Sub::HandlesVia::Mite::croak;
922 6204         38374 *false = \&Sub::HandlesVia::Mite::false;
923             *guard = \&Sub::HandlesVia::Mite::guard;
924             *lazy = \&Sub::HandlesVia::Mite::lazy;
925             *ro = \&Sub::HandlesVia::Mite::ro;
926             *rw = \&Sub::HandlesVia::Mite::rw;
927 2068     2068 0 305941 *rwp = \&Sub::HandlesVia::Mite::rwp;
928             *true = \&Sub::HandlesVia::Mite::true;
929             }
930              
931             BEGIN {
932              
933             use mro 'c3';
934             our @ISA;
935 94     94   872 push @ISA, "Sub::HandlesVia::Handler";
  94         280  
  94         2918  
936 94     94   591 }
  94         248  
  94         3459  
937 94     94   1978  
  94         231  
  94         13067  
938             # Standard Moose/Moo-style constructor
939             my $class = ref( $_[0] ) ? ref(shift) : shift;
940             my $meta = ( $Mite::META{$class} ||= $class->__META__ );
941             my $self = bless {}, $class;
942             my $args =
943             $meta->{HAS_BUILDARGS}
944             ? $class->BUILDARGS(@_)
945 94     94   1781 : { ( @_ == 1 ) ? %{ $_[0] } : @_ };
946             my $no_build = delete $args->{__no_BUILD__};
947              
948             # Attribute template (type: Str)
949             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 17
950             if ( exists $args->{"template"} ) {
951 94         252 do {
952              
953             defined( $args->{"template"} ) and do {
954 94     94   737 ref( \$args->{"template"} ) eq 'SCALAR'
  94         270  
  94         22483  
955             or ref( \( my $val = $args->{"template"} ) ) eq 'SCALAR';
956 0         0 }
957 0         0 or croak "Type check failed in constructor: %s should be %s",
958 0         0 "template", "Str";
959             $self->{"template"} = $args->{"template"};
960 0         0 }
961 94         418  
962 0         0 # Attribute lvalue_template (type: Str)
963 0         0 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 22
964 0         0 if ( exists $args->{"lvalue_template"} ) {
965 94         19378 do {
966              
967             defined( $args->{"lvalue_template"} ) and do {
968             ref( \$args->{"lvalue_template"} ) eq 'SCALAR'
969             or ref( \( my $val = $args->{"lvalue_template"} ) ) eq
970             'SCALAR';
971 94     94   712 }
972 94         377 or croak "Type check failed in constructor: %s should be %s",
973 94         303 "lvalue_template", "Str";
974 94         261 $self->{"lvalue_template"} = $args->{"lvalue_template"};
975 94         233 }
976 94         226  
977 94         276 # Attribute args (type: Int|Undef)
978 94         248 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 27
979 94         261 do {
980 94         239 my $value = exists( $args->{"args"} ) ? $args->{"args"} : undef;
981 94         1578 do {
982 94         204  
983 94         234 (
984 94         3452 (
985             do {
986             my $tmp = $value;
987             defined($tmp)
988             and !ref($tmp)
989 94     94   694 and $tmp =~ /\A-?[0-9]+\z/;
  94         1663  
  94         932  
990 94     94   4769 }
991 94         211948 )
992             or ( !defined($value) )
993             );
994             or croak "Type check failed in constructor: %s should be %s",
995             "args", "Int|Undef";
996 1 50   1   6 $self->{"args"} = $value;
997 1   33     14 };
998 1         5  
999             # Attribute min_args (type: Int|Undef)
1000             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37
1001             if ( exists $args->{"min_args"} ) {
1002 1 50       8 do {
  0 50       0  
1003 1         3  
1004             (
1005             (
1006             do {
1007 1 50       4 my $tmp = $args->{"min_args"};
1008 0 0       0 defined($tmp)
1009             and !ref($tmp)
1010             and $tmp =~ /\A-?[0-9]+\z/;
1011 0 0       0 }
1012             )
1013 0 0       0 or do {
1014              
1015             !defined( $args->{"min_args"} );
1016             }
1017             );
1018 0         0 or croak "Type check failed in constructor: %s should be %s",
1019             "min_args", "Int|Undef";
1020             $self->{"min_args"} = $args->{"min_args"};
1021             }
1022              
1023 1 50       5 # Attribute max_args (type: Int|Undef)
1024 0 0       0 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37
1025             if ( exists $args->{"max_args"} ) {
1026             do {
1027 0 0       0  
1028             (
1029 0 0       0 (
1030             do {
1031             my $tmp = $args->{"max_args"};
1032             defined($tmp)
1033             and !ref($tmp)
1034             and $tmp =~ /\A-?[0-9]+\z/;
1035 0         0 }
1036             )
1037             or do {
1038              
1039             !defined( $args->{"max_args"} );
1040 1         3 }
1041 1 50       4 );
1042 1 50       2 or croak "Type check failed in constructor: %s should be %s",
1043             "max_args", "Int|Undef";
1044             $self->{"max_args"} = $args->{"max_args"};
1045             }
1046              
1047 1 50       2 # Attribute signature (type: ArrayRef|Undef)
1048 1         3 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 43
1049 1 50 33     14 if ( exists $args->{"signature"} ) {
1050             do {
1051              
1052             (
1053             do {
1054              
1055             ref( $args->{"signature"} ) eq 'ARRAY';
1056             }
1057             or do {
1058              
1059 1         8 !defined( $args->{"signature"} );
1060             }
1061             );
1062             or croak "Type check failed in constructor: %s should be %s",
1063             "signature", "ArrayRef|Undef";
1064 1 50       4 $self->{"signature"} = $args->{"signature"};
1065 0 0       0 }
1066              
1067             # Attribute usage (type: Str)
1068             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 48
1069             if ( exists $args->{"usage"} ) {
1070             do {
1071 0         0  
1072 0 0 0     0 defined( $args->{"usage"} ) and do {
1073             ref( \$args->{"usage"} ) eq 'SCALAR'
1074             or ref( \( my $val = $args->{"usage"} ) ) eq 'SCALAR';
1075             }
1076             or croak "Type check failed in constructor: %s should be %s",
1077 0 0       0 "usage", "Str";
1078             $self->{"usage"} = $args->{"usage"};
1079             }
1080 0         0  
1081             # Attribute curried (type: ArrayRef)
1082             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 54
1083             if ( exists $args->{"curried"} ) {
1084             do {
1085              
1086 0         0 ref( $args->{"curried"} ) eq 'ARRAY';
1087             or croak "Type check failed in constructor: %s should be %s",
1088             "curried", "ArrayRef";
1089             $self->{"curried"} = $args->{"curried"};
1090             }
1091 1 50       6  
1092 0 0       0 # Attribute is_chainable (type: Bool)
1093             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59
1094             if ( exists $args->{"is_chainable"} ) {
1095             do {
1096             my $coerced_value = do {
1097             my $to_coerce = $args->{"is_chainable"};
1098 0         0 (
1099 0 0 0     0 (
1100             !ref $to_coerce
1101             and (!defined $to_coerce
1102             or $to_coerce eq q()
1103             or $to_coerce eq '0'
1104 0 0       0 or $to_coerce eq '1' )
1105             )
1106             ) ? $to_coerce
1107 0         0 : ( ( !!1 ) )
1108             ? scalar( do { local $_ = $to_coerce; !!$_ } )
1109             : $to_coerce;
1110             };
1111             (
1112             !ref $coerced_value
1113 0         0 and (!defined $coerced_value
1114             or $coerced_value eq q()
1115             or $coerced_value eq '0'
1116             or $coerced_value eq '1' )
1117             )
1118 1 50       4 or croak "Type check failed in constructor: %s should be %s",
1119 0 0       0 "is_chainable", "Bool";
1120             $self->{"is_chainable"} = $coerced_value;
1121             };
1122             }
1123              
1124             # Attribute no_validation_needed (type: Bool)
1125             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59
1126 0         0 if ( exists $args->{"no_validation_needed"} ) {
1127             do {
1128 0 0       0 my $coerced_value = do {
1129             my $to_coerce = $args->{"no_validation_needed"};
1130             (
1131 0         0 (
1132             !ref $to_coerce
1133             and (!defined $to_coerce
1134             or $to_coerce eq q()
1135             or $to_coerce eq '0'
1136             or $to_coerce eq '1' )
1137 0         0 )
1138             ) ? $to_coerce
1139             : ( ( !!1 ) )
1140             ? scalar( do { local $_ = $to_coerce; !!$_ } )
1141             : $to_coerce;
1142 1 50       3 };
1143 0 0       0 (
1144             !ref $coerced_value
1145             and (!defined $coerced_value
1146 0 0       0 or $coerced_value eq q()
1147             or $coerced_value eq '0'
1148 0 0       0 or $coerced_value eq '1' )
1149             )
1150             or croak "Type check failed in constructor: %s should be %s",
1151             "no_validation_needed", "Bool";
1152             $self->{"no_validation_needed"} = $coerced_value;
1153 0         0 };
1154             }
1155              
1156             # Attribute is_mutator (type: Bool)
1157             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 70
1158 1 50       5 if ( exists $args->{"is_mutator"} ) {
1159 0 0       0 do {
1160             my $coerced_value = do {
1161             my $to_coerce = $args->{"is_mutator"};
1162 0         0 (
1163             (
1164             !ref $to_coerce
1165             and (!defined $to_coerce
1166 0         0 or $to_coerce eq q()
1167             or $to_coerce eq '0'
1168             or $to_coerce eq '1' )
1169             )
1170             ) ? $to_coerce
1171 1 50       6 : ( ( !!1 ) )
1172 0         0 ? scalar( do { local $_ = $to_coerce; !!$_ } )
1173 0         0 : $to_coerce;
1174 0         0 };
1175             (
1176             !ref $coerced_value
1177             and (!defined $coerced_value
1178             or $coerced_value eq q()
1179             or $coerced_value eq '0'
1180             or $coerced_value eq '1' )
1181             )
1182             or croak "Type check failed in constructor: %s should be %s",
1183             "is_mutator", "Bool";
1184             $self->{"is_mutator"} = $coerced_value;
1185 0 0 0     0 };
  0         0  
  0         0  
1186             }
1187              
1188             # Attribute allow_getter_shortcuts (type: Bool)
1189 0 0 0     0 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 72
      0        
1190             do {
1191             my $value =
1192             exists( $args->{"allow_getter_shortcuts"} )
1193             ? $args->{"allow_getter_shortcuts"}
1194             : true;
1195             do {
1196             my $coerced_value = do {
1197 0         0 my $to_coerce = $value;
1198             (
1199             (
1200             !ref $to_coerce
1201             and (!defined $to_coerce
1202             or $to_coerce eq q()
1203 1 50       20 or $to_coerce eq '0'
1204 0         0 or $to_coerce eq '1' )
1205 0         0 )
1206 0         0 ) ? $to_coerce
1207             : ( ( !!1 ) )
1208             ? scalar( do { local $_ = $to_coerce; !!$_ } )
1209             : $to_coerce;
1210             };
1211             (
1212             !ref $coerced_value
1213             and (!defined $coerced_value
1214             or $coerced_value eq q()
1215             or $coerced_value eq '0'
1216             or $coerced_value eq '1' )
1217 0 0 0     0 )
  0         0  
  0         0  
1218             or croak "Type check failed in constructor: %s should be %s",
1219             "allow_getter_shortcuts", "Bool";
1220             $self->{"allow_getter_shortcuts"} = $coerced_value;
1221 0 0 0     0 };
      0        
1222             };
1223              
1224             # Attribute prefer_shift_self (type: Bool)
1225             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 79
1226             do {
1227             my $value =
1228             exists( $args->{"prefer_shift_self"} )
1229 0         0 ? $args->{"prefer_shift_self"}
1230             : false;
1231             do {
1232             my $coerced_value = do {
1233             my $to_coerce = $value;
1234             (
1235 1 50       14 (
1236 0         0 !ref $to_coerce
1237 0         0 and (!defined $to_coerce
1238 0         0 or $to_coerce eq q()
1239             or $to_coerce eq '0'
1240             or $to_coerce eq '1' )
1241             )
1242             ) ? $to_coerce
1243             : ( ( !!1 ) )
1244             ? scalar( do { local $_ = $to_coerce; !!$_ } )
1245             : $to_coerce;
1246             };
1247             (
1248             !ref $coerced_value
1249 0 0 0     0 and (!defined $coerced_value
  0         0  
  0         0  
1250             or $coerced_value eq q()
1251             or $coerced_value eq '0'
1252             or $coerced_value eq '1' )
1253 0 0 0     0 )
      0        
1254             or croak "Type check failed in constructor: %s should be %s",
1255             "prefer_shift_self", "Bool";
1256             $self->{"prefer_shift_self"} = $coerced_value;
1257             };
1258             };
1259              
1260             # Attribute additional_validation (type: CodeRef|Str|Undef)
1261 0         0 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 86
1262             if ( exists $args->{"additional_validation"} ) {
1263             do {
1264              
1265             (
1266             do {
1267 1         4  
1268             ref( $args->{"additional_validation"} ) eq 'CODE';
1269             }
1270 1 50       4 or do {
1271              
1272 1         2 defined( $args->{"additional_validation"} ) and do {
1273 1         3 ref( \$args->{"additional_validation"} ) eq 'SCALAR'
1274 1         3 or ref(
1275             \( my $val = $args->{"additional_validation"} )
1276             ) eq 'SCALAR';
1277             }
1278             }
1279             or do {
1280              
1281             !defined( $args->{"additional_validation"} );
1282             }
1283             );
1284             or croak "Type check failed in constructor: %s should be %s",
1285 1 50 33     20 "additional_validation", "CodeRef|Str|Undef";
  0         0  
  0         0  
1286             $self->{"additional_validation"} = $args->{"additional_validation"};
1287             }
1288              
1289 1 50 33     20 # Attribute default_for_reset (type: CodeRef)
      33        
1290             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 91
1291             if ( exists $args->{"default_for_reset"} ) {
1292             do {
1293              
1294             ref( $args->{"default_for_reset"} ) eq 'CODE';
1295             or croak "Type check failed in constructor: %s should be %s",
1296             "default_for_reset", "CodeRef";
1297 1         7 $self->{"default_for_reset"} = $args->{"default_for_reset"};
1298             }
1299              
1300             # Attribute documentation (type: Str)
1301             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 96
1302             if ( exists $args->{"documentation"} ) {
1303 1         6 do {
1304              
1305             defined( $args->{"documentation"} ) and do {
1306 1 50       4 ref( \$args->{"documentation"} ) eq 'SCALAR'
1307             or ref( \( my $val = $args->{"documentation"} ) ) eq
1308 1         2 'SCALAR';
1309 1         2 }
1310 1         3 or croak "Type check failed in constructor: %s should be %s",
1311             "documentation", "Str";
1312             $self->{"documentation"} = $args->{"documentation"};
1313             }
1314              
1315             # Attribute _examples (type: CodeRef)
1316             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 101
1317             if ( exists $args->{"_examples"} ) {
1318             do {
1319              
1320             ref( $args->{"_examples"} ) eq 'CODE';
1321 1 50 33     18 or croak "Type check failed in constructor: %s should be %s",
  0         0  
  0         0  
1322             "_examples", "CodeRef";
1323             $self->{"_examples"} = $args->{"_examples"};
1324             }
1325 1 0 33     17  
      33        
1326             # Attribute name (type: Str)
1327             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 282
1328             croak "Missing key in constructor: name" unless exists $args->{"name"};
1329             do {
1330              
1331             defined( $args->{"name"} ) and do {
1332             ref( \$args->{"name"} ) eq 'SCALAR'
1333 1         3 or ref( \( my $val = $args->{"name"} ) ) eq 'SCALAR';
1334             }
1335             or croak "Type check failed in constructor: %s should be %s", "name",
1336             "Str";
1337             $self->{"name"} = $args->{"name"};
1338              
1339 1 50       5 # Call BUILD methods
1340 0 0       0 $self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } );
1341              
1342             # Unrecognized parameters
1343             my @unknown = grep not(
1344             /\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/
1345             ), keys %{$args};
1346             @unknown
1347 0         0 and croak(
1348             "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
1349              
1350             return $self;
1351             }
1352 0 0       0  
1353             my $__XS = !$ENV{PERL_ONLY}
1354             && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
1355 0 0       0  
1356             # Accessors for name
1357             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 282
1358             if ($__XS) {
1359 0 0 0     0 Class::XSAccessor->import(
1360             chained => 1,
1361             "getters" => { "name" => "name" },
1362 0         0 );
1363             }
1364             else {
1365             *name = sub {
1366             @_ == 1 or croak('Reader "name" usage: $self->name()');
1367             $_[0]{"name"};
1368 0         0 };
1369             }
1370              
1371             # See UNIVERSAL
1372             my ( $self, $role ) = @_;
1373 1 50       4 our %DOES;
1374 0 0       0 return $DOES{$role} if exists $DOES{$role};
1375             return 1 if $role eq __PACKAGE__;
1376             if ( $INC{'Moose/Util.pm'}
1377 0         0 and my $meta = Moose::Util::find_meta( ref $self or $self ) )
1378             {
1379             $meta->can('does_role') and $meta->does_role($role) and return 1;
1380             }
1381 0         0 return $self->SUPER::DOES($role);
1382             }
1383              
1384             # Alias for Moose/Moo-compatibility
1385             shift->DOES(@_);
1386 1 50       3 }
1387 0 0       0  
1388             1;
1389             {
1390 0 0       0  
1391             use strict;
1392 0 0       0 use warnings;
1393             no warnings qw( once void );
1394              
1395             our $USES_MITE = "Mite::Class";
1396             our $MITE_SHIM = "Sub::HandlesVia::Mite";
1397             our $MITE_VERSION = "0.010008";
1398 0         0  
1399             # Mite keywords
1400             BEGIN {
1401             my ( $SHIM, $CALLER ) =
1402             ( "Sub::HandlesVia::Mite", "Sub::HandlesVia::Handler::CodeRef" );
1403 1 50       4 (
1404 0 0       0 *after, *around, *before, *extends, *field,
1405             *has, *param, *signature_for, *with
1406             )
1407 0         0 = do {
1408              
1409             no warnings 'redefine';
1410             (
1411 0         0 sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
1412             sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) },
1413             sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) },
1414             sub { },
1415             sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) },
1416 1 50       4 sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) },
1417 1 50       2 sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) },
1418             sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) },
1419             sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
1420 1 50       14 );
1421             }
1422 1 50       11  
1423             # Mite imports
1424             BEGIN {
1425             require Scalar::Util;
1426             *STRICT = \&Sub::HandlesVia::Mite::STRICT;
1427 1         9 *bare = \&Sub::HandlesVia::Mite::bare;
1428             *blessed = \&Scalar::Util::blessed;
1429             *carp = \&Sub::HandlesVia::Mite::carp;
1430 1 50 33     7 *confess = \&Sub::HandlesVia::Mite::confess;
  1 50       6  
1431             *croak = \&Sub::HandlesVia::Mite::croak;
1432             *false = \&Sub::HandlesVia::Mite::false;
1433             *guard = \&Sub::HandlesVia::Mite::guard;
1434             *lazy = \&Sub::HandlesVia::Mite::lazy;
1435 1         3 *ro = \&Sub::HandlesVia::Mite::ro;
  1         13  
1436             *rw = \&Sub::HandlesVia::Mite::rw;
1437 1 50       3 *rwp = \&Sub::HandlesVia::Mite::rwp;
1438             *true = \&Sub::HandlesVia::Mite::true;
1439             }
1440 1         6  
1441             BEGIN {
1442              
1443             use mro 'c3';
1444             our @ISA;
1445             push @ISA, "Sub::HandlesVia::Handler";
1446             }
1447              
1448             # Standard Moose/Moo-style constructor
1449             my $class = ref( $_[0] ) ? ref(shift) : shift;
1450             my $meta = ( $Mite::META{$class} ||= $class->__META__ );
1451             my $self = bless {}, $class;
1452             my $args =
1453             $meta->{HAS_BUILDARGS}
1454             ? $class->BUILDARGS(@_)
1455             : { ( @_ == 1 ) ? %{ $_[0] } : @_ };
1456             my $no_build = delete $args->{__no_BUILD__};
1457              
1458             # Attribute name (type: Str)
1459             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 12
1460             if ( exists $args->{"name"} ) {
1461             do {
1462              
1463 2068     2068   3999 defined( $args->{"name"} ) and do {
1464 2068         2810 ref( \$args->{"name"} ) eq 'SCALAR'
1465 2068 50       4276 or ref( \( my $val = $args->{"name"} ) ) eq 'SCALAR';
1466 2068 50       5134 }
1467 2068 50 33     5148 or croak "Type check failed in constructor: %s should be %s",
      66        
1468             "name", "Str";
1469             $self->{"name"} = $args->{"name"};
1470 0 0 0     0 }
1471              
1472 2068         9299 # Attribute template (type: Str)
1473             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 17
1474             if ( exists $args->{"template"} ) {
1475             do {
1476              
1477 2068     2068   157318 defined( $args->{"template"} ) and do {
1478             ref( \$args->{"template"} ) eq 'SCALAR'
1479             or ref( \( my $val = $args->{"template"} ) ) eq 'SCALAR';
1480             }
1481             or croak "Type check failed in constructor: %s should be %s",
1482             "template", "Str";
1483             $self->{"template"} = $args->{"template"};
1484             }
1485 94     94   885  
  94         302  
  94         2866  
1486 94     94   626 # Attribute lvalue_template (type: Str)
  94         291  
  94         3457  
1487 94     94   668 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 22
  94         293  
  94         14541  
1488             if ( exists $args->{"lvalue_template"} ) {
1489             do {
1490              
1491             defined( $args->{"lvalue_template"} ) and do {
1492             ref( \$args->{"lvalue_template"} ) eq 'SCALAR'
1493             or ref( \( my $val = $args->{"lvalue_template"} ) ) eq
1494             'SCALAR';
1495 94     94   569 }
1496             or croak "Type check failed in constructor: %s should be %s",
1497             "lvalue_template", "Str";
1498             $self->{"lvalue_template"} = $args->{"lvalue_template"};
1499             }
1500              
1501 94         251 # Attribute args (type: Int|Undef)
1502             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 27
1503             do {
1504 94     94   699 my $value = exists( $args->{"args"} ) ? $args->{"args"} : undef;
  94         222  
  94         22348  
1505             do {
1506 0         0  
1507 0         0 (
1508 0         0 (
1509             do {
1510 0         0 my $tmp = $value;
1511 94         482 defined($tmp)
1512 0         0 and !ref($tmp)
1513 0         0 and $tmp =~ /\A-?[0-9]+\z/;
1514 0         0 }
1515 94         17513 )
1516             or ( !defined($value) )
1517             );
1518             or croak "Type check failed in constructor: %s should be %s",
1519             "args", "Int|Undef";
1520             $self->{"args"} = $value;
1521 94     94   715 };
1522 94         365  
1523 94         290 # Attribute min_args (type: Int|Undef)
1524 94         269 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37
1525 94         263 if ( exists $args->{"min_args"} ) {
1526 94         268 do {
1527 94         227  
1528 94         236 (
1529 94         226 (
1530 94         265 do {
1531 94         258 my $tmp = $args->{"min_args"};
1532 94         216 defined($tmp)
1533 94         198 and !ref($tmp)
1534 94         3436 and $tmp =~ /\A-?[0-9]+\z/;
1535             }
1536             )
1537             or do {
1538              
1539 94     94   629 !defined( $args->{"min_args"} );
  94         252  
  94         555  
1540 94     94   4591 }
1541 94         217119 );
1542             or croak "Type check failed in constructor: %s should be %s",
1543             "min_args", "Int|Undef";
1544             $self->{"min_args"} = $args->{"min_args"};
1545             }
1546 2 50   2   8  
1547 2   66     15 # Attribute max_args (type: Int|Undef)
1548 2         8 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 37
1549             if ( exists $args->{"max_args"} ) {
1550             do {
1551              
1552 2 50       16 (
  0 50       0  
1553 2         6 (
1554             do {
1555             my $tmp = $args->{"max_args"};
1556             defined($tmp)
1557 2 50       7 and !ref($tmp)
1558 2 50       12 and $tmp =~ /\A-?[0-9]+\z/;
1559             }
1560             )
1561 2 50       12 or do {
1562              
1563 2 50       16 !defined( $args->{"max_args"} );
1564             }
1565             );
1566             or croak "Type check failed in constructor: %s should be %s",
1567             "max_args", "Int|Undef";
1568 2         13 $self->{"max_args"} = $args->{"max_args"};
1569             }
1570              
1571             # Attribute signature (type: ArrayRef|Undef)
1572             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 43
1573 2 50       7 if ( exists $args->{"signature"} ) {
1574 0 0       0 do {
1575              
1576             (
1577 0 0       0 do {
1578              
1579 0 0       0 ref( $args->{"signature"} ) eq 'ARRAY';
1580             }
1581             or do {
1582              
1583             !defined( $args->{"signature"} );
1584 0         0 }
1585             );
1586             or croak "Type check failed in constructor: %s should be %s",
1587             "signature", "ArrayRef|Undef";
1588             $self->{"signature"} = $args->{"signature"};
1589 2 50       7 }
1590 0 0       0  
1591             # Attribute usage (type: Str)
1592             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 48
1593 0 0       0 if ( exists $args->{"usage"} ) {
1594             do {
1595 0 0       0  
1596             defined( $args->{"usage"} ) and do {
1597             ref( \$args->{"usage"} ) eq 'SCALAR'
1598             or ref( \( my $val = $args->{"usage"} ) ) eq 'SCALAR';
1599             }
1600             or croak "Type check failed in constructor: %s should be %s",
1601 0         0 "usage", "Str";
1602             $self->{"usage"} = $args->{"usage"};
1603             }
1604              
1605             # Attribute curried (type: ArrayRef)
1606 2         4 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 54
1607 2 100       14 if ( exists $args->{"curried"} ) {
1608 2 50       5 do {
1609              
1610             ref( $args->{"curried"} ) eq 'ARRAY';
1611             or croak "Type check failed in constructor: %s should be %s",
1612             "curried", "ArrayRef";
1613 2 50       3 $self->{"curried"} = $args->{"curried"};
1614 2         6 }
1615 2 50 33     20  
1616             # Attribute is_chainable (type: Bool)
1617             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59
1618             if ( exists $args->{"is_chainable"} ) {
1619             do {
1620             my $coerced_value = do {
1621             my $to_coerce = $args->{"is_chainable"};
1622             (
1623             (
1624             !ref $to_coerce
1625 2         7 and (!defined $to_coerce
1626             or $to_coerce eq q()
1627             or $to_coerce eq '0'
1628             or $to_coerce eq '1' )
1629             )
1630 2 100       7 ) ? $to_coerce
1631 1 50       2 : ( ( !!1 ) )
1632             ? scalar( do { local $_ = $to_coerce; !!$_ } )
1633             : $to_coerce;
1634             };
1635             (
1636             !ref $coerced_value
1637 1         2 and (!defined $coerced_value
1638 1 50 33     17 or $coerced_value eq q()
1639             or $coerced_value eq '0'
1640             or $coerced_value eq '1' )
1641             )
1642             or croak "Type check failed in constructor: %s should be %s",
1643 1 50       2 "is_chainable", "Bool";
1644             $self->{"is_chainable"} = $coerced_value;
1645             };
1646 1         6 }
1647              
1648             # Attribute no_validation_needed (type: Bool)
1649             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 59
1650             if ( exists $args->{"no_validation_needed"} ) {
1651             do {
1652 1         6 my $coerced_value = do {
1653             my $to_coerce = $args->{"no_validation_needed"};
1654             (
1655             (
1656             !ref $to_coerce
1657 2 100       6 and (!defined $to_coerce
1658 1 50       2 or $to_coerce eq q()
1659             or $to_coerce eq '0'
1660             or $to_coerce eq '1' )
1661             )
1662             ) ? $to_coerce
1663             : ( ( !!1 ) )
1664 1         3 ? scalar( do { local $_ = $to_coerce; !!$_ } )
1665 1 50 33     8 : $to_coerce;
1666             };
1667             (
1668             !ref $coerced_value
1669             and (!defined $coerced_value
1670 1 50       2 or $coerced_value eq q()
1671             or $coerced_value eq '0'
1672             or $coerced_value eq '1' )
1673 1         6 )
1674             or croak "Type check failed in constructor: %s should be %s",
1675             "no_validation_needed", "Bool";
1676             $self->{"no_validation_needed"} = $coerced_value;
1677             };
1678             }
1679 1         2  
1680             # Attribute is_mutator (type: Bool)
1681             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 70
1682             if ( exists $args->{"is_mutator"} ) {
1683             do {
1684 2 100       7 my $coerced_value = do {
1685 1 50       2 my $to_coerce = $args->{"is_mutator"};
1686             (
1687             (
1688             !ref $to_coerce
1689             and (!defined $to_coerce
1690             or $to_coerce eq q()
1691             or $to_coerce eq '0'
1692 1         6 or $to_coerce eq '1' )
1693             )
1694 1 50       7 ) ? $to_coerce
1695             : ( ( !!1 ) )
1696             ? scalar( do { local $_ = $to_coerce; !!$_ } )
1697 1         5 : $to_coerce;
1698             };
1699             (
1700             !ref $coerced_value
1701             and (!defined $coerced_value
1702             or $coerced_value eq q()
1703 1         3 or $coerced_value eq '0'
1704             or $coerced_value eq '1' )
1705             )
1706             or croak "Type check failed in constructor: %s should be %s",
1707             "is_mutator", "Bool";
1708 2 50       6 $self->{"is_mutator"} = $coerced_value;
1709 0 0       0 };
1710             }
1711              
1712 0 0       0 # Attribute allow_getter_shortcuts (type: Bool)
1713             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 72
1714 0 0       0 do {
1715             my $value =
1716             exists( $args->{"allow_getter_shortcuts"} )
1717             ? $args->{"allow_getter_shortcuts"}
1718             : true;
1719 0         0 do {
1720             my $coerced_value = do {
1721             my $to_coerce = $value;
1722             (
1723             (
1724 2 100       7 !ref $to_coerce
1725 1 50       2 and (!defined $to_coerce
1726             or $to_coerce eq q()
1727             or $to_coerce eq '0'
1728 1         4 or $to_coerce eq '1' )
1729             )
1730             ) ? $to_coerce
1731             : ( ( !!1 ) )
1732 1         2 ? scalar( do { local $_ = $to_coerce; !!$_ } )
1733             : $to_coerce;
1734             };
1735             (
1736             !ref $coerced_value
1737 2 50       6 and (!defined $coerced_value
1738 0         0 or $coerced_value eq q()
1739 0         0 or $coerced_value eq '0'
1740 0         0 or $coerced_value eq '1' )
1741             )
1742             or croak "Type check failed in constructor: %s should be %s",
1743             "allow_getter_shortcuts", "Bool";
1744             $self->{"allow_getter_shortcuts"} = $coerced_value;
1745             };
1746             };
1747              
1748             # Attribute prefer_shift_self (type: Bool)
1749             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 79
1750             do {
1751 0 0 0     0 my $value =
  0         0  
  0         0  
1752             exists( $args->{"prefer_shift_self"} )
1753             ? $args->{"prefer_shift_self"}
1754             : false;
1755 0 0 0     0 do {
      0        
1756             my $coerced_value = do {
1757             my $to_coerce = $value;
1758             (
1759             (
1760             !ref $to_coerce
1761             and (!defined $to_coerce
1762             or $to_coerce eq q()
1763 0         0 or $to_coerce eq '0'
1764             or $to_coerce eq '1' )
1765             )
1766             ) ? $to_coerce
1767             : ( ( !!1 ) )
1768             ? scalar( do { local $_ = $to_coerce; !!$_ } )
1769 2 50       5 : $to_coerce;
1770 0         0 };
1771 0         0 (
1772 0         0 !ref $coerced_value
1773             and (!defined $coerced_value
1774             or $coerced_value eq q()
1775             or $coerced_value eq '0'
1776             or $coerced_value eq '1' )
1777             )
1778             or croak "Type check failed in constructor: %s should be %s",
1779             "prefer_shift_self", "Bool";
1780             $self->{"prefer_shift_self"} = $coerced_value;
1781             };
1782             };
1783 0 0 0     0  
  0         0  
  0         0  
1784             # Attribute additional_validation (type: CodeRef|Str|Undef)
1785             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 86
1786             if ( exists $args->{"additional_validation"} ) {
1787 0 0 0     0 do {
      0        
1788              
1789             (
1790             do {
1791              
1792             ref( $args->{"additional_validation"} ) eq 'CODE';
1793             }
1794             or do {
1795 0         0  
1796             defined( $args->{"additional_validation"} ) and do {
1797             ref( \$args->{"additional_validation"} ) eq 'SCALAR'
1798             or ref(
1799             \( my $val = $args->{"additional_validation"} )
1800             ) eq 'SCALAR';
1801 2 50       6 }
1802 0         0 }
1803 0         0 or do {
1804 0         0  
1805             !defined( $args->{"additional_validation"} );
1806             }
1807             );
1808             or croak "Type check failed in constructor: %s should be %s",
1809             "additional_validation", "CodeRef|Str|Undef";
1810             $self->{"additional_validation"} = $args->{"additional_validation"};
1811             }
1812              
1813             # Attribute default_for_reset (type: CodeRef)
1814             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 91
1815 0 0 0     0 if ( exists $args->{"default_for_reset"} ) {
  0         0  
  0         0  
1816             do {
1817              
1818             ref( $args->{"default_for_reset"} ) eq 'CODE';
1819 0 0 0     0 or croak "Type check failed in constructor: %s should be %s",
      0        
1820             "default_for_reset", "CodeRef";
1821             $self->{"default_for_reset"} = $args->{"default_for_reset"};
1822             }
1823              
1824             # Attribute documentation (type: Str)
1825             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 96
1826             if ( exists $args->{"documentation"} ) {
1827 0         0 do {
1828              
1829             defined( $args->{"documentation"} ) and do {
1830             ref( \$args->{"documentation"} ) eq 'SCALAR'
1831             or ref( \( my $val = $args->{"documentation"} ) ) eq
1832             'SCALAR';
1833 2         4 }
1834             or croak "Type check failed in constructor: %s should be %s",
1835             "documentation", "Str";
1836 2 100       13 $self->{"documentation"} = $args->{"documentation"};
1837             }
1838 2         4  
1839 2         4 # Attribute _examples (type: CodeRef)
1840 2         4 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 101
1841             if ( exists $args->{"_examples"} ) {
1842             do {
1843              
1844             ref( $args->{"_examples"} ) eq 'CODE';
1845             or croak "Type check failed in constructor: %s should be %s",
1846             "_examples", "CodeRef";
1847             $self->{"_examples"} = $args->{"_examples"};
1848             }
1849              
1850             # Attribute delegated_coderef (type: CodeRef)
1851 2 50 33     27 # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 303
  0         0  
  0         0  
1852             croak "Missing key in constructor: delegated_coderef"
1853             unless exists $args->{"delegated_coderef"};
1854             do {
1855 2 50 33     19  
      33        
1856             ref( $args->{"delegated_coderef"} ) eq 'CODE';
1857             or croak "Type check failed in constructor: %s should be %s",
1858             "delegated_coderef", "CodeRef";
1859             $self->{"delegated_coderef"} = $args->{"delegated_coderef"};
1860              
1861             # Call BUILD methods
1862             $self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } );
1863 2         8  
1864             # Unrecognized parameters
1865             my @unknown = grep not(
1866             /\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/
1867             ), keys %{$args};
1868             @unknown
1869 2         3 and croak(
1870             "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
1871              
1872 2 100       26 return $self;
1873             }
1874 2         4  
1875 2         4 my $__XS = !$ENV{PERL_ONLY}
1876 2         4 && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
1877              
1878             # Accessors for delegated_coderef
1879             # has declaration, file lib/Sub/HandlesVia/Handler.pm, line 303
1880             if ($__XS) {
1881             Class::XSAccessor->import(
1882             chained => 1,
1883             "getters" => { "delegated_coderef" => "delegated_coderef" },
1884             );
1885             }
1886             else {
1887 2 50 33     17 *delegated_coderef = sub {
  0         0  
  0         0  
1888             @_ == 1
1889             or croak(
1890             'Reader "delegated_coderef" usage: $self->delegated_coderef()');
1891 2 0 33     14 $_[0]{"delegated_coderef"};
      33        
1892             };
1893             }
1894              
1895             # See UNIVERSAL
1896             my ( $self, $role ) = @_;
1897             our %DOES;
1898             return $DOES{$role} if exists $DOES{$role};
1899 2         6 return 1 if $role eq __PACKAGE__;
1900             if ( $INC{'Moose/Util.pm'}
1901             and my $meta = Moose::Util::find_meta( ref $self or $self ) )
1902             {
1903             $meta->can('does_role') and $meta->does_role($role) and return 1;
1904             }
1905 2 50       7 return $self->SUPER::DOES($role);
1906 0 0       0 }
1907              
1908             # Alias for Moose/Moo-compatibility
1909             shift->DOES(@_);
1910             }
1911              
1912             1;