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