line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Mite::Config; |
4
|
107
|
|
|
107
|
|
910
|
use strict; |
|
107
|
|
|
|
|
343
|
|
|
107
|
|
|
|
|
3724
|
|
5
|
107
|
|
|
107
|
|
776
|
use warnings; |
|
107
|
|
|
|
|
372
|
|
|
107
|
|
|
|
|
3747
|
|
6
|
107
|
|
|
107
|
|
687
|
no warnings qw( once void ); |
|
107
|
|
|
|
|
333
|
|
|
107
|
|
|
|
|
14278
|
|
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
|
|
833
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "Mite::Config" ); |
15
|
|
|
|
|
|
|
( |
16
|
|
|
|
|
|
|
*after, *around, *before, *extends, *field, |
17
|
|
|
|
|
|
|
*has, *param, *signature_for, *with |
18
|
|
|
|
|
|
|
) |
19
|
107
|
|
|
|
|
358
|
= do { |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package Mite::Shim; |
22
|
107
|
|
|
107
|
|
846
|
no warnings 'redefine'; |
|
107
|
|
|
|
|
354
|
|
|
107
|
|
|
|
|
25596
|
|
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
|
535
|
|
|
535
|
|
6071
|
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
|
107
|
|
|
|
|
20935
|
); |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Mite imports |
38
|
|
|
|
|
|
|
BEGIN { |
39
|
107
|
|
|
107
|
|
916
|
require Scalar::Util; |
40
|
107
|
|
|
|
|
510
|
*STRICT = \&Mite::Shim::STRICT; |
41
|
107
|
|
|
|
|
344
|
*bare = \&Mite::Shim::bare; |
42
|
107
|
|
|
|
|
502
|
*blessed = \&Scalar::Util::blessed; |
43
|
107
|
|
|
|
|
326
|
*carp = \&Mite::Shim::carp; |
44
|
107
|
|
|
|
|
265
|
*confess = \&Mite::Shim::confess; |
45
|
107
|
|
|
|
|
289
|
*croak = \&Mite::Shim::croak; |
46
|
107
|
|
|
|
|
276
|
*false = \&Mite::Shim::false; |
47
|
107
|
|
|
|
|
271
|
*guard = \&Mite::Shim::guard; |
48
|
107
|
|
|
|
|
291
|
*lazy = \&Mite::Shim::lazy; |
49
|
107
|
|
|
|
|
289
|
*lock = \&Mite::Shim::lock; |
50
|
107
|
|
|
|
|
262
|
*ro = \&Mite::Shim::ro; |
51
|
107
|
|
|
|
|
268
|
*rw = \&Mite::Shim::rw; |
52
|
107
|
|
|
|
|
294
|
*rwp = \&Mite::Shim::rwp; |
53
|
107
|
|
|
|
|
293
|
*true = \&Mite::Shim::true; |
54
|
107
|
|
|
|
|
3952
|
*unlock = \&Mite::Shim::unlock; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
58
|
|
|
|
|
|
|
sub __META__ { |
59
|
107
|
|
|
107
|
|
806
|
no strict 'refs'; |
|
107
|
|
|
|
|
314
|
|
|
107
|
|
|
|
|
43503
|
|
60
|
107
|
|
|
107
|
|
286
|
my $class = shift; |
61
|
107
|
|
33
|
|
|
661
|
$class = ref($class) || $class; |
62
|
107
|
|
|
|
|
797
|
my $linear_isa = mro::get_linear_isa($class); |
63
|
|
|
|
|
|
|
return { |
64
|
|
|
|
|
|
|
BUILD => [ |
65
|
107
|
50
|
|
|
|
241
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
107
|
|
|
|
|
957
|
|
|
0
|
|
|
|
|
0
|
|
66
|
107
|
|
|
|
|
479
|
map { "$_\::BUILD" } reverse @$linear_isa |
67
|
|
|
|
|
|
|
], |
68
|
|
|
|
|
|
|
DEMOLISH => [ |
69
|
107
|
50
|
|
|
|
206
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
107
|
|
|
|
|
3310
|
|
|
0
|
|
|
|
|
0
|
|
70
|
107
|
|
|
|
|
384
|
map { "$_\::DEMOLISH" } @$linear_isa |
|
107
|
|
|
|
|
406
|
|
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
|
111
|
50
|
|
111
|
0
|
25584
|
my $class = ref( $_[0] ) ? ref(shift) : shift; |
80
|
111
|
|
66
|
|
|
1613
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
81
|
111
|
|
|
|
|
428
|
my $self = bless {}, $class; |
82
|
|
|
|
|
|
|
my $args = |
83
|
|
|
|
|
|
|
$meta->{HAS_BUILDARGS} |
84
|
|
|
|
|
|
|
? $class->BUILDARGS(@_) |
85
|
111
|
50
|
|
|
|
923
|
: { ( @_ == 1 ) ? %{ $_[0] } : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
86
|
111
|
|
|
|
|
295
|
my $no_build = delete $args->{__no_BUILD__}; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# Attribute mite_dir_name (type: Str) |
89
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 11 |
90
|
111
|
|
|
|
|
241
|
do { |
91
|
|
|
|
|
|
|
my $value = |
92
|
|
|
|
|
|
|
exists( $args->{"mite_dir_name"} ) |
93
|
111
|
50
|
|
|
|
412
|
? $args->{"mite_dir_name"} |
94
|
|
|
|
|
|
|
: ".mite"; |
95
|
111
|
50
|
|
|
|
241
|
do { |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
package Mite::Shim; |
98
|
111
|
50
|
|
|
|
622
|
defined($value) and do { |
99
|
111
|
50
|
|
|
|
907
|
ref( \$value ) eq 'SCALAR' |
100
|
|
|
|
|
|
|
or ref( \( my $val = $value ) ) eq 'SCALAR'; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
104
|
|
|
|
|
|
|
"mite_dir_name", "Str"; |
105
|
111
|
|
|
|
|
638
|
$self->{"mite_dir_name"} = $value; |
106
|
|
|
|
|
|
|
}; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# Attribute mite_dir (type: Path) |
109
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 25 |
110
|
111
|
50
|
|
|
|
568
|
if ( exists $args->{"mite_dir"} ) { |
111
|
0
|
|
|
|
|
0
|
do { |
112
|
0
|
|
|
|
|
0
|
my $coerced_value = do { |
113
|
0
|
|
|
|
|
0
|
my $to_coerce = $args->{"mite_dir"}; |
114
|
|
|
|
|
|
|
( |
115
|
|
|
|
|
|
|
( |
116
|
|
|
|
|
|
|
do { |
117
|
107
|
|
|
107
|
|
934
|
use Scalar::Util (); |
|
107
|
|
|
|
|
389
|
|
|
107
|
|
|
|
|
33221
|
|
118
|
0
|
0
|
|
|
|
0
|
Scalar::Util::blessed($to_coerce) |
119
|
|
|
|
|
|
|
and $to_coerce->isa(q[Path::Tiny]); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
) |
122
|
|
|
|
|
|
|
) ? $to_coerce : ( |
123
|
|
|
|
|
|
|
do { |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
package Mite::Shim; |
126
|
0
|
0
|
|
|
|
0
|
defined($to_coerce) and do { |
127
|
0
|
0
|
|
|
|
0
|
ref( \$to_coerce ) eq 'SCALAR' |
128
|
|
|
|
|
|
|
or ref( \( my $val = $to_coerce ) ) eq |
129
|
|
|
|
|
|
|
'SCALAR'; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
) |
133
|
|
|
|
|
|
|
? scalar( |
134
|
0
|
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path($_) } |
|
0
|
|
|
|
|
0
|
|
135
|
|
|
|
|
|
|
) |
136
|
|
|
|
|
|
|
: ( |
137
|
|
|
|
|
|
|
do { |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
package Mite::Shim; |
140
|
|
|
|
|
|
|
defined($to_coerce) && !ref($to_coerce) |
141
|
|
|
|
|
|
|
or Scalar::Util::blessed($to_coerce) && ( |
142
|
|
|
|
|
|
|
sub { |
143
|
0
|
|
|
0
|
|
0
|
require overload; |
144
|
0
|
0
|
0
|
|
|
0
|
overload::Overloaded( ref $_[0] or $_[0] ) |
|
|
|
0
|
|
|
|
|
145
|
|
|
|
|
|
|
and |
146
|
|
|
|
|
|
|
overload::Method( ( ref $_[0] or $_[0] ), |
147
|
|
|
|
|
|
|
$_[1] ); |
148
|
|
|
|
|
|
|
} |
149
|
0
|
0
|
0
|
|
|
0
|
)->( $to_coerce, q[""] ); |
|
|
|
0
|
|
|
|
|
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
) |
152
|
|
|
|
|
|
|
? scalar( |
153
|
0
|
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path($_) } |
|
0
|
|
|
|
|
0
|
|
154
|
|
|
|
|
|
|
) |
155
|
|
|
|
|
|
|
: ( ( ref($to_coerce) eq 'ARRAY' ) ) ? scalar( |
156
|
0
|
0
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path(@$_) } |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
157
|
|
|
|
|
|
|
) |
158
|
|
|
|
|
|
|
: $to_coerce; |
159
|
|
|
|
|
|
|
}; |
160
|
0
|
0
|
0
|
|
|
0
|
blessed($coerced_value) && $coerced_value->isa("Path::Tiny") |
161
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
162
|
|
|
|
|
|
|
"mite_dir", "Path"; |
163
|
0
|
|
|
|
|
0
|
$self->{"mite_dir"} = $coerced_value; |
164
|
|
|
|
|
|
|
}; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
# Attribute config_file (type: Path) |
168
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 35 |
169
|
111
|
50
|
|
|
|
486
|
if ( exists $args->{"config_file"} ) { |
170
|
0
|
|
|
|
|
0
|
do { |
171
|
0
|
|
|
|
|
0
|
my $coerced_value = do { |
172
|
0
|
|
|
|
|
0
|
my $to_coerce = $args->{"config_file"}; |
173
|
|
|
|
|
|
|
( |
174
|
|
|
|
|
|
|
( |
175
|
|
|
|
|
|
|
do { |
176
|
107
|
|
|
107
|
|
939
|
use Scalar::Util (); |
|
107
|
|
|
|
|
332
|
|
|
107
|
|
|
|
|
90853
|
|
177
|
0
|
0
|
|
|
|
0
|
Scalar::Util::blessed($to_coerce) |
178
|
|
|
|
|
|
|
and $to_coerce->isa(q[Path::Tiny]); |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
) |
181
|
|
|
|
|
|
|
) ? $to_coerce : ( |
182
|
|
|
|
|
|
|
do { |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
package Mite::Shim; |
185
|
0
|
0
|
|
|
|
0
|
defined($to_coerce) and do { |
186
|
0
|
0
|
|
|
|
0
|
ref( \$to_coerce ) eq 'SCALAR' |
187
|
|
|
|
|
|
|
or ref( \( my $val = $to_coerce ) ) eq |
188
|
|
|
|
|
|
|
'SCALAR'; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
) |
192
|
|
|
|
|
|
|
? scalar( |
193
|
0
|
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path($_) } |
|
0
|
|
|
|
|
0
|
|
194
|
|
|
|
|
|
|
) |
195
|
|
|
|
|
|
|
: ( |
196
|
|
|
|
|
|
|
do { |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
package Mite::Shim; |
199
|
|
|
|
|
|
|
defined($to_coerce) && !ref($to_coerce) |
200
|
|
|
|
|
|
|
or Scalar::Util::blessed($to_coerce) && ( |
201
|
|
|
|
|
|
|
sub { |
202
|
0
|
|
|
0
|
|
0
|
require overload; |
203
|
0
|
0
|
0
|
|
|
0
|
overload::Overloaded( ref $_[0] or $_[0] ) |
|
|
|
0
|
|
|
|
|
204
|
|
|
|
|
|
|
and |
205
|
|
|
|
|
|
|
overload::Method( ( ref $_[0] or $_[0] ), |
206
|
|
|
|
|
|
|
$_[1] ); |
207
|
|
|
|
|
|
|
} |
208
|
0
|
0
|
0
|
|
|
0
|
)->( $to_coerce, q[""] ); |
|
|
|
0
|
|
|
|
|
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
) |
211
|
|
|
|
|
|
|
? scalar( |
212
|
0
|
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path($_) } |
|
0
|
|
|
|
|
0
|
|
213
|
|
|
|
|
|
|
) |
214
|
|
|
|
|
|
|
: ( ( ref($to_coerce) eq 'ARRAY' ) ) ? scalar( |
215
|
0
|
0
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path(@$_) } |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
216
|
|
|
|
|
|
|
) |
217
|
|
|
|
|
|
|
: $to_coerce; |
218
|
|
|
|
|
|
|
}; |
219
|
0
|
0
|
0
|
|
|
0
|
blessed($coerced_value) && $coerced_value->isa("Path::Tiny") |
220
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
221
|
|
|
|
|
|
|
"config_file", "Path"; |
222
|
0
|
|
|
|
|
0
|
$self->{"config_file"} = $coerced_value; |
223
|
|
|
|
|
|
|
}; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
# Attribute data (type: HashRef) |
227
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 44 |
228
|
111
|
100
|
|
|
|
585
|
if ( exists $args->{"data"} ) { |
229
|
1
|
50
|
|
|
|
2
|
do { package Mite::Shim; ref( $args->{"data"} ) eq 'HASH' } |
|
1
|
|
|
|
|
8
|
|
230
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
231
|
|
|
|
|
|
|
"data", "HashRef"; |
232
|
1
|
|
|
|
|
3
|
$self->{"data"} = $args->{"data"}; |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
# Attribute search_for_mite_dir (type: Bool) |
236
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 46 |
237
|
111
|
|
|
|
|
246
|
do { |
238
|
|
|
|
|
|
|
my $value = |
239
|
|
|
|
|
|
|
exists( $args->{"search_for_mite_dir"} ) |
240
|
111
|
100
|
|
|
|
548
|
? $args->{"search_for_mite_dir"} |
241
|
|
|
|
|
|
|
: true; |
242
|
|
|
|
|
|
|
( |
243
|
111
|
50
|
66
|
|
|
1987
|
!ref $value |
|
|
|
33
|
|
|
|
|
244
|
|
|
|
|
|
|
and (!defined $value |
245
|
|
|
|
|
|
|
or $value eq q() |
246
|
|
|
|
|
|
|
or $value eq '0' |
247
|
|
|
|
|
|
|
or $value eq '1' ) |
248
|
|
|
|
|
|
|
) |
249
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
250
|
|
|
|
|
|
|
"search_for_mite_dir", "Bool"; |
251
|
111
|
|
|
|
|
454
|
$self->{"search_for_mite_dir"} = $value; |
252
|
|
|
|
|
|
|
}; |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
# Call BUILD methods |
255
|
111
|
50
|
33
|
|
|
690
|
$self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } ); |
|
111
|
50
|
|
|
|
918
|
|
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
# Unrecognized parameters |
258
|
|
|
|
|
|
|
my @unknown = grep not( |
259
|
|
|
|
|
|
|
/\A(?:config_file|data|mite_dir(?:_name)?|search_for_mite_dir)\z/), |
260
|
111
|
|
|
|
|
567
|
keys %{$args}; |
|
111
|
|
|
|
|
513
|
|
261
|
|
|
|
|
|
|
@unknown |
262
|
111
|
50
|
|
|
|
563
|
and croak( |
263
|
|
|
|
|
|
|
"Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
264
|
|
|
|
|
|
|
|
265
|
111
|
|
|
|
|
699
|
return $self; |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
269
|
|
|
|
|
|
|
sub BUILDALL { |
270
|
0
|
|
|
0
|
0
|
0
|
my $class = ref( $_[0] ); |
271
|
0
|
|
0
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
272
|
0
|
0
|
|
|
|
0
|
$_->(@_) for @{ $meta->{BUILD} || [] }; |
|
0
|
|
|
|
|
0
|
|
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
276
|
|
|
|
|
|
|
sub DESTROY { |
277
|
7
|
|
|
7
|
|
5919
|
my $self = shift; |
278
|
7
|
|
33
|
|
|
29
|
my $class = ref($self) || $self; |
279
|
7
|
|
33
|
|
|
27
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
280
|
7
|
50
|
|
|
|
32
|
my $in_global_destruction = |
281
|
|
|
|
|
|
|
defined ${^GLOBAL_PHASE} |
282
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
283
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
284
|
7
|
50
|
|
|
|
15
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
|
7
|
|
|
|
|
26
|
|
285
|
0
|
|
|
|
|
0
|
my $e = do { |
286
|
0
|
|
|
|
|
0
|
local ( $?, $@ ); |
287
|
0
|
|
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
|
0
|
|
|
|
|
0
|
|
288
|
0
|
|
|
|
|
0
|
$@; |
289
|
|
|
|
|
|
|
}; |
290
|
107
|
|
|
107
|
|
1032
|
no warnings 'misc'; # avoid (in cleanup) warnings |
|
107
|
|
|
|
|
397
|
|
|
107
|
|
|
|
|
20846
|
|
291
|
0
|
0
|
|
|
|
0
|
die $e if $e; # rethrow |
292
|
|
|
|
|
|
|
} |
293
|
7
|
|
|
|
|
68
|
return; |
294
|
|
|
|
|
|
|
} |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} |
297
|
|
|
|
|
|
|
&& eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
# Accessors for config_file |
300
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 35 |
301
|
|
|
|
|
|
|
sub config_file { |
302
|
843
|
50
|
|
843
|
0
|
2314
|
@_ == 1 or croak('Reader "config_file" usage: $self->config_file()'); |
303
|
|
|
|
|
|
|
( |
304
|
|
|
|
|
|
|
exists( $_[0]{"config_file"} ) ? $_[0]{"config_file"} : ( |
305
|
843
|
100
|
|
|
|
2100
|
$_[0]{"config_file"} = do { |
306
|
832
|
|
|
|
|
1344
|
my $default_value = do { |
307
|
832
|
|
|
|
|
2442
|
my $to_coerce = |
308
|
|
|
|
|
|
|
$Mite::Config::__config_file_DEFAULT__->( |
309
|
|
|
|
|
|
|
$_[0] ); |
310
|
|
|
|
|
|
|
( |
311
|
|
|
|
|
|
|
( |
312
|
|
|
|
|
|
|
do { |
313
|
107
|
|
|
107
|
|
965
|
use Scalar::Util (); |
|
107
|
|
|
|
|
355
|
|
|
107
|
|
|
|
|
58537
|
|
314
|
18
|
50
|
|
|
|
266
|
Scalar::Util::blessed($to_coerce) |
315
|
|
|
|
|
|
|
and $to_coerce->isa(q[Path::Tiny]); |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
) |
318
|
|
|
|
|
|
|
) ? $to_coerce : ( |
319
|
|
|
|
|
|
|
do { |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
package Mite::Shim; |
322
|
0
|
0
|
|
|
|
0
|
defined($to_coerce) and do { |
323
|
0
|
0
|
|
|
|
0
|
ref( \$to_coerce ) eq 'SCALAR' |
324
|
|
|
|
|
|
|
or ref( \( my $val = $to_coerce ) ) eq |
325
|
|
|
|
|
|
|
'SCALAR'; |
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
) |
329
|
|
|
|
|
|
|
? scalar( |
330
|
0
|
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path($_) } |
|
0
|
|
|
|
|
0
|
|
331
|
|
|
|
|
|
|
) |
332
|
|
|
|
|
|
|
: ( |
333
|
|
|
|
|
|
|
do { |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
package Mite::Shim; |
336
|
|
|
|
|
|
|
defined($to_coerce) && !ref($to_coerce) |
337
|
|
|
|
|
|
|
or Scalar::Util::blessed($to_coerce) && ( |
338
|
|
|
|
|
|
|
sub { |
339
|
0
|
|
|
0
|
|
0
|
require overload; |
340
|
0
|
0
|
0
|
|
|
0
|
overload::Overloaded( |
|
|
|
0
|
|
|
|
|
341
|
|
|
|
|
|
|
ref $_[0] |
342
|
|
|
|
|
|
|
or $_[0] |
343
|
|
|
|
|
|
|
) |
344
|
|
|
|
|
|
|
and overload::Method( |
345
|
|
|
|
|
|
|
( ref $_[0] or $_[0] ), $_[1] ); |
346
|
|
|
|
|
|
|
} |
347
|
0
|
0
|
0
|
|
|
0
|
)->( $to_coerce, q[""] ); |
|
|
|
0
|
|
|
|
|
348
|
|
|
|
|
|
|
} |
349
|
|
|
|
|
|
|
) |
350
|
|
|
|
|
|
|
? scalar( |
351
|
0
|
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path($_) } |
|
0
|
|
|
|
|
0
|
|
352
|
|
|
|
|
|
|
) |
353
|
|
|
|
|
|
|
: ( ( ref($to_coerce) eq 'ARRAY' ) ) ? scalar( |
354
|
18
|
0
|
|
|
|
835
|
do { local $_ = $to_coerce; Path::Tiny::path(@$_) } |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
|
50
|
|
|
|
|
|
355
|
|
|
|
|
|
|
) |
356
|
|
|
|
|
|
|
: $to_coerce; |
357
|
|
|
|
|
|
|
}; |
358
|
18
|
50
|
33
|
|
|
203
|
blessed($default_value) && $default_value->isa("Path::Tiny") |
359
|
|
|
|
|
|
|
or croak( "Type check failed in default: %s should be %s", |
360
|
|
|
|
|
|
|
"config_file", "Path" ); |
361
|
18
|
|
|
|
|
224
|
$default_value; |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
) |
364
|
|
|
|
|
|
|
); |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
# Accessors for data |
368
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 44 |
369
|
|
|
|
|
|
|
sub data { |
370
|
|
|
|
|
|
|
@_ > 1 |
371
|
|
|
|
|
|
|
? do { |
372
|
0
|
0
|
|
|
|
0
|
( ref( $_[1] ) eq 'HASH' ) |
373
|
|
|
|
|
|
|
or croak( "Type check failed in %s: value should be %s", |
374
|
|
|
|
|
|
|
"accessor", "HashRef" ); |
375
|
0
|
|
|
|
|
0
|
$_[0]{"data"} = $_[1]; |
376
|
0
|
|
|
|
|
0
|
$_[0]; |
377
|
|
|
|
|
|
|
} |
378
|
900
|
50
|
|
900
|
0
|
4362
|
: do { |
379
|
|
|
|
|
|
|
( |
380
|
|
|
|
|
|
|
exists( $_[0]{"data"} ) ? $_[0]{"data"} : ( |
381
|
900
|
100
|
|
|
|
2558
|
$_[0]{"data"} = do { |
382
|
823
|
|
|
|
|
2759
|
my $default_value = |
383
|
|
|
|
|
|
|
$Mite::Config::__data_DEFAULT__->( $_[0] ); |
384
|
9
|
50
|
|
|
|
125
|
( ref($default_value) eq 'HASH' ) |
385
|
|
|
|
|
|
|
or croak( |
386
|
|
|
|
|
|
|
"Type check failed in default: %s should be %s", |
387
|
|
|
|
|
|
|
"data", "HashRef" ); |
388
|
9
|
|
|
|
|
113
|
$default_value; |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
) |
391
|
|
|
|
|
|
|
) |
392
|
|
|
|
|
|
|
} |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
# Accessors for mite_dir |
396
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 25 |
397
|
|
|
|
|
|
|
sub mite_dir { |
398
|
841
|
50
|
|
841
|
0
|
2935
|
@_ == 1 or croak('Reader "mite_dir" usage: $self->mite_dir()'); |
399
|
|
|
|
|
|
|
( |
400
|
|
|
|
|
|
|
exists( $_[0]{"mite_dir"} ) ? $_[0]{"mite_dir"} : ( |
401
|
841
|
100
|
|
|
|
2178
|
$_[0]{"mite_dir"} = do { |
402
|
833
|
|
|
|
|
1330
|
my $default_value = do { |
403
|
833
|
|
|
|
|
2320
|
my $to_coerce = |
404
|
|
|
|
|
|
|
$Mite::Config::__mite_dir_DEFAULT__->( |
405
|
|
|
|
|
|
|
$_[0] ); |
406
|
|
|
|
|
|
|
( |
407
|
|
|
|
|
|
|
( |
408
|
|
|
|
|
|
|
do { |
409
|
107
|
|
|
107
|
|
977
|
use Scalar::Util (); |
|
107
|
|
|
|
|
352
|
|
|
107
|
|
|
|
|
73174
|
|
410
|
18
|
50
|
|
|
|
531
|
Scalar::Util::blessed($to_coerce) |
411
|
|
|
|
|
|
|
and $to_coerce->isa(q[Path::Tiny]); |
412
|
|
|
|
|
|
|
} |
413
|
|
|
|
|
|
|
) |
414
|
|
|
|
|
|
|
) ? $to_coerce : ( |
415
|
|
|
|
|
|
|
do { |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
package Mite::Shim; |
418
|
0
|
0
|
|
|
|
0
|
defined($to_coerce) and do { |
419
|
0
|
0
|
|
|
|
0
|
ref( \$to_coerce ) eq 'SCALAR' |
420
|
|
|
|
|
|
|
or ref( \( my $val = $to_coerce ) ) eq |
421
|
|
|
|
|
|
|
'SCALAR'; |
422
|
|
|
|
|
|
|
} |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
) |
425
|
|
|
|
|
|
|
? scalar( |
426
|
0
|
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path($_) } |
|
0
|
|
|
|
|
0
|
|
427
|
|
|
|
|
|
|
) |
428
|
|
|
|
|
|
|
: ( |
429
|
|
|
|
|
|
|
do { |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
package Mite::Shim; |
432
|
|
|
|
|
|
|
defined($to_coerce) && !ref($to_coerce) |
433
|
|
|
|
|
|
|
or Scalar::Util::blessed($to_coerce) && ( |
434
|
|
|
|
|
|
|
sub { |
435
|
0
|
|
|
0
|
|
0
|
require overload; |
436
|
0
|
0
|
0
|
|
|
0
|
overload::Overloaded( |
|
|
|
0
|
|
|
|
|
437
|
|
|
|
|
|
|
ref $_[0] |
438
|
|
|
|
|
|
|
or $_[0] |
439
|
|
|
|
|
|
|
) |
440
|
|
|
|
|
|
|
and overload::Method( |
441
|
|
|
|
|
|
|
( ref $_[0] or $_[0] ), $_[1] ); |
442
|
|
|
|
|
|
|
} |
443
|
0
|
0
|
0
|
|
|
0
|
)->( $to_coerce, q[""] ); |
|
|
|
0
|
|
|
|
|
444
|
|
|
|
|
|
|
} |
445
|
|
|
|
|
|
|
) |
446
|
|
|
|
|
|
|
? scalar( |
447
|
0
|
|
|
|
|
0
|
do { local $_ = $to_coerce; Path::Tiny::path($_) } |
|
0
|
|
|
|
|
0
|
|
448
|
|
|
|
|
|
|
) |
449
|
|
|
|
|
|
|
: ( ( ref($to_coerce) eq 'ARRAY' ) ) ? scalar( |
450
|
18
|
0
|
|
|
|
68
|
do { local $_ = $to_coerce; Path::Tiny::path(@$_) } |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
|
50
|
|
|
|
|
|
451
|
|
|
|
|
|
|
) |
452
|
|
|
|
|
|
|
: $to_coerce; |
453
|
|
|
|
|
|
|
}; |
454
|
18
|
50
|
33
|
|
|
220
|
blessed($default_value) && $default_value->isa("Path::Tiny") |
455
|
|
|
|
|
|
|
or croak( "Type check failed in default: %s should be %s", |
456
|
|
|
|
|
|
|
"mite_dir", "Path" ); |
457
|
18
|
|
|
|
|
140
|
$default_value; |
458
|
|
|
|
|
|
|
} |
459
|
|
|
|
|
|
|
) |
460
|
|
|
|
|
|
|
); |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
# Accessors for mite_dir_name |
464
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 11 |
465
|
|
|
|
|
|
|
if ($__XS) { |
466
|
|
|
|
|
|
|
Class::XSAccessor->import( |
467
|
|
|
|
|
|
|
chained => 1, |
468
|
|
|
|
|
|
|
"getters" => { "mite_dir_name" => "mite_dir_name" }, |
469
|
|
|
|
|
|
|
); |
470
|
|
|
|
|
|
|
} |
471
|
|
|
|
|
|
|
else { |
472
|
|
|
|
|
|
|
*mite_dir_name = sub { |
473
|
|
|
|
|
|
|
@_ == 1 |
474
|
|
|
|
|
|
|
or croak('Reader "mite_dir_name" usage: $self->mite_dir_name()'); |
475
|
|
|
|
|
|
|
$_[0]{"mite_dir_name"}; |
476
|
|
|
|
|
|
|
}; |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
# Accessors for search_for_mite_dir |
480
|
|
|
|
|
|
|
# has declaration, file lib/Mite/Config.pm, line 46 |
481
|
|
|
|
|
|
|
sub search_for_mite_dir { |
482
|
|
|
|
|
|
|
@_ > 1 |
483
|
|
|
|
|
|
|
? do { |
484
|
|
|
|
|
|
|
( |
485
|
15
|
50
|
66
|
|
|
369
|
!ref $_[1] |
|
|
|
66
|
|
|
|
|
486
|
|
|
|
|
|
|
and (!defined $_[1] |
487
|
|
|
|
|
|
|
or $_[1] eq q() |
488
|
|
|
|
|
|
|
or $_[1] eq '0' |
489
|
|
|
|
|
|
|
or $_[1] eq '1' ) |
490
|
|
|
|
|
|
|
) |
491
|
|
|
|
|
|
|
or croak( "Type check failed in %s: value should be %s", |
492
|
|
|
|
|
|
|
"accessor", "Bool" ); |
493
|
15
|
|
|
|
|
81
|
$_[0]{"search_for_mite_dir"} = $_[1]; |
494
|
15
|
|
|
|
|
53
|
$_[0]; |
495
|
|
|
|
|
|
|
} |
496
|
3275
|
100
|
|
3275
|
0
|
206304
|
: ( $_[0]{"search_for_mite_dir"} ); |
497
|
|
|
|
|
|
|
} |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
# See UNIVERSAL |
500
|
|
|
|
|
|
|
sub DOES { |
501
|
0
|
|
|
0
|
0
|
|
my ( $self, $role ) = @_; |
502
|
0
|
|
|
|
|
|
our %DOES; |
503
|
0
|
0
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
504
|
0
|
0
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
505
|
0
|
0
|
0
|
|
|
|
if ( $INC{'Moose/Util.pm'} |
|
|
|
0
|
|
|
|
|
506
|
|
|
|
|
|
|
and my $meta = Moose::Util::find_meta( ref $self or $self ) ) |
507
|
|
|
|
|
|
|
{ |
508
|
0
|
0
|
0
|
|
|
|
$meta->can('does_role') and $meta->does_role($role) and return 1; |
509
|
|
|
|
|
|
|
} |
510
|
0
|
|
|
|
|
|
return $self->SUPER::DOES($role); |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
514
|
|
|
|
|
|
|
sub does { |
515
|
0
|
|
|
0
|
0
|
|
shift->DOES(@_); |
516
|
|
|
|
|
|
|
} |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
1; |
519
|
|
|
|
|
|
|
} |