line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
3
|
|
|
3
|
|
21
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
93
|
|
4
|
3
|
|
|
3
|
|
15
|
no warnings qw( once void ); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
81
|
|
5
|
3
|
|
|
3
|
|
12
|
|
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
357
|
|
6
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Role"; |
7
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
8
|
|
|
|
|
|
|
our $MITE_VERSION = "0.010008"; |
9
|
|
|
|
|
|
|
# Mite keywords |
10
|
|
|
|
|
|
|
BEGIN { |
11
|
|
|
|
|
|
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "YourTest1" ); |
12
|
3
|
|
|
3
|
|
15
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
13
|
3
|
|
|
|
|
3
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
3
|
|
|
3
|
|
18
|
sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
462
|
|
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
|
3
|
|
|
|
|
60
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
21
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
22
|
0
|
|
|
|
|
0
|
); |
23
|
0
|
|
|
|
|
0
|
}; |
24
|
3
|
|
|
|
|
159
|
|
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
|
3
|
|
|
3
|
|
18
|
BUILD => [ |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
1059
|
|
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
|
21
|
|
|
21
|
|
33
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
50
|
21
|
|
|
|
|
18
|
} |
51
|
21
|
50
|
|
|
|
24
|
return $self->SUPER::DOES( $role ); |
52
|
21
|
50
|
|
|
|
27
|
} |
53
|
21
|
50
|
0
|
|
|
42
|
|
|
|
|
33
|
|
|
|
|
54
|
0
|
0
|
0
|
|
|
0
|
# Alias for Moose/Moo-compatibility |
55
|
|
|
|
|
|
|
shift->DOES( @_ ); |
56
|
21
|
|
|
|
|
96
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Callback which classes consuming this role will call |
59
|
|
|
|
|
|
|
my ( $me, $target, $args ) = @_; |
60
|
|
|
|
|
|
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
61
|
21
|
|
|
21
|
|
4776
|
|
62
|
|
|
|
|
|
|
# Ensure a given target only consumes this role once. |
63
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
64
|
|
|
|
|
|
|
return; |
65
|
|
|
|
|
|
|
} |
66
|
6
|
|
|
6
|
|
9
|
$CONSUMERS{$target} = 1; |
67
|
6
|
|
|
|
|
6
|
|
68
|
|
|
|
|
|
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
69
|
|
|
|
|
|
|
return if $type ne 'Mite::Class'; |
70
|
6
|
50
|
|
|
|
6
|
|
71
|
0
|
|
|
|
|
0
|
my @missing_methods; |
72
|
|
|
|
|
|
|
@missing_methods = () |
73
|
6
|
|
|
|
|
9
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
74
|
|
|
|
|
|
|
|
75
|
3
|
|
|
3
|
|
18
|
my @roles = ( ); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
729
|
|
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
18
|
|
76
|
6
|
100
|
|
|
|
39
|
my %nextargs = %{ $args || {} }; |
77
|
|
|
|
|
|
|
( $nextargs{-indirect} ||= 0 )++; |
78
|
3
|
|
|
|
|
3
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
79
|
3
|
50
|
|
|
|
21
|
for my $role ( @roles ) { |
80
|
|
|
|
|
|
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
81
|
|
|
|
|
|
|
} |
82
|
3
|
|
|
|
|
6
|
|
83
|
3
|
50
|
|
|
|
3
|
my $shim = "Mite::Shim"; |
|
3
|
|
|
|
|
12
|
|
84
|
3
|
|
50
|
|
|
12
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
85
|
3
|
50
|
|
|
|
3
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
86
|
3
|
|
|
|
|
6
|
my $handler = "HANDLE_$modification"; |
87
|
0
|
|
|
|
|
0
|
$shim->$handler( $target, "class", $names, $coderef ); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
3
|
|
|
|
|
3
|
return; |
91
|
3
|
|
|
|
|
6
|
} |
92
|
0
|
|
|
|
|
0
|
|
93
|
0
|
|
|
|
|
0
|
1; |
94
|
0
|
|
|
|
|
0
|
use strict; |
95
|
|
|
|
|
|
|
use warnings; |
96
|
|
|
|
|
|
|
no warnings qw( once void ); |
97
|
3
|
|
|
|
|
9
|
|
98
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Role"; |
99
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
100
|
|
|
|
|
|
|
our $MITE_VERSION = "0.010008"; |
101
|
|
|
|
|
|
|
# Mite keywords |
102
|
|
|
|
|
|
|
BEGIN { |
103
|
3
|
|
|
3
|
|
18
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "YourTest2" ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
54
|
|
104
|
3
|
|
|
3
|
|
9
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
111
|
|
105
|
3
|
|
|
3
|
|
15
|
no warnings 'redefine'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
297
|
|
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
|
3
|
|
|
3
|
|
18
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
113
|
3
|
|
|
|
|
3
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
114
|
|
|
|
|
|
|
); |
115
|
3
|
|
|
3
|
|
15
|
}; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
471
|
|
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
|
3
|
|
|
|
|
18
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
124
|
3
|
|
|
|
|
114
|
map { "$_\::BUILD" } reverse @$linear_isa |
125
|
|
|
|
|
|
|
], |
126
|
|
|
|
|
|
|
DEMOLISH => [ |
127
|
|
|
|
|
|
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
128
|
|
|
|
|
|
|
map { "$_\::DEMOLISH" } @$linear_isa |
129
|
|
|
|
|
|
|
], |
130
|
3
|
|
|
3
|
|
15
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
483
|
|
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 = ( "YourTest2" => 1, "YourTest1" => 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
|
3
|
|
|
3
|
|
618
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
153
|
|
|
|
|
|
|
shift->DOES( @_ ); |
154
|
|
|
|
|
|
|
} |
155
|
21
|
|
|
21
|
|
30
|
|
156
|
21
|
|
|
|
|
18
|
# Callback which classes consuming this role will call |
157
|
21
|
50
|
|
|
|
33
|
my ( $me, $target, $args ) = @_; |
158
|
21
|
50
|
|
|
|
24
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
159
|
21
|
50
|
0
|
|
|
30
|
|
|
|
|
33
|
|
|
|
|
160
|
0
|
0
|
0
|
|
|
0
|
# Ensure a given target only consumes this role once. |
161
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
162
|
21
|
|
|
|
|
81
|
return; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
$CONSUMERS{$target} = 1; |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
167
|
21
|
|
|
21
|
|
1629
|
return if $type ne 'Mite::Class'; |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
my @missing_methods; |
170
|
|
|
|
|
|
|
@missing_methods = () |
171
|
|
|
|
|
|
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
172
|
3
|
|
|
3
|
|
6
|
|
173
|
3
|
|
|
|
|
3
|
my @roles = ( "YourTest1" ); |
174
|
|
|
|
|
|
|
my %nextargs = %{ $args || {} }; |
175
|
|
|
|
|
|
|
( $nextargs{-indirect} ||= 0 )++; |
176
|
3
|
50
|
|
|
|
9
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
177
|
0
|
|
|
|
|
0
|
for my $role ( @roles ) { |
178
|
|
|
|
|
|
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
179
|
3
|
|
|
|
|
6
|
} |
180
|
|
|
|
|
|
|
|
181
|
3
|
|
|
3
|
|
21
|
my $shim = "Mite::Shim"; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
690
|
|
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
9
|
|
182
|
3
|
50
|
|
|
|
9
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
183
|
|
|
|
|
|
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
184
|
3
|
|
|
|
|
3
|
my $handler = "HANDLE_$modification"; |
185
|
3
|
50
|
|
|
|
9
|
$shim->$handler( $target, "class", $names, $coderef ); |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
3
|
|
|
|
|
3
|
return; |
189
|
3
|
50
|
|
|
|
3
|
} |
|
3
|
|
|
|
|
33
|
|
190
|
3
|
|
50
|
|
|
18
|
|
191
|
3
|
50
|
|
|
|
6
|
1; |
192
|
3
|
|
|
|
|
6
|
use strict; |
193
|
3
|
|
|
|
|
12
|
use warnings; |
194
|
|
|
|
|
|
|
no warnings qw( once void ); |
195
|
|
|
|
|
|
|
|
196
|
3
|
|
|
|
|
6
|
our $USES_MITE = "Mite::Class"; |
197
|
3
|
|
|
|
|
3
|
our $MITE_SHIM = "Mite::Shim"; |
198
|
0
|
|
|
|
|
0
|
our $MITE_VERSION = "0.010008"; |
199
|
0
|
|
|
|
|
0
|
# Mite keywords |
200
|
0
|
|
|
|
|
0
|
BEGIN { |
201
|
|
|
|
|
|
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "YourTest3" ); |
202
|
|
|
|
|
|
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
203
|
3
|
|
|
|
|
12
|
no warnings 'redefine'; |
204
|
|
|
|
|
|
|
( |
205
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
206
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
207
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
208
|
|
|
|
|
|
|
sub {}, |
209
|
3
|
|
|
3
|
|
93
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
123
|
|
210
|
3
|
|
|
3
|
|
18
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
69
|
|
211
|
3
|
|
|
3
|
|
12
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
282
|
|
212
|
|
|
|
|
|
|
); |
213
|
|
|
|
|
|
|
}; |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
216
|
|
|
|
|
|
|
no strict 'refs'; |
217
|
|
|
|
|
|
|
my $class = shift; $class = ref($class) || $class; |
218
|
3
|
|
|
3
|
|
12
|
my $linear_isa = mro::get_linear_isa( $class ); |
219
|
3
|
|
|
|
|
3
|
return { |
220
|
|
|
|
|
|
|
BUILD => [ |
221
|
3
|
|
|
3
|
|
18
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
465
|
|
222
|
|
|
|
|
|
|
map { "$_\::BUILD" } reverse @$linear_isa |
223
|
0
|
|
|
|
|
0
|
], |
224
|
0
|
|
|
|
|
0
|
DEMOLISH => [ |
225
|
0
|
|
|
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
226
|
|
|
|
|
|
|
map { "$_\::DEMOLISH" } @$linear_isa |
227
|
0
|
|
|
|
|
0
|
], |
228
|
0
|
|
|
|
|
0
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
229
|
3
|
|
|
|
|
6
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
230
|
3
|
|
|
|
|
132
|
}; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
235
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
236
|
3
|
|
|
3
|
|
15
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1551
|
|
237
|
3
|
|
33
|
3
|
|
6
|
my $self = bless {}, $class; |
|
3
|
|
|
|
|
12
|
|
238
|
3
|
|
|
|
|
9
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
239
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
240
|
|
|
|
|
|
|
|
241
|
3
|
50
|
|
|
|
6
|
# Attribute foo |
|
3
|
|
|
|
|
18
|
|
|
0
|
|
|
|
|
0
|
|
242
|
3
|
|
|
|
|
9
|
# has declaration, file ../../../../tmp/4k3aHZSVhe, line 3 |
243
|
|
|
|
|
|
|
if ( exists $args->{"foo"} ) { $self->{"foo"} = $args->{"foo"}; } ; |
244
|
|
|
|
|
|
|
|
245
|
3
|
50
|
|
|
|
6
|
|
|
3
|
|
|
|
|
99
|
|
|
0
|
|
|
|
|
0
|
|
246
|
3
|
|
|
|
|
6
|
# Call BUILD methods |
|
3
|
|
|
|
|
6
|
|
247
|
|
|
|
|
|
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
# Unrecognized parameters |
250
|
|
|
|
|
|
|
my @unknown = grep not( /\Afoo\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
return $self; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
256
|
3
|
50
|
|
3
|
|
8691
|
my $class = ref( $_[0] ); |
257
|
3
|
|
33
|
|
|
12
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
258
|
3
|
|
|
|
|
6
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
259
|
3
|
50
|
|
|
|
12
|
} |
|
0
|
50
|
|
|
|
0
|
|
260
|
3
|
|
|
|
|
6
|
|
261
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
262
|
|
|
|
|
|
|
my $self = shift; |
263
|
|
|
|
|
|
|
my $class = ref( $self ) || $self; |
264
|
3
|
50
|
|
|
|
6
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
|
3
|
|
|
|
|
12
|
|
265
|
|
|
|
|
|
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
266
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
267
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
268
|
3
|
50
|
33
|
|
|
9
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
|
3
|
50
|
|
|
|
12
|
|
269
|
|
|
|
|
|
|
my $e = do { |
270
|
|
|
|
|
|
|
local ( $?, $@ ); |
271
|
3
|
50
|
|
|
|
3
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
6
|
|
272
|
|
|
|
|
|
|
$@; |
273
|
3
|
|
|
|
|
24
|
}; |
274
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
275
|
|
|
|
|
|
|
die $e if $e; # rethrow |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
return; |
278
|
0
|
|
|
0
|
|
0
|
} |
279
|
0
|
|
0
|
|
|
0
|
|
280
|
0
|
0
|
|
|
|
0
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
|
0
|
|
|
|
|
0
|
|
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
# Accessors for foo |
283
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/4k3aHZSVhe, line 3 |
284
|
|
|
|
|
|
|
if ( $__XS ) { |
285
|
3
|
|
|
3
|
|
1500
|
Class::XSAccessor->import( |
286
|
3
|
|
33
|
|
|
9
|
chained => 1, |
287
|
3
|
|
33
|
|
|
9
|
"getters" => { "foo" => "foo" }, |
288
|
3
|
50
|
|
|
|
12
|
); |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
else { |
291
|
3
|
50
|
|
|
|
6
|
*foo = sub { @_ == 1 or Mite::Shim::croak( 'Reader "foo" usage: $self->foo()' ); $_[0]{"foo"} }; |
|
3
|
|
|
|
|
9
|
|
292
|
0
|
|
|
|
|
0
|
} |
293
|
0
|
|
|
|
|
0
|
|
294
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
295
|
0
|
|
|
|
|
0
|
BEGIN { |
296
|
|
|
|
|
|
|
|
297
|
3
|
|
|
3
|
|
18
|
|
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
636
|
|
298
|
0
|
0
|
|
|
|
0
|
our %DOES = ( "YourTest3" => 1, "YourTest2" => 1, "YourTest1" => 1 ); |
299
|
|
|
|
|
|
|
} |
300
|
3
|
|
|
|
|
15
|
|
301
|
|
|
|
|
|
|
# See UNIVERSAL |
302
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
303
|
|
|
|
|
|
|
our %DOES; |
304
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
305
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
306
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
307
|
|
|
|
|
|
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
310
|
|
|
|
|
|
|
} |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
313
|
|
|
|
|
|
|
shift->DOES( @_ ); |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
1; |