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