line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
2
|
|
|
2
|
|
22
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
136
|
|
4
|
2
|
|
|
2
|
|
28
|
no warnings qw( once void ); |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
166
|
|
5
|
2
|
|
|
2
|
|
26
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
554
|
|
6
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Role"; |
7
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
8
|
|
|
|
|
|
|
our $MITE_VERSION = "0.011000"; |
9
|
|
|
|
|
|
|
# Mite keywords |
10
|
|
|
|
|
|
|
BEGIN { |
11
|
|
|
|
|
|
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "OurTest1" ); |
12
|
2
|
|
|
2
|
|
8
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
13
|
2
|
|
|
|
|
14
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
2
|
|
|
2
|
|
28
|
sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
546
|
|
16
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "role", @_ ) }, |
17
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "role", @_ ) }, |
18
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
19
|
0
|
|
|
|
|
0
|
sub {}, |
20
|
2
|
|
|
|
|
30
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
21
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
22
|
0
|
|
|
|
|
0
|
); |
23
|
0
|
|
|
|
|
0
|
}; |
24
|
2
|
|
|
|
|
102
|
|
25
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
26
|
|
|
|
|
|
|
no strict 'refs'; |
27
|
|
|
|
|
|
|
my $class = shift; $class = ref($class) || $class; |
28
|
|
|
|
|
|
|
my $linear_isa = mro::get_linear_isa( $class ); |
29
|
|
|
|
|
|
|
return { |
30
|
2
|
|
|
2
|
|
14
|
BUILD => [ |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1012
|
|
31
|
0
|
|
0
|
0
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
0
|
|
|
|
|
0
|
|
32
|
0
|
|
|
|
|
0
|
map { "$_\::BUILD" } reverse @$linear_isa |
33
|
|
|
|
|
|
|
], |
34
|
|
|
|
|
|
|
DEMOLISH => [ |
35
|
0
|
0
|
|
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
36
|
0
|
|
|
|
|
0
|
map { "$_\::DEMOLISH" } @$linear_isa |
37
|
|
|
|
|
|
|
], |
38
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
39
|
0
|
0
|
|
|
|
0
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
40
|
0
|
|
|
|
|
0
|
}; |
|
0
|
|
|
|
|
0
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# See UNIVERSAL |
44
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
45
|
|
|
|
|
|
|
our %DOES; |
46
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
47
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
48
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
49
|
14
|
|
|
14
|
|
24
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
50
|
14
|
|
|
|
|
14
|
} |
51
|
14
|
50
|
|
|
|
28
|
return $self->SUPER::DOES( $role ); |
52
|
14
|
50
|
|
|
|
24
|
} |
53
|
14
|
50
|
0
|
|
|
24
|
|
|
|
|
33
|
|
|
|
|
54
|
0
|
0
|
0
|
|
|
0
|
# Alias for Moose/Moo-compatibility |
55
|
|
|
|
|
|
|
shift->DOES( @_ ); |
56
|
14
|
|
|
|
|
86
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Callback which classes consuming this role will call |
59
|
|
|
|
|
|
|
my ( $me, $target, $args ) = @_; |
60
|
|
|
|
|
|
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
61
|
14
|
|
|
14
|
|
1538
|
|
62
|
|
|
|
|
|
|
# Ensure a given target only consumes this role once. |
63
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
64
|
|
|
|
|
|
|
return; |
65
|
|
|
|
|
|
|
} |
66
|
4
|
|
|
4
|
|
8
|
$CONSUMERS{$target} = 1; |
67
|
4
|
|
|
|
|
4
|
|
68
|
|
|
|
|
|
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
69
|
|
|
|
|
|
|
return if $type ne 'Mite::Class'; |
70
|
4
|
50
|
|
|
|
10
|
|
71
|
0
|
|
|
|
|
0
|
my @missing_methods; |
72
|
|
|
|
|
|
|
@missing_methods = () |
73
|
4
|
|
|
|
|
8
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
74
|
|
|
|
|
|
|
|
75
|
2
|
|
|
2
|
|
18
|
my @roles = ( ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
644
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
14
|
|
76
|
4
|
100
|
|
|
|
16
|
my %nextargs = %{ $args || {} }; |
77
|
|
|
|
|
|
|
( $nextargs{-indirect} ||= 0 )++; |
78
|
2
|
|
|
|
|
2
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
79
|
2
|
50
|
|
|
|
6
|
for my $role ( @roles ) { |
80
|
|
|
|
|
|
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
81
|
|
|
|
|
|
|
} |
82
|
2
|
|
|
|
|
2
|
|
83
|
2
|
50
|
|
|
|
6
|
my $shim = "Mite::Shim"; |
|
2
|
|
|
|
|
8
|
|
84
|
2
|
|
50
|
|
|
8
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
85
|
2
|
50
|
|
|
|
22
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
86
|
2
|
|
|
|
|
6
|
my $handler = "HANDLE_$modification"; |
87
|
0
|
|
|
|
|
0
|
$shim->$handler( $target, "class", $names, $coderef ); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
2
|
|
|
|
|
4
|
return; |
91
|
2
|
|
|
|
|
4
|
} |
92
|
0
|
|
|
|
|
0
|
|
93
|
0
|
|
|
|
|
0
|
1; |
94
|
0
|
|
|
|
|
0
|
use strict; |
95
|
|
|
|
|
|
|
use warnings; |
96
|
|
|
|
|
|
|
no warnings qw( once void ); |
97
|
2
|
|
|
|
|
8
|
|
98
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Role"; |
99
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
100
|
|
|
|
|
|
|
our $MITE_VERSION = "0.011000"; |
101
|
|
|
|
|
|
|
# Mite keywords |
102
|
|
|
|
|
|
|
BEGIN { |
103
|
2
|
|
|
2
|
|
26
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "OurTest2" ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
78
|
|
104
|
2
|
|
|
2
|
|
16
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
62
|
|
105
|
2
|
|
|
2
|
|
22
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
324
|
|
106
|
|
|
|
|
|
|
( |
107
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, |
108
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "role", @_ ) }, |
109
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_before( $CALLER, "role", @_ ) }, |
110
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
111
|
|
|
|
|
|
|
sub {}, |
112
|
2
|
|
|
2
|
|
10
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
113
|
2
|
|
|
|
|
4
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
114
|
|
|
|
|
|
|
); |
115
|
2
|
|
|
2
|
|
16
|
}; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
380
|
|
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
0
|
# Gather metadata for constructor and destructor |
118
|
0
|
|
|
|
|
0
|
no strict 'refs'; |
119
|
0
|
|
|
|
|
0
|
my $class = shift; $class = ref($class) || $class; |
120
|
0
|
|
|
|
|
0
|
my $linear_isa = mro::get_linear_isa( $class ); |
121
|
|
|
|
|
|
|
return { |
122
|
0
|
|
|
|
|
0
|
BUILD => [ |
123
|
2
|
|
|
|
|
12
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
124
|
2
|
|
|
|
|
112
|
map { "$_\::BUILD" } reverse @$linear_isa |
125
|
|
|
|
|
|
|
], |
126
|
|
|
|
|
|
|
DEMOLISH => [ |
127
|
|
|
|
|
|
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
128
|
|
|
|
|
|
|
map { "$_\::DEMOLISH" } @$linear_isa |
129
|
|
|
|
|
|
|
], |
130
|
2
|
|
|
2
|
|
14
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
396
|
|
131
|
0
|
|
0
|
0
|
|
0
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
0
|
|
|
|
|
0
|
|
132
|
0
|
|
|
|
|
0
|
}; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
0
|
0
|
|
|
|
0
|
BEGIN { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
136
|
0
|
|
|
|
|
0
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
our %DOES = ( "OurTest2" => 1, "OurTest1" => 1 ); |
139
|
0
|
0
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
140
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
141
|
|
|
|
|
|
|
# See UNIVERSAL |
142
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
143
|
|
|
|
|
|
|
our %DOES; |
144
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
145
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
146
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
147
|
|
|
|
|
|
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
150
|
2
|
|
|
2
|
|
676
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
153
|
|
|
|
|
|
|
shift->DOES( @_ ); |
154
|
|
|
|
|
|
|
} |
155
|
14
|
|
|
14
|
|
22
|
|
156
|
14
|
|
|
|
|
36
|
# Methods from roles |
157
|
14
|
50
|
|
|
|
28
|
|
158
|
14
|
50
|
|
|
|
24
|
# Callback which classes consuming this role will call |
159
|
14
|
50
|
0
|
|
|
26
|
my ( $me, $target, $args ) = @_; |
|
|
|
33
|
|
|
|
|
160
|
0
|
0
|
0
|
|
|
0
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
161
|
|
|
|
|
|
|
|
162
|
14
|
|
|
|
|
68
|
# Ensure a given target only consumes this role once. |
163
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
164
|
|
|
|
|
|
|
return; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
$CONSUMERS{$target} = 1; |
167
|
14
|
|
|
14
|
|
1458
|
|
168
|
|
|
|
|
|
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
169
|
|
|
|
|
|
|
return if $type ne 'Mite::Class'; |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
0
|
|
0
|
my @missing_methods; |
172
|
0
|
|
|
0
|
|
0
|
@missing_methods = () |
173
|
|
|
|
|
|
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
my @roles = ( "OurTest1" ); |
176
|
2
|
|
|
2
|
|
6
|
my %nextargs = %{ $args || {} }; |
177
|
2
|
|
|
|
|
2
|
( $nextargs{-indirect} ||= 0 )++; |
178
|
|
|
|
|
|
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
179
|
|
|
|
|
|
|
for my $role ( @roles ) { |
180
|
2
|
50
|
|
|
|
8
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
181
|
0
|
|
|
|
|
0
|
} |
182
|
|
|
|
|
|
|
|
183
|
2
|
|
|
|
|
4
|
my $shim = "Mite::Shim"; |
184
|
|
|
|
|
|
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
185
|
2
|
|
|
2
|
|
16
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
576
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
6
|
|
186
|
2
|
50
|
|
|
|
6
|
my $handler = "HANDLE_$modification"; |
187
|
|
|
|
|
|
|
$shim->$handler( $target, "class", $names, $coderef ); |
188
|
2
|
|
|
|
|
4
|
} |
189
|
2
|
50
|
|
|
|
42
|
|
190
|
|
|
|
|
|
|
return; |
191
|
|
|
|
|
|
|
} |
192
|
2
|
|
|
|
|
6
|
|
193
|
2
|
50
|
|
|
|
4
|
1; |
|
2
|
|
|
|
|
16
|
|
194
|
2
|
|
50
|
|
|
12
|
use strict; |
195
|
2
|
50
|
|
|
|
6
|
use warnings; |
196
|
2
|
|
|
|
|
2
|
no warnings qw( once void ); |
197
|
2
|
|
|
|
|
10
|
|
198
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
199
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
200
|
2
|
|
|
|
|
2
|
our $MITE_VERSION = "0.011000"; |
201
|
2
|
|
|
|
|
4
|
# Mite keywords |
202
|
0
|
|
|
|
|
0
|
BEGIN { |
203
|
0
|
|
|
|
|
0
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "OurTest3" ); |
204
|
0
|
|
|
|
|
0
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
205
|
|
|
|
|
|
|
no warnings 'redefine'; |
206
|
|
|
|
|
|
|
( |
207
|
2
|
|
|
|
|
10
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
208
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
209
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
210
|
|
|
|
|
|
|
sub {}, |
211
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
212
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
213
|
2
|
|
|
2
|
|
14
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
88
|
|
214
|
2
|
|
|
2
|
|
14
|
); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
54
|
|
215
|
2
|
|
|
2
|
|
36
|
}; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
238
|
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
218
|
|
|
|
|
|
|
no strict 'refs'; |
219
|
|
|
|
|
|
|
my $class = shift; $class = ref($class) || $class; |
220
|
|
|
|
|
|
|
my $linear_isa = mro::get_linear_isa( $class ); |
221
|
|
|
|
|
|
|
return { |
222
|
2
|
|
|
2
|
|
8
|
BUILD => [ |
223
|
2
|
|
|
|
|
4
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
224
|
|
|
|
|
|
|
map { "$_\::BUILD" } reverse @$linear_isa |
225
|
2
|
|
|
2
|
|
14
|
], |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
358
|
|
226
|
|
|
|
|
|
|
DEMOLISH => [ |
227
|
0
|
|
|
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
228
|
0
|
|
|
|
|
0
|
map { "$_\::DEMOLISH" } @$linear_isa |
229
|
0
|
|
|
|
|
0
|
], |
230
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
231
|
0
|
|
|
|
|
0
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
232
|
0
|
|
|
|
|
0
|
}; |
233
|
2
|
|
|
|
|
10
|
} |
234
|
2
|
|
|
|
|
114
|
|
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
237
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
238
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
239
|
|
|
|
|
|
|
my $self = bless {}, $class; |
240
|
2
|
|
|
2
|
|
12
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1480
|
|
241
|
2
|
|
33
|
2
|
|
4
|
my $no_build = delete $args->{__no_BUILD__}; |
|
2
|
|
|
|
|
8
|
|
242
|
2
|
|
|
|
|
8
|
|
243
|
|
|
|
|
|
|
# Attribute foo |
244
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/vc_9vnDql6, line 3 |
245
|
2
|
50
|
|
|
|
4
|
if ( exists $args->{"foo"} ) { $self->{"foo"} = $args->{"foo"}; } ; |
|
2
|
|
|
|
|
32
|
|
|
0
|
|
|
|
|
0
|
|
246
|
2
|
|
|
|
|
6
|
|
247
|
|
|
|
|
|
|
# Attribute bar |
248
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/vc_9vnDql6, line 3 |
249
|
2
|
50
|
|
|
|
4
|
if ( exists $args->{"bar"} ) { $self->{"bar"} = $args->{"bar"}; } ; |
|
2
|
|
|
|
|
34
|
|
|
0
|
|
|
|
|
0
|
|
250
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
8
|
|
251
|
|
|
|
|
|
|
# Attribute baz |
252
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/vc_9vnDql6, line 3 |
253
|
|
|
|
|
|
|
if ( exists $args->{"baz"} ) { $self->{"baz"} = $args->{"baz"}; } ; |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
# Call BUILD methods |
257
|
|
|
|
|
|
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
# Unrecognized parameters |
260
|
2
|
50
|
|
2
|
|
4426
|
my @unknown = grep not( /\A(?:ba[rz]|foo)\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
261
|
2
|
|
33
|
|
|
14
|
|
262
|
2
|
|
|
|
|
4
|
return $self; |
263
|
2
|
50
|
|
|
|
12
|
} |
|
0
|
50
|
|
|
|
0
|
|
264
|
2
|
|
|
|
|
4
|
|
265
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
266
|
|
|
|
|
|
|
my $class = ref( $_[0] ); |
267
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
268
|
2
|
50
|
|
|
|
8
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
|
2
|
|
|
|
|
10
|
|
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
272
|
2
|
50
|
|
|
|
22
|
my $self = shift; |
|
0
|
|
|
|
|
0
|
|
273
|
|
|
|
|
|
|
my $class = ref( $self ) || $self; |
274
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
275
|
|
|
|
|
|
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
276
|
2
|
50
|
|
|
|
6
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
|
0
|
|
|
|
|
0
|
|
277
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
278
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
279
|
|
|
|
|
|
|
my $e = do { |
280
|
2
|
50
|
33
|
|
|
8
|
local ( $?, $@ ); |
|
2
|
50
|
|
|
|
12
|
|
281
|
|
|
|
|
|
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
282
|
|
|
|
|
|
|
$@; |
283
|
2
|
50
|
|
|
|
4
|
}; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
8
|
|
284
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
285
|
2
|
|
|
|
|
8
|
die $e if $e; # rethrow |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
return; |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
0
|
|
|
0
|
|
0
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
291
|
0
|
|
0
|
|
|
0
|
|
292
|
0
|
0
|
|
|
|
0
|
# Accessors for bar |
|
0
|
|
|
|
|
0
|
|
293
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/vc_9vnDql6, line 3 |
294
|
|
|
|
|
|
|
if ( $__XS ) { |
295
|
|
|
|
|
|
|
Class::XSAccessor->import( |
296
|
|
|
|
|
|
|
chained => 1, |
297
|
2
|
|
|
2
|
|
866
|
"getters" => { "bar" => "bar" }, |
298
|
2
|
|
33
|
|
|
8
|
); |
299
|
2
|
|
33
|
|
|
10
|
} |
300
|
2
|
50
|
|
|
|
10
|
else { |
301
|
|
|
|
|
|
|
*bar = sub { @_ == 1 or Mite::Shim::croak( 'Reader "bar" usage: $self->bar()' ); $_[0]{"bar"} }; |
302
|
|
|
|
|
|
|
} |
303
|
2
|
50
|
|
|
|
2
|
|
|
2
|
|
|
|
|
8
|
|
304
|
0
|
|
|
|
|
0
|
# Accessors for baz |
305
|
0
|
|
|
|
|
0
|
# has declaration, file ../../../../tmp/vc_9vnDql6, line 3 |
306
|
0
|
|
|
|
|
0
|
if ( $__XS ) { |
|
0
|
|
|
|
|
0
|
|
307
|
0
|
|
|
|
|
0
|
Class::XSAccessor->import( |
308
|
|
|
|
|
|
|
chained => 1, |
309
|
2
|
|
|
2
|
|
30
|
"getters" => { "baz" => "baz" }, |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
748
|
|
310
|
0
|
0
|
|
|
|
0
|
); |
311
|
|
|
|
|
|
|
} |
312
|
2
|
|
|
|
|
10
|
else { |
313
|
|
|
|
|
|
|
*baz = sub { @_ == 1 or Mite::Shim::croak( 'Reader "baz" usage: $self->baz()' ); $_[0]{"baz"} }; |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
# Accessors for foo |
317
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/vc_9vnDql6, line 3 |
318
|
|
|
|
|
|
|
if ( $__XS ) { |
319
|
|
|
|
|
|
|
Class::XSAccessor->import( |
320
|
|
|
|
|
|
|
chained => 1, |
321
|
|
|
|
|
|
|
"getters" => { "foo" => "foo" }, |
322
|
|
|
|
|
|
|
); |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
else { |
325
|
|
|
|
|
|
|
*foo = sub { @_ == 1 or Mite::Shim::croak( 'Reader "foo" usage: $self->foo()' ); $_[0]{"foo"} }; |
326
|
|
|
|
|
|
|
} |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
BEGIN { |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
our %DOES = ( "OurTest3" => 1, "OurTest2" => 1, "OurTest1" => 1 ); |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
# See UNIVERSAL |
336
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
337
|
|
|
|
|
|
|
our %DOES; |
338
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
339
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
340
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
341
|
|
|
|
|
|
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
344
|
|
|
|
|
|
|
} |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
347
|
|
|
|
|
|
|
shift->DOES( @_ ); |
348
|
|
|
|
|
|
|
} |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
# Methods from roles |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
1; |