line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Mite::Project; |
4
|
107
|
|
|
107
|
|
1062
|
use strict; |
|
107
|
|
|
|
|
423
|
|
|
107
|
|
|
|
|
4155
|
|
5
|
107
|
|
|
107
|
|
975
|
use warnings; |
|
107
|
|
|
|
|
581
|
|
|
107
|
|
|
|
|
4456
|
|
6
|
107
|
|
|
107
|
|
840
|
no warnings qw( once void ); |
|
107
|
|
|
|
|
423
|
|
|
107
|
|
|
|
|
23142
|
|
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
|
107
|
|
|
107
|
|
836
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "Mite::Project" ); |
15
|
|
|
|
|
|
|
( |
16
|
|
|
|
|
|
|
*after, *around, *before, *extends, *field, |
17
|
|
|
|
|
|
|
*has, *param, *signature_for, *with |
18
|
|
|
|
|
|
|
) |
19
|
107
|
|
|
|
|
408
|
= do { |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package Mite::Shim; |
22
|
107
|
|
|
107
|
|
1154
|
no warnings 'redefine'; |
|
107
|
|
|
|
|
437
|
|
|
107
|
|
|
|
|
28093
|
|
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
|
428
|
|
|
428
|
|
225738
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
30
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
31
|
321
|
|
|
321
|
|
115689
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
32
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
33
|
107
|
|
|
|
|
22119
|
); |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Mite imports |
38
|
|
|
|
|
|
|
BEGIN { |
39
|
107
|
|
|
107
|
|
1020
|
require Scalar::Util; |
40
|
107
|
|
|
|
|
577
|
*STRICT = \&Mite::Shim::STRICT; |
41
|
107
|
|
|
|
|
543
|
*bare = \&Mite::Shim::bare; |
42
|
107
|
|
|
|
|
433
|
*blessed = \&Scalar::Util::blessed; |
43
|
107
|
|
|
|
|
443
|
*carp = \&Mite::Shim::carp; |
44
|
107
|
|
|
|
|
412
|
*confess = \&Mite::Shim::confess; |
45
|
107
|
|
|
|
|
364
|
*croak = \&Mite::Shim::croak; |
46
|
107
|
|
|
|
|
383
|
*false = \&Mite::Shim::false; |
47
|
107
|
|
|
|
|
455
|
*guard = \&Mite::Shim::guard; |
48
|
107
|
|
|
|
|
325
|
*lazy = \&Mite::Shim::lazy; |
49
|
107
|
|
|
|
|
406
|
*lock = \&Mite::Shim::lock; |
50
|
107
|
|
|
|
|
636
|
*ro = \&Mite::Shim::ro; |
51
|
107
|
|
|
|
|
351
|
*rw = \&Mite::Shim::rw; |
52
|
107
|
|
|
|
|
328
|
*rwp = \&Mite::Shim::rwp; |
53
|
107
|
|
|
|
|
336
|
*true = \&Mite::Shim::true; |
54
|
107
|
|
|
|
|
3437
|
*unlock = \&Mite::Shim::unlock; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
58
|
|
|
|
|
|
|
sub __META__ { |
59
|
107
|
|
|
107
|
|
778
|
no strict 'refs'; |
|
107
|
|
|
|
|
474
|
|
|
107
|
|
|
|
|
39325
|
|
60
|
106
|
|
|
106
|
|
375
|
my $class = shift; |
61
|
106
|
|
33
|
|
|
849
|
$class = ref($class) || $class; |
62
|
106
|
|
|
|
|
918
|
my $linear_isa = mro::get_linear_isa($class); |
63
|
|
|
|
|
|
|
return { |
64
|
|
|
|
|
|
|
BUILD => [ |
65
|
106
|
50
|
|
|
|
351
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
106
|
|
|
|
|
1865
|
|
|
0
|
|
|
|
|
0
|
|
66
|
106
|
|
|
|
|
769
|
map { "$_\::BUILD" } reverse @$linear_isa |
67
|
|
|
|
|
|
|
], |
68
|
|
|
|
|
|
|
DEMOLISH => [ |
69
|
106
|
50
|
|
|
|
354
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
106
|
|
|
|
|
3497
|
|
|
0
|
|
|
|
|
0
|
|
70
|
106
|
|
|
|
|
540
|
map { "$_\::DEMOLISH" } @$linear_isa |
|
106
|
|
|
|
|
657
|
|
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
|
109
|
50
|
|
109
|
0
|
11319
|
my $class = ref( $_[0] ) ? ref(shift) : shift; |
80
|
109
|
|
66
|
|
|
1383
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
81
|
109
|
|
|
|
|
536
|
my $self = bless {}, $class; |
82
|
|
|
|
|
|
|
my $args = |
83
|
|
|
|
|
|
|
$meta->{HAS_BUILDARGS} |
84
|
|
|
|
|
|
|
? $class->BUILDARGS(@_) |
85
|
109
|
50
|
|
|
|
1160
|
: { ( @_ == 1 ) ? %{ $_[0] } : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
86
|
109
|
|
|
|
|
425
|
my $no_build = delete $args->{__no_BUILD__}; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# Attribute sources (type: HashRef[Mite::Source]) |
89
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Project.pm, line 14 |
90
|
109
|
|
|
|
|
278
|
do { |
91
|
|
|
|
|
|
|
my $value = |
92
|
|
|
|
|
|
|
exists( $args->{"sources"} ) |
93
|
109
|
50
|
|
|
|
918
|
? $args->{"sources"} |
94
|
|
|
|
|
|
|
: $Mite::Project::__sources_DEFAULT__->($self); |
95
|
109
|
50
|
|
|
|
287
|
do { |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
package Mite::Shim; |
98
|
109
|
50
|
|
|
|
939
|
( ref($value) eq 'HASH' ) and do { |
99
|
109
|
|
|
|
|
433
|
my $ok = 1; |
100
|
109
|
|
|
|
|
326
|
for my $i ( values %{$value} ) { |
|
109
|
|
|
|
|
636
|
|
101
|
|
|
|
|
|
|
( $ok = 0, last ) |
102
|
|
|
|
|
|
|
unless ( |
103
|
0
|
0
|
|
|
|
0
|
do { |
104
|
107
|
|
|
107
|
|
1217
|
use Scalar::Util (); |
|
107
|
|
|
|
|
431
|
|
|
107
|
|
|
|
|
77867
|
|
105
|
0
|
0
|
|
|
|
0
|
Scalar::Util::blessed($i) |
106
|
|
|
|
|
|
|
and $i->isa(q[Mite::Source]); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
); |
109
|
|
|
|
|
|
|
}; |
110
|
109
|
|
|
|
|
769
|
$ok; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
114
|
|
|
|
|
|
|
"sources", "HashRef[Mite::Source]"; |
115
|
109
|
|
|
|
|
883
|
$self->{"sources"} = $value; |
116
|
|
|
|
|
|
|
}; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# Attribute config (type: Mite::Config) |
119
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Project.pm, line 24 |
120
|
109
|
50
|
|
|
|
655
|
if ( exists $args->{"config"} ) { |
121
|
|
|
|
|
|
|
blessed( $args->{"config"} ) |
122
|
0
|
0
|
0
|
|
|
0
|
&& $args->{"config"}->isa("Mite::Config") |
123
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
124
|
|
|
|
|
|
|
"config", "Mite::Config"; |
125
|
0
|
|
|
|
|
0
|
$self->{"config"} = $args->{"config"}; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Attribute _module_fakeout_namespace (type: Str|Undef) |
129
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Project.pm, line 26 |
130
|
109
|
50
|
|
|
|
670
|
if ( exists $args->{"_module_fakeout_namespace"} ) { |
131
|
0
|
0
|
|
|
|
0
|
do { |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
package Mite::Shim; |
134
|
|
|
|
|
|
|
( |
135
|
|
|
|
|
|
|
do { |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
package Mite::Shim; |
138
|
0
|
0
|
|
|
|
0
|
defined( $args->{"_module_fakeout_namespace"} ) and do { |
139
|
|
|
|
|
|
|
ref( \$args->{"_module_fakeout_namespace"} ) eq |
140
|
|
|
|
|
|
|
'SCALAR' |
141
|
|
|
|
|
|
|
or ref( |
142
|
|
|
|
|
|
|
\( |
143
|
|
|
|
|
|
|
my $val = |
144
|
0
|
0
|
|
|
|
0
|
$args->{"_module_fakeout_namespace"} |
145
|
|
|
|
|
|
|
) |
146
|
|
|
|
|
|
|
) eq 'SCALAR'; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
} |
149
|
0
|
0
|
|
|
|
0
|
or do { |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
package Mite::Shim; |
152
|
0
|
|
|
|
|
0
|
!defined( $args->{"_module_fakeout_namespace"} ); |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
); |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
157
|
|
|
|
|
|
|
"_module_fakeout_namespace", "Str|Undef"; |
158
|
|
|
|
|
|
|
$self->{"_module_fakeout_namespace"} = |
159
|
0
|
|
|
|
|
0
|
$args->{"_module_fakeout_namespace"}; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
# Attribute debug (type: Bool) |
163
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Project.pm, line 30 |
164
|
109
|
|
|
|
|
353
|
do { |
165
|
109
|
50
|
|
|
|
670
|
my $value = exists( $args->{"debug"} ) ? $args->{"debug"} : false; |
166
|
|
|
|
|
|
|
( |
167
|
109
|
0
|
33
|
|
|
1831
|
!ref $value |
|
|
|
33
|
|
|
|
|
168
|
|
|
|
|
|
|
and (!defined $value |
169
|
|
|
|
|
|
|
or $value eq q() |
170
|
|
|
|
|
|
|
or $value eq '0' |
171
|
|
|
|
|
|
|
or $value eq '1' ) |
172
|
|
|
|
|
|
|
) |
173
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
174
|
|
|
|
|
|
|
"debug", "Bool"; |
175
|
109
|
|
|
|
|
507
|
$self->{"debug"} = $value; |
176
|
|
|
|
|
|
|
}; |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
# Call BUILD methods |
179
|
109
|
50
|
33
|
|
|
920
|
$self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } ); |
|
109
|
50
|
|
|
|
1162
|
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
# Unrecognized parameters |
182
|
|
|
|
|
|
|
my @unknown = |
183
|
|
|
|
|
|
|
grep not(/\A(?:_module_fakeout_namespace|config|debug|sources)\z/), |
184
|
109
|
|
|
|
|
361
|
keys %{$args}; |
|
109
|
|
|
|
|
528
|
|
185
|
|
|
|
|
|
|
@unknown |
186
|
109
|
50
|
|
|
|
558
|
and croak( |
187
|
|
|
|
|
|
|
"Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
188
|
|
|
|
|
|
|
|
189
|
109
|
|
|
|
|
959
|
return $self; |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
193
|
|
|
|
|
|
|
sub BUILDALL { |
194
|
0
|
|
|
0
|
0
|
0
|
my $class = ref( $_[0] ); |
195
|
0
|
|
0
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
196
|
0
|
0
|
|
|
|
0
|
$_->(@_) for @{ $meta->{BUILD} || [] }; |
|
0
|
|
|
|
|
0
|
|
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
200
|
|
|
|
|
|
|
sub DESTROY { |
201
|
5
|
|
|
5
|
|
2774
|
my $self = shift; |
202
|
5
|
|
33
|
|
|
32
|
my $class = ref($self) || $self; |
203
|
5
|
|
33
|
|
|
30
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
204
|
5
|
50
|
|
|
|
31
|
my $in_global_destruction = |
205
|
|
|
|
|
|
|
defined ${^GLOBAL_PHASE} |
206
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
207
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
208
|
5
|
50
|
|
|
|
13
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
|
5
|
|
|
|
|
30
|
|
209
|
0
|
|
|
|
|
0
|
my $e = do { |
210
|
0
|
|
|
|
|
0
|
local ( $?, $@ ); |
211
|
0
|
|
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
|
0
|
|
|
|
|
0
|
|
212
|
0
|
|
|
|
|
0
|
$@; |
213
|
|
|
|
|
|
|
}; |
214
|
107
|
|
|
107
|
|
1138
|
no warnings 'misc'; # avoid (in cleanup) warnings |
|
107
|
|
|
|
|
439
|
|
|
107
|
|
|
|
|
95484
|
|
215
|
0
|
0
|
|
|
|
0
|
die $e if $e; # rethrow |
216
|
|
|
|
|
|
|
} |
217
|
5
|
|
|
|
|
38
|
return; |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} |
221
|
|
|
|
|
|
|
&& eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
# Accessors for _module_fakeout_namespace |
224
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Project.pm, line 26 |
225
|
|
|
|
|
|
|
sub _module_fakeout_namespace { |
226
|
|
|
|
|
|
|
@_ > 1 |
227
|
|
|
|
|
|
|
? do { |
228
|
0
|
0
|
|
|
|
0
|
do { |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
package Mite::Shim; |
231
|
|
|
|
|
|
|
( |
232
|
0
|
0
|
|
|
|
0
|
do { |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
package Mite::Shim; |
235
|
0
|
0
|
|
|
|
0
|
defined( $_[1] ) and do { |
236
|
0
|
0
|
|
|
|
0
|
ref( \$_[1] ) eq 'SCALAR' |
237
|
|
|
|
|
|
|
or ref( \( my $val = $_[1] ) ) eq 'SCALAR'; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
or ( !defined( $_[1] ) ) |
241
|
|
|
|
|
|
|
); |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
or croak( "Type check failed in %s: value should be %s", |
244
|
|
|
|
|
|
|
"accessor", "Str|Undef" ); |
245
|
0
|
|
|
|
|
0
|
$_[0]{"_module_fakeout_namespace"} = $_[1]; |
246
|
0
|
|
|
|
|
0
|
$_[0]; |
247
|
|
|
|
|
|
|
} |
248
|
515
|
50
|
|
515
|
|
3779
|
: ( $_[0]{"_module_fakeout_namespace"} ); |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
# Accessors for config |
252
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Project.pm, line 24 |
253
|
|
|
|
|
|
|
sub config { |
254
|
935
|
50
|
|
935
|
0
|
3486
|
@_ == 1 or croak('Reader "config" usage: $self->config()'); |
255
|
|
|
|
|
|
|
( |
256
|
|
|
|
|
|
|
exists( $_[0]{"config"} ) ? $_[0]{"config"} : ( |
257
|
935
|
100
|
|
|
|
6045
|
$_[0]{"config"} = do { |
258
|
104
|
|
|
|
|
718
|
my $default_value = |
259
|
|
|
|
|
|
|
$Mite::Project::__config_DEFAULT__->( $_[0] ); |
260
|
104
|
50
|
33
|
|
|
2110
|
blessed($default_value) |
261
|
|
|
|
|
|
|
&& $default_value->isa("Mite::Config") |
262
|
|
|
|
|
|
|
or croak( "Type check failed in default: %s should be %s", |
263
|
|
|
|
|
|
|
"config", "Mite::Config" ); |
264
|
104
|
|
|
|
|
1329
|
$default_value; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
) |
267
|
|
|
|
|
|
|
); |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
# Accessors for debug |
271
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Project.pm, line 30 |
272
|
|
|
|
|
|
|
sub debug { |
273
|
|
|
|
|
|
|
@_ > 1 |
274
|
|
|
|
|
|
|
? do { |
275
|
|
|
|
|
|
|
( |
276
|
14
|
0
|
0
|
|
|
240
|
!ref $_[1] |
|
|
|
33
|
|
|
|
|
277
|
|
|
|
|
|
|
and (!defined $_[1] |
278
|
|
|
|
|
|
|
or $_[1] eq q() |
279
|
|
|
|
|
|
|
or $_[1] eq '0' |
280
|
|
|
|
|
|
|
or $_[1] eq '1' ) |
281
|
|
|
|
|
|
|
) |
282
|
|
|
|
|
|
|
or croak( "Type check failed in %s: value should be %s", |
283
|
|
|
|
|
|
|
"accessor", "Bool" ); |
284
|
14
|
|
|
|
|
71
|
$_[0]{"debug"} = $_[1]; |
285
|
14
|
|
|
|
|
48
|
$_[0]; |
286
|
|
|
|
|
|
|
} |
287
|
323
|
100
|
|
323
|
0
|
3711
|
: ( $_[0]{"debug"} ); |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
# Accessors for sources |
291
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Project.pm, line 14 |
292
|
|
|
|
|
|
|
if ($__XS) { |
293
|
|
|
|
|
|
|
Class::XSAccessor->import( |
294
|
|
|
|
|
|
|
chained => 1, |
295
|
|
|
|
|
|
|
"getters" => { "sources" => "sources" }, |
296
|
|
|
|
|
|
|
); |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
else { |
299
|
|
|
|
|
|
|
*sources = sub { |
300
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "sources" usage: $self->sources()'); |
301
|
|
|
|
|
|
|
$_[0]{"sources"}; |
302
|
|
|
|
|
|
|
}; |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# See UNIVERSAL |
306
|
|
|
|
|
|
|
sub DOES { |
307
|
0
|
|
|
0
|
0
|
|
my ( $self, $role ) = @_; |
308
|
0
|
|
|
|
|
|
our %DOES; |
309
|
0
|
0
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
310
|
0
|
0
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
311
|
0
|
0
|
0
|
|
|
|
if ( $INC{'Moose/Util.pm'} |
|
|
|
0
|
|
|
|
|
312
|
|
|
|
|
|
|
and my $meta = Moose::Util::find_meta( ref $self or $self ) ) |
313
|
|
|
|
|
|
|
{ |
314
|
0
|
0
|
0
|
|
|
|
$meta->can('does_role') and $meta->does_role($role) and return 1; |
315
|
|
|
|
|
|
|
} |
316
|
0
|
|
|
|
|
|
return $self->SUPER::DOES($role); |
317
|
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
320
|
|
|
|
|
|
|
sub does { |
321
|
0
|
|
|
0
|
0
|
|
shift->DOES(@_); |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
# Method signatures |
325
|
|
|
|
|
|
|
our %SIGNATURE_FOR; |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
$SIGNATURE_FOR{"_recurse_directory"} = sub { |
328
|
|
|
|
|
|
|
my $__NEXT__ = shift; |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
my ( @out, %tmp, $tmp, $dtmp, @head ); |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
@_ == 3 |
333
|
|
|
|
|
|
|
or |
334
|
|
|
|
|
|
|
croak( "Wrong number of parameters in signature for %s: got %d, %s", |
335
|
|
|
|
|
|
|
"_recurse_directory", scalar(@_), "expected exactly 3 parameters" ); |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
@head = splice( @_, 0, 1 ); |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
# Parameter invocant (type: Defined) |
340
|
|
|
|
|
|
|
( defined( $head[0] ) ) |
341
|
|
|
|
|
|
|
or croak( |
342
|
|
|
|
|
|
|
"Type check failed in signature for _recurse_directory: %s should be %s", |
343
|
|
|
|
|
|
|
"\$_[0]", "Defined" |
344
|
|
|
|
|
|
|
); |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
# Parameter $_[0] (type: Path) |
347
|
|
|
|
|
|
|
$tmp = ( |
348
|
|
|
|
|
|
|
( |
349
|
|
|
|
|
|
|
do { |
350
|
107
|
|
|
107
|
|
1250
|
use Scalar::Util (); |
|
107
|
|
|
|
|
469
|
|
|
107
|
|
|
|
|
33058
|
|
351
|
|
|
|
|
|
|
Scalar::Util::blessed( $_[0] ) |
352
|
|
|
|
|
|
|
and $_[0]->isa(q[Path::Tiny]); |
353
|
|
|
|
|
|
|
} |
354
|
|
|
|
|
|
|
) |
355
|
|
|
|
|
|
|
) ? $_[0] : ( |
356
|
|
|
|
|
|
|
do { |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
package Mite::Shim; |
359
|
|
|
|
|
|
|
defined( $_[0] ) and do { |
360
|
|
|
|
|
|
|
ref( \$_[0] ) eq 'SCALAR' |
361
|
|
|
|
|
|
|
or ref( \( my $val = $_[0] ) ) eq 'SCALAR'; |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
) |
365
|
|
|
|
|
|
|
? scalar( |
366
|
|
|
|
|
|
|
do { local $_ = $_[0]; Path::Tiny::path($_) } |
367
|
|
|
|
|
|
|
) |
368
|
|
|
|
|
|
|
: ( |
369
|
|
|
|
|
|
|
do { |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
package Mite::Shim; |
372
|
|
|
|
|
|
|
defined( $_[0] ) && !ref( $_[0] ) |
373
|
|
|
|
|
|
|
or Scalar::Util::blessed( $_[0] ) && ( |
374
|
|
|
|
|
|
|
sub { |
375
|
|
|
|
|
|
|
require overload; |
376
|
|
|
|
|
|
|
overload::Overloaded( ref $_[0] or $_[0] ) |
377
|
|
|
|
|
|
|
and overload::Method( ( ref $_[0] or $_[0] ), $_[1] ); |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
)->( $_[0], q[""] ); |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
) |
382
|
|
|
|
|
|
|
? scalar( |
383
|
|
|
|
|
|
|
do { local $_ = $_[0]; Path::Tiny::path($_) } |
384
|
|
|
|
|
|
|
) |
385
|
|
|
|
|
|
|
: ( ( ref( $_[0] ) eq 'ARRAY' ) ) ? scalar( |
386
|
|
|
|
|
|
|
do { local $_ = $_[0]; Path::Tiny::path(@$_) } |
387
|
|
|
|
|
|
|
) |
388
|
|
|
|
|
|
|
: $_[0]; |
389
|
|
|
|
|
|
|
( |
390
|
|
|
|
|
|
|
do { |
391
|
107
|
|
|
107
|
|
1019
|
use Scalar::Util (); |
|
107
|
|
|
|
|
409
|
|
|
107
|
|
|
|
|
64707
|
|
392
|
|
|
|
|
|
|
Scalar::Util::blessed($tmp) and $tmp->isa(q[Path::Tiny]); |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
) |
395
|
|
|
|
|
|
|
or croak( |
396
|
|
|
|
|
|
|
"Type check failed in signature for _recurse_directory: %s should be %s", |
397
|
|
|
|
|
|
|
"\$_[1]", "Path" |
398
|
|
|
|
|
|
|
); |
399
|
|
|
|
|
|
|
push( @out, $tmp ); |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
# Parameter $_[1] (type: CodeRef) |
402
|
|
|
|
|
|
|
( ref( $_[1] ) eq 'CODE' ) |
403
|
|
|
|
|
|
|
or croak( |
404
|
|
|
|
|
|
|
"Type check failed in signature for _recurse_directory: %s should be %s", |
405
|
|
|
|
|
|
|
"\$_[2]", "CodeRef" |
406
|
|
|
|
|
|
|
); |
407
|
|
|
|
|
|
|
push( @out, $_[1] ); |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
do { @_ = ( @head, @out ); goto $__NEXT__ }; |
410
|
|
|
|
|
|
|
}; |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
$SIGNATURE_FOR{"inject_mite_functions"} = sub { |
413
|
|
|
|
|
|
|
my $__NEXT__ = shift; |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
my ( %out, %in, %tmp, $tmp, $dtmp, @head ); |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
@_ == 2 && ( ref( $_[1] ) eq 'HASH' ) |
418
|
|
|
|
|
|
|
or @_ % 2 == 1 && @_ >= 7 && @_ <= 15 |
419
|
|
|
|
|
|
|
or |
420
|
|
|
|
|
|
|
croak( "Wrong number of parameters in signature for %s: got %d, %s", |
421
|
|
|
|
|
|
|
"inject_mite_functions", scalar(@_), "that does not seem right" ); |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
@head = splice( @_, 0, 1 ); |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
# Parameter invocant (type: Defined) |
426
|
|
|
|
|
|
|
( defined( $head[0] ) ) |
427
|
|
|
|
|
|
|
or croak( |
428
|
|
|
|
|
|
|
"Type check failed in signature for inject_mite_functions: %s should be %s", |
429
|
|
|
|
|
|
|
"\$_[0]", "Defined" |
430
|
|
|
|
|
|
|
); |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
%in = ( @_ == 1 and ( ref( $_[0] ) eq 'HASH' ) ) ? %{ $_[0] } : @_; |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
# Parameter package (type: Any) |
435
|
|
|
|
|
|
|
exists( $in{"package"} ) |
436
|
|
|
|
|
|
|
or croak( "Failure in signature for inject_mite_functions: " |
437
|
|
|
|
|
|
|
. 'Missing required parameter: package' ); |
438
|
|
|
|
|
|
|
1; # ... nothing to do |
439
|
|
|
|
|
|
|
$out{"package"} = $in{"package"} if exists( $in{"package"} ); |
440
|
|
|
|
|
|
|
delete( $in{"package"} ); |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
# Parameter file (type: Any) |
443
|
|
|
|
|
|
|
exists( $in{"file"} ) |
444
|
|
|
|
|
|
|
or croak( "Failure in signature for inject_mite_functions: " |
445
|
|
|
|
|
|
|
. 'Missing required parameter: file' ); |
446
|
|
|
|
|
|
|
1; # ... nothing to do |
447
|
|
|
|
|
|
|
$out{"file"} = $in{"file"} if exists( $in{"file"} ); |
448
|
|
|
|
|
|
|
delete( $in{"file"} ); |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
# Parameter kind (type: Optional[Str]) |
451
|
|
|
|
|
|
|
if ( exists( $in{"kind"} ) ) { |
452
|
|
|
|
|
|
|
do { |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
package Mite::Shim; |
455
|
|
|
|
|
|
|
defined( $in{"kind"} ) and do { |
456
|
|
|
|
|
|
|
ref( \$in{"kind"} ) eq 'SCALAR' |
457
|
|
|
|
|
|
|
or ref( \( my $val = $in{"kind"} ) ) eq 'SCALAR'; |
458
|
|
|
|
|
|
|
} |
459
|
|
|
|
|
|
|
} |
460
|
|
|
|
|
|
|
or croak( |
461
|
|
|
|
|
|
|
"Type check failed in signature for inject_mite_functions: %s should be %s", |
462
|
|
|
|
|
|
|
"\$_{\"kind\"}", "Optional[Str]" |
463
|
|
|
|
|
|
|
); |
464
|
|
|
|
|
|
|
$out{"kind"} = $in{"kind"}; |
465
|
|
|
|
|
|
|
delete( $in{"kind"} ); |
466
|
|
|
|
|
|
|
} |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
# Parameter arg (type: HashRef) |
469
|
|
|
|
|
|
|
$dtmp = exists( $in{"arg"} ) ? $in{"arg"} : {}; |
470
|
|
|
|
|
|
|
( ref($dtmp) eq 'HASH' ) |
471
|
|
|
|
|
|
|
or croak( |
472
|
|
|
|
|
|
|
"Type check failed in signature for inject_mite_functions: %s should be %s", |
473
|
|
|
|
|
|
|
"\$_{\"arg\"}", "HashRef" |
474
|
|
|
|
|
|
|
); |
475
|
|
|
|
|
|
|
$out{"arg"} = $dtmp; |
476
|
|
|
|
|
|
|
delete( $in{"arg"} ); |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
# Parameter shim (type: Str) |
479
|
|
|
|
|
|
|
exists( $in{"shim"} ) |
480
|
|
|
|
|
|
|
or croak( "Failure in signature for inject_mite_functions: " |
481
|
|
|
|
|
|
|
. 'Missing required parameter: shim' ); |
482
|
|
|
|
|
|
|
do { |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
package Mite::Shim; |
485
|
|
|
|
|
|
|
defined( $in{"shim"} ) and do { |
486
|
|
|
|
|
|
|
ref( \$in{"shim"} ) eq 'SCALAR' |
487
|
|
|
|
|
|
|
or ref( \( my $val = $in{"shim"} ) ) eq 'SCALAR'; |
488
|
|
|
|
|
|
|
} |
489
|
|
|
|
|
|
|
} |
490
|
|
|
|
|
|
|
or croak( |
491
|
|
|
|
|
|
|
"Type check failed in signature for inject_mite_functions: %s should be %s", |
492
|
|
|
|
|
|
|
"\$_{\"shim\"}", "Str" |
493
|
|
|
|
|
|
|
); |
494
|
|
|
|
|
|
|
$out{"shim"} = $in{"shim"} if exists( $in{"shim"} ); |
495
|
|
|
|
|
|
|
delete( $in{"shim"} ); |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
# Parameter x_source (type: Optional[Object]) |
498
|
|
|
|
|
|
|
if ( exists( $in{"x_source"} ) ) { |
499
|
|
|
|
|
|
|
( |
500
|
|
|
|
|
|
|
do { |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
package Mite::Shim; |
503
|
107
|
|
|
107
|
|
1010
|
use Scalar::Util (); |
|
107
|
|
|
|
|
15409
|
|
|
107
|
|
|
|
|
8510
|
|
504
|
|
|
|
|
|
|
Scalar::Util::blessed( $in{"x_source"} ); |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
) |
507
|
|
|
|
|
|
|
or croak( |
508
|
|
|
|
|
|
|
"Type check failed in signature for inject_mite_functions: %s should be %s", |
509
|
|
|
|
|
|
|
"\$_{\"x_source\"}", "Optional[Object]" |
510
|
|
|
|
|
|
|
); |
511
|
|
|
|
|
|
|
$out{"x_source"} = $in{"x_source"}; |
512
|
|
|
|
|
|
|
delete( $in{"x_source"} ); |
513
|
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
# Parameter x_pkg (type: Optional[Object]) |
516
|
|
|
|
|
|
|
if ( exists( $in{"x_pkg"} ) ) { |
517
|
|
|
|
|
|
|
( |
518
|
|
|
|
|
|
|
do { |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
package Mite::Shim; |
521
|
107
|
|
|
107
|
|
14839
|
use Scalar::Util (); |
|
107
|
|
|
|
|
1752
|
|
|
107
|
|
|
|
|
53081
|
|
522
|
|
|
|
|
|
|
Scalar::Util::blessed( $in{"x_pkg"} ); |
523
|
|
|
|
|
|
|
} |
524
|
|
|
|
|
|
|
) |
525
|
|
|
|
|
|
|
or croak( |
526
|
|
|
|
|
|
|
"Type check failed in signature for inject_mite_functions: %s should be %s", |
527
|
|
|
|
|
|
|
"\$_{\"x_pkg\"}", "Optional[Object]" |
528
|
|
|
|
|
|
|
); |
529
|
|
|
|
|
|
|
$out{"x_pkg"} = $in{"x_pkg"}; |
530
|
|
|
|
|
|
|
delete( $in{"x_pkg"} ); |
531
|
|
|
|
|
|
|
} |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
# Unrecognized parameters |
534
|
|
|
|
|
|
|
croak( |
535
|
|
|
|
|
|
|
"Failure in signature for inject_mite_functions: " |
536
|
|
|
|
|
|
|
. sprintf( |
537
|
|
|
|
|
|
|
q{Unrecognized parameter%s: %s}, |
538
|
|
|
|
|
|
|
keys(%in) > 1 ? q{s} : q{}, |
539
|
|
|
|
|
|
|
join( q{, }, sort keys %in ) |
540
|
|
|
|
|
|
|
) |
541
|
|
|
|
|
|
|
) if keys %in; |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
do { |
544
|
|
|
|
|
|
|
@_ = ( |
545
|
|
|
|
|
|
|
@head, $out{"package"}, $out{"file"}, $out{"kind"}, |
546
|
|
|
|
|
|
|
$out{"arg"}, $out{"shim"}, $out{"x_source"}, $out{"x_pkg"} |
547
|
|
|
|
|
|
|
); |
548
|
|
|
|
|
|
|
goto $__NEXT__; |
549
|
|
|
|
|
|
|
}; |
550
|
|
|
|
|
|
|
}; |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
$SIGNATURE_FOR{"load_files"} = sub { |
553
|
|
|
|
|
|
|
my $__NEXT__ = shift; |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
my ( %tmp, $tmp, @head ); |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
@_ >= 2 && @_ <= 3 |
558
|
|
|
|
|
|
|
or |
559
|
|
|
|
|
|
|
croak( "Wrong number of parameters in signature for %s: got %d, %s", |
560
|
|
|
|
|
|
|
"load_files", scalar(@_), "expected exactly 2 parameters" ); |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
@head = splice( @_, 0, 1 ); |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
# Parameter invocant (type: Defined) |
565
|
|
|
|
|
|
|
( defined( $head[0] ) ) |
566
|
|
|
|
|
|
|
or croak( |
567
|
|
|
|
|
|
|
"Type check failed in signature for load_files: %s should be %s", |
568
|
|
|
|
|
|
|
"\$_[0]", "Defined" ); |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
# Parameter $_[0] (type: ArrayRef) |
571
|
|
|
|
|
|
|
( ref( $_[0] ) eq 'ARRAY' ) |
572
|
|
|
|
|
|
|
or croak( |
573
|
|
|
|
|
|
|
"Type check failed in signature for load_files: %s should be %s", |
574
|
|
|
|
|
|
|
"\$_[1]", "ArrayRef" ); |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
# Parameter $_[1] (type: Any) |
577
|
|
|
|
|
|
|
$#_ >= 1 |
578
|
|
|
|
|
|
|
or do { @_ = ( @head, @_ ); goto $__NEXT__ }; |
579
|
|
|
|
|
|
|
1; # ... nothing to do |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
do { @_ = ( @head, @_ ); goto $__NEXT__ }; |
582
|
|
|
|
|
|
|
}; |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
1; |
585
|
|
|
|
|
|
|
} |