line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use strict; |
4
|
12
|
|
|
12
|
|
98
|
use warnings; |
|
12
|
|
|
|
|
33
|
|
|
12
|
|
|
|
|
436
|
|
5
|
12
|
|
|
12
|
|
85
|
no warnings qw( once void ); |
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
397
|
|
6
|
12
|
|
|
12
|
|
62
|
|
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
1618
|
|
7
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
8
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
9
|
|
|
|
|
|
|
our $MITE_VERSION = "0.011000"; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Mite keywords |
12
|
|
|
|
|
|
|
BEGIN { |
13
|
|
|
|
|
|
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "Mite::Signature" ); |
14
|
12
|
|
|
12
|
|
66
|
( |
15
|
|
|
|
|
|
|
*after, *around, *before, *extends, *field, |
16
|
|
|
|
|
|
|
*has, *param, *signature_for, *with |
17
|
|
|
|
|
|
|
) |
18
|
|
|
|
|
|
|
= do { |
19
|
12
|
|
|
|
|
32
|
|
20
|
|
|
|
|
|
|
no warnings 'redefine'; |
21
|
|
|
|
|
|
|
( |
22
|
12
|
|
|
12
|
|
90
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
12
|
|
|
|
|
34
|
|
|
12
|
|
|
|
|
2465
|
|
23
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
24
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
25
|
0
|
|
|
0
|
|
0
|
sub { }, |
26
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) }, |
27
|
|
|
|
0
|
|
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
28
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
29
|
132
|
|
|
132
|
|
53748
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
30
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
31
|
0
|
|
|
0
|
|
0
|
); |
32
|
0
|
|
|
0
|
|
0
|
} |
33
|
12
|
|
|
|
|
1907
|
|
34
|
|
|
|
|
|
|
# Mite imports |
35
|
|
|
|
|
|
|
BEGIN { |
36
|
|
|
|
|
|
|
require Scalar::Util; |
37
|
|
|
|
|
|
|
*STRICT = \&Mite::Shim::STRICT; |
38
|
|
|
|
|
|
|
*bare = \&Mite::Shim::bare; |
39
|
12
|
|
|
12
|
|
89
|
*blessed = \&Scalar::Util::blessed; |
40
|
12
|
|
|
|
|
91
|
*carp = \&Mite::Shim::carp; |
41
|
12
|
|
|
|
|
35
|
*confess = \&Mite::Shim::confess; |
42
|
12
|
|
|
|
|
31
|
*croak = \&Mite::Shim::croak; |
43
|
12
|
|
|
|
|
29
|
*false = \&Mite::Shim::false; |
44
|
12
|
|
|
|
|
29
|
*guard = \&Mite::Shim::guard; |
45
|
12
|
|
|
|
|
28
|
*lazy = \&Mite::Shim::lazy; |
46
|
12
|
|
|
|
|
36
|
*lock = \&Mite::Shim::lock; |
47
|
12
|
|
|
|
|
28
|
*ro = \&Mite::Shim::ro; |
48
|
12
|
|
|
|
|
25
|
*rw = \&Mite::Shim::rw; |
49
|
12
|
|
|
|
|
28
|
*rwp = \&Mite::Shim::rwp; |
50
|
12
|
|
|
|
|
37
|
*true = \&Mite::Shim::true; |
51
|
12
|
|
|
|
|
23
|
*unlock = \&Mite::Shim::unlock; |
52
|
12
|
|
|
|
|
27
|
} |
53
|
12
|
|
|
|
|
27
|
|
54
|
12
|
|
|
|
|
367
|
# Gather metadata for constructor and destructor |
55
|
|
|
|
|
|
|
no strict 'refs'; |
56
|
|
|
|
|
|
|
my $class = shift; |
57
|
|
|
|
|
|
|
$class = ref($class) || $class; |
58
|
|
|
|
|
|
|
my $linear_isa = mro::get_linear_isa($class); |
59
|
12
|
|
|
12
|
|
74
|
return { |
|
12
|
|
|
|
|
35
|
|
|
12
|
|
|
|
|
15262
|
|
60
|
7
|
|
|
7
|
|
15
|
BUILD => [ |
61
|
7
|
|
33
|
|
|
45
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
62
|
7
|
|
|
|
|
67
|
map { "$_\::BUILD" } reverse @$linear_isa |
63
|
|
|
|
|
|
|
], |
64
|
|
|
|
|
|
|
DEMOLISH => [ |
65
|
7
|
50
|
|
|
|
14
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
7
|
|
|
|
|
45
|
|
|
7
|
|
|
|
|
39
|
|
66
|
7
|
|
|
|
|
30
|
map { "$_\::DEMOLISH" } @$linear_isa |
67
|
|
|
|
|
|
|
], |
68
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
69
|
7
|
50
|
|
|
|
18
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
7
|
|
|
|
|
138
|
|
|
0
|
|
|
|
|
0
|
|
70
|
7
|
|
|
|
|
24
|
}; |
|
7
|
|
|
|
|
24
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
74
|
|
|
|
|
|
|
my $class = ref( $_[0] ) ? ref(shift) : shift; |
75
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
76
|
|
|
|
|
|
|
my $self = bless {}, $class; |
77
|
|
|
|
|
|
|
my $args = |
78
|
|
|
|
|
|
|
$meta->{HAS_BUILDARGS} |
79
|
9
|
50
|
|
9
|
0
|
53
|
? $class->BUILDARGS(@_) |
80
|
9
|
|
66
|
|
|
67
|
: { ( @_ == 1 ) ? %{ $_[0] } : @_ }; |
81
|
9
|
|
|
|
|
32
|
my $no_build = delete $args->{__no_BUILD__}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Attribute class (type: Mite::Package) |
84
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 11 |
85
|
9
|
50
|
|
|
|
66
|
if ( exists $args->{"class"} ) { |
|
0
|
50
|
|
|
|
0
|
|
86
|
9
|
|
|
|
|
24
|
blessed( $args->{"class"} ) |
87
|
|
|
|
|
|
|
&& $args->{"class"}->isa("Mite::Package") |
88
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
89
|
|
|
|
|
|
|
"class", "Mite::Package"; |
90
|
9
|
50
|
|
|
|
39
|
$self->{"class"} = $args->{"class"}; |
91
|
|
|
|
|
|
|
} |
92
|
9
|
50
|
33
|
|
|
149
|
require Scalar::Util && Scalar::Util::weaken( $self->{"class"} ) |
93
|
|
|
|
|
|
|
if ref $self->{"class"}; |
94
|
|
|
|
|
|
|
|
95
|
9
|
|
|
|
|
43
|
# Attribute method_name (type: Str) |
96
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 22 |
97
|
|
|
|
|
|
|
croak "Missing key in constructor: method_name" |
98
|
9
|
50
|
33
|
|
|
172
|
unless exists $args->{"method_name"}; |
99
|
|
|
|
|
|
|
do { |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
defined( $args->{"method_name"} ) and do { |
102
|
|
|
|
|
|
|
ref( \$args->{"method_name"} ) eq 'SCALAR' |
103
|
9
|
50
|
|
|
|
38
|
or ref( \( my $val = $args->{"method_name"} ) ) eq 'SCALAR'; |
104
|
9
|
50
|
|
|
|
19
|
} |
105
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
106
|
|
|
|
|
|
|
"method_name", "Str"; |
107
|
9
|
50
|
|
|
|
56
|
$self->{"method_name"} = $args->{"method_name"}; |
108
|
|
|
|
|
|
|
|
109
|
9
|
50
|
|
|
|
74
|
# Attribute named (type: ArrayRef) |
110
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 27 |
111
|
|
|
|
|
|
|
if ( exists $args->{"named"} ) { |
112
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
113
|
|
|
|
|
|
|
"named", "ArrayRef"; |
114
|
9
|
|
|
|
|
29
|
$self->{"named"} = $args->{"named"}; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# Attribute positional (type: ArrayRef) |
118
|
9
|
100
|
|
|
|
30
|
# has declaration, file lib/Mite/Signature.pm, line 32 |
119
|
6
|
50
|
|
|
|
13
|
my $args_for_positional = {}; |
|
6
|
|
|
|
|
25
|
|
120
|
|
|
|
|
|
|
for ( "positional", "pos" ) { |
121
|
|
|
|
|
|
|
next unless exists $args->{$_}; |
122
|
6
|
|
|
|
|
16
|
$args_for_positional->{"positional"} = $args->{$_}; |
123
|
|
|
|
|
|
|
last; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
if ( exists $args_for_positional->{"positional"} ) { |
126
|
|
|
|
|
|
|
do { |
127
|
9
|
|
|
|
|
20
|
|
128
|
9
|
|
|
|
|
26
|
ref( $args_for_positional->{"positional"} ) eq 'ARRAY'; |
129
|
18
|
100
|
|
|
|
66
|
or croak "Type check failed in constructor: %s should be %s", |
130
|
3
|
|
|
|
|
10
|
"positional", "ArrayRef"; |
131
|
3
|
|
|
|
|
9
|
$self->{"positional"} = $args_for_positional->{"positional"}; |
132
|
|
|
|
|
|
|
} |
133
|
9
|
100
|
|
|
|
34
|
|
134
|
3
|
50
|
|
|
|
5
|
# Attribute method (type: Bool) |
135
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 38 |
136
|
|
|
|
|
|
|
do { |
137
|
3
|
|
|
|
|
12
|
my $value = exists( $args->{"method"} ) ? $args->{"method"} : true; |
138
|
|
|
|
|
|
|
( |
139
|
|
|
|
|
|
|
!ref $value |
140
|
|
|
|
|
|
|
and (!defined $value |
141
|
3
|
|
|
|
|
10
|
or $value eq q() |
142
|
|
|
|
|
|
|
or $value eq '0' |
143
|
|
|
|
|
|
|
or $value eq '1' ) |
144
|
|
|
|
|
|
|
) |
145
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
146
|
9
|
|
|
|
|
19
|
"method", "Bool"; |
147
|
9
|
100
|
|
|
|
33
|
$self->{"method"} = $value; |
148
|
|
|
|
|
|
|
}; |
149
|
9
|
50
|
66
|
|
|
107
|
|
|
|
|
66
|
|
|
|
|
150
|
|
|
|
|
|
|
# Attribute head (type: ArrayRef|Int) |
151
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 46 |
152
|
|
|
|
|
|
|
if ( exists $args->{"head"} ) { |
153
|
|
|
|
|
|
|
do { |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
( |
156
|
|
|
|
|
|
|
or ( |
157
|
9
|
|
|
|
|
29
|
do { |
158
|
|
|
|
|
|
|
my $tmp = $args->{"head"}; |
159
|
|
|
|
|
|
|
defined($tmp) |
160
|
|
|
|
|
|
|
and !ref($tmp) |
161
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
162
|
9
|
100
|
|
|
|
29
|
} |
163
|
1
|
50
|
|
|
|
4
|
) |
164
|
|
|
|
|
|
|
); |
165
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
166
|
|
|
|
|
|
|
"head", "ArrayRef|Int"; |
167
|
1
|
|
|
|
|
6
|
$self->{"head"} = $args->{"head"}; |
168
|
|
|
|
|
|
|
} |
169
|
1
|
50
|
|
|
|
2
|
|
170
|
0
|
|
|
|
|
0
|
# Attribute tail (type: ArrayRef|Int) |
171
|
0
|
0
|
0
|
|
|
0
|
# has declaration, file lib/Mite/Signature.pm, line 48 |
172
|
|
|
|
|
|
|
if ( exists $args->{"tail"} ) { |
173
|
|
|
|
|
|
|
do { |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
( |
176
|
|
|
|
|
|
|
or ( |
177
|
|
|
|
|
|
|
do { |
178
|
|
|
|
|
|
|
my $tmp = $args->{"tail"}; |
179
|
|
|
|
|
|
|
defined($tmp) |
180
|
1
|
|
|
|
|
4
|
and !ref($tmp) |
181
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
) |
184
|
|
|
|
|
|
|
); |
185
|
9
|
50
|
|
|
|
30
|
or croak "Type check failed in constructor: %s should be %s", |
186
|
0
|
0
|
|
|
|
0
|
"tail", "ArrayRef|Int"; |
187
|
|
|
|
|
|
|
$self->{"tail"} = $args->{"tail"}; |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
0
|
# Attribute named_to_list (type: Bool|ArrayRef) |
191
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 52 |
192
|
0
|
0
|
|
|
|
0
|
do { |
193
|
0
|
|
|
|
|
0
|
my $value = |
194
|
0
|
0
|
0
|
|
|
0
|
exists( $args->{"named_to_list"} ) |
195
|
|
|
|
|
|
|
? $args->{"named_to_list"} |
196
|
|
|
|
|
|
|
: ""; |
197
|
|
|
|
|
|
|
do { |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
( |
200
|
|
|
|
|
|
|
( |
201
|
|
|
|
|
|
|
!ref $value |
202
|
|
|
|
|
|
|
and (!defined $value |
203
|
0
|
|
|
|
|
0
|
or $value eq q() |
204
|
|
|
|
|
|
|
or $value eq '0' |
205
|
|
|
|
|
|
|
or $value eq '1' ) |
206
|
|
|
|
|
|
|
) |
207
|
|
|
|
|
|
|
or ( ref($value) eq 'ARRAY' ) |
208
|
9
|
|
|
|
|
22
|
); |
209
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
210
|
|
|
|
|
|
|
"named_to_list", "Bool|ArrayRef"; |
211
|
9
|
100
|
|
|
|
28
|
$self->{"named_to_list"} = $value; |
212
|
|
|
|
|
|
|
}; |
213
|
9
|
50
|
|
|
|
25
|
|
214
|
|
|
|
|
|
|
# Call BUILD methods |
215
|
|
|
|
|
|
|
$self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } ); |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# Unrecognized parameters |
218
|
9
|
50
|
66
|
|
|
103
|
my @unknown = grep not( |
|
|
|
66
|
|
|
|
|
219
|
|
|
|
|
|
|
/\A(?:class|head|method(?:_name)?|named(?:_to_list)?|pos(?:itional)?|tail)\z/ |
220
|
|
|
|
|
|
|
), keys %{$args}; |
221
|
|
|
|
|
|
|
@unknown |
222
|
|
|
|
|
|
|
and croak( |
223
|
|
|
|
|
|
|
"Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
return $self; |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
229
|
9
|
|
|
|
|
26
|
my $class = ref( $_[0] ); |
230
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
231
|
|
|
|
|
|
|
$_->(@_) for @{ $meta->{BUILD} || [] }; |
232
|
|
|
|
|
|
|
} |
233
|
9
|
50
|
33
|
|
|
44
|
|
|
9
|
50
|
|
|
|
87
|
|
234
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
235
|
|
|
|
|
|
|
my $self = shift; |
236
|
|
|
|
|
|
|
my $class = ref($self) || $self; |
237
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
238
|
9
|
|
|
|
|
22
|
my $in_global_destruction = |
|
9
|
|
|
|
|
101
|
|
239
|
|
|
|
|
|
|
defined ${^GLOBAL_PHASE} |
240
|
9
|
50
|
|
|
|
45
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
241
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
242
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
243
|
9
|
|
|
|
|
90
|
my $e = do { |
244
|
|
|
|
|
|
|
local ( $?, $@ ); |
245
|
|
|
|
|
|
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
246
|
|
|
|
|
|
|
$@; |
247
|
|
|
|
|
|
|
}; |
248
|
9
|
|
|
9
|
0
|
23
|
no warnings 'misc'; # avoid (in cleanup) warnings |
249
|
9
|
|
33
|
|
|
55
|
die $e if $e; # rethrow |
250
|
9
|
50
|
|
|
|
22
|
} |
|
9
|
|
|
|
|
63
|
|
251
|
|
|
|
|
|
|
return; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} |
255
|
0
|
|
|
0
|
|
0
|
&& eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
256
|
0
|
|
0
|
|
|
0
|
|
257
|
0
|
|
0
|
|
|
0
|
# Accessors for class |
258
|
0
|
0
|
|
|
|
0
|
# has declaration, file lib/Mite/Signature.pm, line 11 |
259
|
|
|
|
|
|
|
if ($__XS) { |
260
|
|
|
|
|
|
|
Class::XSAccessor->import( |
261
|
|
|
|
|
|
|
chained => 1, |
262
|
0
|
0
|
|
|
|
0
|
"getters" => { "class" => "class" }, |
|
0
|
|
|
|
|
0
|
|
263
|
0
|
|
|
|
|
0
|
); |
264
|
0
|
|
|
|
|
0
|
} |
265
|
0
|
|
|
|
|
0
|
else { |
|
0
|
|
|
|
|
0
|
|
266
|
0
|
|
|
|
|
0
|
*class = sub { |
267
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "class" usage: $self->class()'); |
268
|
12
|
|
|
12
|
|
116
|
$_[0]{"class"}; |
|
12
|
|
|
|
|
27
|
|
|
12
|
|
|
|
|
21417
|
|
269
|
0
|
0
|
|
|
|
0
|
}; |
270
|
|
|
|
|
|
|
} |
271
|
0
|
|
|
|
|
0
|
|
272
|
|
|
|
|
|
|
# Accessors for compiler |
273
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 57 |
274
|
|
|
|
|
|
|
my $object = do { |
275
|
|
|
|
|
|
|
( |
276
|
|
|
|
|
|
|
exists( $_[0]{"compiler"} ) ? $_[0]{"compiler"} : ( |
277
|
|
|
|
|
|
|
$_[0]{"compiler"} = do { |
278
|
|
|
|
|
|
|
my $default_value = $_[0]->_build_compiler; |
279
|
|
|
|
|
|
|
blessed($default_value) |
280
|
|
|
|
|
|
|
or croak( |
281
|
|
|
|
|
|
|
"Type check failed in default: %s should be %s", |
282
|
|
|
|
|
|
|
"compiler", "Object" ); |
283
|
|
|
|
|
|
|
$default_value; |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
) |
286
|
|
|
|
|
|
|
) |
287
|
|
|
|
|
|
|
}; |
288
|
|
|
|
|
|
|
blessed($object) or croak("compiler is not a blessed object"); |
289
|
|
|
|
|
|
|
$object; |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "compiler" usage: $self->compiler()'); |
293
|
|
|
|
|
|
|
( |
294
|
|
|
|
|
|
|
exists( $_[0]{"compiler"} ) ? $_[0]{"compiler"} : ( |
295
|
2
|
|
|
2
|
|
4
|
$_[0]{"compiler"} = do { |
296
|
|
|
|
|
|
|
my $default_value = $_[0]->_build_compiler; |
297
|
|
|
|
|
|
|
blessed($default_value) |
298
|
2
|
100
|
|
|
|
6
|
or croak( "Type check failed in default: %s should be %s", |
299
|
1
|
|
|
|
|
3
|
"compiler", "Object" ); |
300
|
1
|
50
|
|
|
|
6
|
$default_value; |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
) |
303
|
|
|
|
|
|
|
); |
304
|
1
|
|
|
|
|
6
|
} |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
# Delegated methods for compiler |
307
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 57 |
308
|
|
|
|
|
|
|
|
309
|
2
|
50
|
|
|
|
10
|
# Accessors for compiling_class |
310
|
2
|
|
|
|
|
12
|
# has declaration, file lib/Mite/Signature.pm, line 16 |
311
|
|
|
|
|
|
|
@_ > 1 |
312
|
|
|
|
|
|
|
? do { |
313
|
|
|
|
|
|
|
blessed( $_[1] ) && $_[1]->isa("Mite::Package") |
314
|
14
|
50
|
|
14
|
0
|
49
|
or croak( "Type check failed in %s: value should be %s", |
315
|
|
|
|
|
|
|
"accessor", "Mite::Package" ); |
316
|
|
|
|
|
|
|
$_[0]{"compiling_class"} = $_[1]; |
317
|
14
|
100
|
|
|
|
80
|
$_[0]; |
318
|
8
|
|
|
|
|
48
|
} |
319
|
8
|
50
|
|
|
|
52
|
: ( $_[0]{"compiling_class"} ); |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
|
322
|
8
|
|
|
|
|
46
|
defined wantarray |
323
|
|
|
|
|
|
|
or croak("This method cannot be called in void context"); |
324
|
|
|
|
|
|
|
my $get = "compiling_class"; |
325
|
|
|
|
|
|
|
my $set = "compiling_class"; |
326
|
|
|
|
|
|
|
my $has = sub { exists $_[0]{"compiling_class"} }; |
327
|
|
|
|
|
|
|
my $clear = sub { delete $_[0]{"compiling_class"}; $_[0]; }; |
328
|
|
|
|
|
|
|
my $old = undef; |
329
|
|
|
|
|
|
|
my ( $self, $new ) = @_; |
330
|
0
|
|
|
0
|
0
|
0
|
my $restorer = $self->$has |
331
|
2
|
|
|
2
|
0
|
16
|
? do { |
332
|
0
|
|
|
0
|
0
|
0
|
$old = $self->$get; |
333
|
|
|
|
|
|
|
sub { $self->$set($old) } |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
: sub { $self->$clear }; |
336
|
|
|
|
|
|
|
@_ == 2 ? $self->$set($new) : $self->$clear; |
337
|
|
|
|
|
|
|
&guard( $restorer, $old ); |
338
|
|
|
|
|
|
|
} |
339
|
10
|
50
|
33
|
|
|
138
|
|
340
|
|
|
|
|
|
|
# Accessors for head |
341
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 46 |
342
|
10
|
|
|
|
|
35
|
@_ == 1 or croak('Reader "head" usage: $self->head()'); |
343
|
10
|
|
|
|
|
23
|
( |
344
|
|
|
|
|
|
|
exists( $_[0]{"head"} ) ? $_[0]{"head"} : ( |
345
|
59
|
100
|
|
59
|
0
|
359
|
$_[0]{"head"} = do { |
346
|
|
|
|
|
|
|
my $default_value = $_[0]->_build_head; |
347
|
|
|
|
|
|
|
do { |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
( |
350
|
10
|
50
|
|
10
|
0
|
41
|
( ref($default_value) eq 'ARRAY' ) or ( |
351
|
10
|
|
|
|
|
23
|
do { |
352
|
10
|
|
|
|
|
56
|
my $tmp = $default_value; |
353
|
10
|
|
|
10
|
|
53
|
defined($tmp) |
|
10
|
|
|
|
|
73
|
|
354
|
10
|
|
|
10
|
|
56
|
and !ref($tmp) |
|
10
|
|
|
|
|
32
|
|
|
10
|
|
|
|
|
81
|
|
355
|
10
|
|
|
|
|
37
|
and $tmp =~ /\A-?[0-9]+\z/; |
356
|
10
|
|
|
|
|
37
|
} |
357
|
|
|
|
|
|
|
) |
358
|
|
|
|
|
|
|
); |
359
|
0
|
|
|
|
|
0
|
or croak( "Type check failed in default: %s should be %s", |
360
|
0
|
|
|
0
|
|
0
|
"head", "ArrayRef|Int" ); |
361
|
0
|
|
|
|
|
0
|
$default_value; |
362
|
10
|
50
|
|
10
|
|
48
|
} |
|
10
|
|
|
|
|
48
|
|
363
|
10
|
50
|
|
|
|
81
|
) |
364
|
10
|
|
|
|
|
65
|
); |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
# Accessors for method |
368
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 38 |
369
|
|
|
|
|
|
|
if ($__XS) { |
370
|
18
|
50
|
|
18
|
0
|
68
|
Class::XSAccessor->import( |
371
|
|
|
|
|
|
|
chained => 1, |
372
|
|
|
|
|
|
|
"getters" => { "method" => "method" }, |
373
|
18
|
100
|
|
|
|
150
|
); |
374
|
8
|
|
|
|
|
50
|
} |
375
|
8
|
50
|
|
|
|
65
|
else { |
376
|
|
|
|
|
|
|
*method = sub { |
377
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "method" usage: $self->method()'); |
378
|
|
|
|
|
|
|
$_[0]{"method"}; |
379
|
|
|
|
|
|
|
}; |
380
|
8
|
50
|
|
|
|
57
|
} |
381
|
0
|
|
|
|
|
0
|
|
382
|
0
|
0
|
0
|
|
|
0
|
# Accessors for method_name |
383
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 22 |
384
|
|
|
|
|
|
|
if ($__XS) { |
385
|
|
|
|
|
|
|
Class::XSAccessor->import( |
386
|
|
|
|
|
|
|
chained => 1, |
387
|
|
|
|
|
|
|
"getters" => { "method_name" => "method_name" }, |
388
|
|
|
|
|
|
|
); |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
else { |
391
|
8
|
|
|
|
|
74
|
*method_name = sub { |
392
|
|
|
|
|
|
|
@_ == 1 |
393
|
|
|
|
|
|
|
or croak('Reader "method_name" usage: $self->method_name()'); |
394
|
|
|
|
|
|
|
$_[0]{"method_name"}; |
395
|
|
|
|
|
|
|
}; |
396
|
|
|
|
|
|
|
} |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
# Accessors for named |
399
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 27 |
400
|
|
|
|
|
|
|
if ($__XS) { |
401
|
|
|
|
|
|
|
Class::XSAccessor->import( |
402
|
|
|
|
|
|
|
chained => 1, |
403
|
|
|
|
|
|
|
"exists_predicates" => { "is_named" => "named" }, |
404
|
|
|
|
|
|
|
"getters" => { "named" => "named" }, |
405
|
|
|
|
|
|
|
); |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
else { |
408
|
|
|
|
|
|
|
*is_named = sub { |
409
|
|
|
|
|
|
|
@_ == 1 or croak('Predicate "is_named" usage: $self->is_named()'); |
410
|
|
|
|
|
|
|
exists $_[0]{"named"}; |
411
|
|
|
|
|
|
|
}; |
412
|
|
|
|
|
|
|
*named = sub { |
413
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "named" usage: $self->named()'); |
414
|
|
|
|
|
|
|
$_[0]{"named"}; |
415
|
|
|
|
|
|
|
}; |
416
|
|
|
|
|
|
|
} |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
# Accessors for named_to_list |
419
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 52 |
420
|
|
|
|
|
|
|
if ($__XS) { |
421
|
|
|
|
|
|
|
Class::XSAccessor->import( |
422
|
|
|
|
|
|
|
chained => 1, |
423
|
|
|
|
|
|
|
"getters" => { "named_to_list" => "named_to_list" }, |
424
|
|
|
|
|
|
|
); |
425
|
|
|
|
|
|
|
} |
426
|
|
|
|
|
|
|
else { |
427
|
|
|
|
|
|
|
*named_to_list = sub { |
428
|
|
|
|
|
|
|
@_ == 1 |
429
|
|
|
|
|
|
|
or croak('Reader "named_to_list" usage: $self->named_to_list()'); |
430
|
|
|
|
|
|
|
$_[0]{"named_to_list"}; |
431
|
|
|
|
|
|
|
}; |
432
|
|
|
|
|
|
|
} |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
# Accessors for positional |
435
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 32 |
436
|
|
|
|
|
|
|
if ($__XS) { |
437
|
|
|
|
|
|
|
Class::XSAccessor->import( |
438
|
|
|
|
|
|
|
chained => 1, |
439
|
|
|
|
|
|
|
"exists_predicates" => { "is_positional" => "positional" }, |
440
|
|
|
|
|
|
|
"getters" => { "positional" => "positional" }, |
441
|
|
|
|
|
|
|
); |
442
|
|
|
|
|
|
|
} |
443
|
|
|
|
|
|
|
else { |
444
|
|
|
|
|
|
|
*is_positional = sub { |
445
|
|
|
|
|
|
|
@_ == 1 |
446
|
|
|
|
|
|
|
or |
447
|
|
|
|
|
|
|
croak('Predicate "is_positional" usage: $self->is_positional()'); |
448
|
|
|
|
|
|
|
exists $_[0]{"positional"}; |
449
|
|
|
|
|
|
|
}; |
450
|
|
|
|
|
|
|
*positional = sub { |
451
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "positional" usage: $self->positional()'); |
452
|
|
|
|
|
|
|
$_[0]{"positional"}; |
453
|
|
|
|
|
|
|
}; |
454
|
|
|
|
|
|
|
} |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
# Aliases for positional |
457
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 32 |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
# Accessors for should_bless |
460
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 68 |
461
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "should_bless" usage: $self->should_bless()'); |
462
|
|
|
|
|
|
|
( |
463
|
|
|
|
|
|
|
exists( $_[0]{"should_bless"} ) ? $_[0]{"should_bless"} : ( |
464
|
|
|
|
|
|
|
$_[0]{"should_bless"} = do { |
465
|
|
|
|
|
|
|
my $default_value = $_[0]->_build_should_bless; |
466
|
|
|
|
|
|
|
( |
467
|
|
|
|
|
|
|
!ref $default_value |
468
|
|
|
|
|
|
|
and (!defined $default_value |
469
|
|
|
|
|
|
|
or $default_value eq q() |
470
|
|
|
|
|
|
|
or $default_value eq '0' |
471
|
|
|
|
|
|
|
or $default_value eq '1' ) |
472
|
|
|
|
|
|
|
) |
473
|
|
|
|
|
|
|
or croak( "Type check failed in default: %s should be %s", |
474
|
|
|
|
|
|
|
"should_bless", "Bool" ); |
475
|
|
|
|
|
|
|
$default_value; |
476
|
|
|
|
|
|
|
} |
477
|
|
|
|
|
|
|
) |
478
|
|
|
|
|
|
|
); |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
# Accessors for tail |
482
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Signature.pm, line 48 |
483
|
|
|
|
|
|
|
if ($__XS) { |
484
|
|
|
|
|
|
|
Class::XSAccessor->import( |
485
|
|
|
|
|
|
|
chained => 1, |
486
|
|
|
|
|
|
|
"getters" => { "tail" => "tail" }, |
487
|
|
|
|
|
|
|
); |
488
|
0
|
|
|
0
|
0
|
0
|
} |
489
|
|
|
|
|
|
|
else { |
490
|
|
|
|
|
|
|
*tail = sub { |
491
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "tail" usage: $self->tail()'); |
492
|
|
|
|
|
|
|
$_[0]{"tail"}; |
493
|
18
|
50
|
|
18
|
0
|
412
|
}; |
494
|
|
|
|
|
|
|
} |
495
|
|
|
|
|
|
|
|
496
|
18
|
100
|
|
|
|
159
|
# See UNIVERSAL |
497
|
9
|
|
|
|
|
52
|
my ( $self, $role ) = @_; |
498
|
|
|
|
|
|
|
our %DOES; |
499
|
9
|
50
|
66
|
|
|
118
|
return $DOES{$role} if exists $DOES{$role}; |
|
|
|
66
|
|
|
|
|
500
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
501
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} |
502
|
|
|
|
|
|
|
and my $meta = Moose::Util::find_meta( ref $self or $self ) ) |
503
|
|
|
|
|
|
|
{ |
504
|
|
|
|
|
|
|
$meta->can('does_role') and $meta->does_role($role) and return 1; |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
return $self->SUPER::DOES($role); |
507
|
9
|
|
|
|
|
212
|
} |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
510
|
|
|
|
|
|
|
shift->DOES(@_); |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
1; |