line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
17
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
69
|
|
4
|
1
|
|
|
1
|
|
10
|
no warnings qw( once void ); |
|
1
|
|
|
|
|
122
|
|
|
1
|
|
|
|
|
88
|
|
5
|
1
|
|
|
1
|
|
11
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
230
|
|
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", "YourTest1" ); |
12
|
1
|
|
|
1
|
|
5
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
13
|
1
|
|
|
|
|
2
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
1
|
|
|
1
|
|
58
|
sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
266
|
|
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
|
1
|
|
|
|
|
13
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
21
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
22
|
0
|
|
|
|
|
0
|
); |
23
|
0
|
|
|
|
|
0
|
}; |
24
|
1
|
|
|
|
|
61
|
|
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
|
1
|
|
|
1
|
|
11
|
BUILD => [ |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
521
|
|
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
|
7
|
|
|
7
|
|
12
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
50
|
7
|
|
|
|
|
7
|
} |
51
|
7
|
50
|
|
|
|
14
|
return $self->SUPER::DOES( $role ); |
52
|
7
|
50
|
|
|
|
12
|
} |
53
|
7
|
50
|
0
|
|
|
14
|
|
|
|
|
33
|
|
|
|
|
54
|
0
|
0
|
0
|
|
|
0
|
# Alias for Moose/Moo-compatibility |
55
|
|
|
|
|
|
|
shift->DOES( @_ ); |
56
|
7
|
|
|
|
|
38
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Callback which classes consuming this role will call |
59
|
|
|
|
|
|
|
my ( $me, $target, $args ) = @_; |
60
|
|
|
|
|
|
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
61
|
7
|
|
|
7
|
|
611
|
|
62
|
|
|
|
|
|
|
# Ensure a given target only consumes this role once. |
63
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
64
|
|
|
|
|
|
|
return; |
65
|
|
|
|
|
|
|
} |
66
|
2
|
|
|
2
|
|
4
|
$CONSUMERS{$target} = 1; |
67
|
2
|
|
|
|
|
3
|
|
68
|
|
|
|
|
|
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
69
|
|
|
|
|
|
|
return if $type ne 'Mite::Class'; |
70
|
2
|
50
|
|
|
|
10
|
|
71
|
0
|
|
|
|
|
0
|
my @missing_methods; |
72
|
|
|
|
|
|
|
@missing_methods = () |
73
|
2
|
|
|
|
|
4
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
1
|
|
13
|
my @roles = ( ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
318
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
76
|
2
|
100
|
|
|
|
10
|
my %nextargs = %{ $args || {} }; |
77
|
|
|
|
|
|
|
( $nextargs{-indirect} ||= 0 )++; |
78
|
1
|
|
|
|
|
2
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
79
|
1
|
50
|
|
|
|
3
|
for my $role ( @roles ) { |
80
|
|
|
|
|
|
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
81
|
|
|
|
|
|
|
} |
82
|
1
|
|
|
|
|
1
|
|
83
|
1
|
50
|
|
|
|
2
|
my $shim = "Mite::Shim"; |
|
1
|
|
|
|
|
4
|
|
84
|
1
|
|
50
|
|
|
3
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
85
|
1
|
50
|
|
|
|
12
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
86
|
1
|
|
|
|
|
3
|
my $handler = "HANDLE_$modification"; |
87
|
0
|
|
|
|
|
0
|
$shim->$handler( $target, "class", $names, $coderef ); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
1
|
|
|
|
|
2
|
return; |
91
|
1
|
|
|
|
|
2
|
} |
92
|
0
|
|
|
|
|
0
|
|
93
|
0
|
|
|
|
|
0
|
1; |
94
|
0
|
|
|
|
|
0
|
use strict; |
95
|
|
|
|
|
|
|
use warnings; |
96
|
|
|
|
|
|
|
no warnings qw( once void ); |
97
|
1
|
|
|
|
|
4
|
|
98
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Role"; |
99
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
100
|
|
|
|
|
|
|
our $MITE_VERSION = "0.011000"; |
101
|
|
|
|
|
|
|
# Mite keywords |
102
|
|
|
|
|
|
|
BEGIN { |
103
|
1
|
|
|
1
|
|
13
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "YourTest2" ); |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
44
|
|
104
|
1
|
|
|
1
|
|
14
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
73
|
|
105
|
1
|
|
|
1
|
|
7
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
110
|
|
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
|
1
|
|
|
1
|
|
4
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
113
|
1
|
|
|
|
|
2
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
114
|
|
|
|
|
|
|
); |
115
|
1
|
|
|
1
|
|
7
|
}; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
254
|
|
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
|
1
|
|
|
|
|
6
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
124
|
1
|
|
|
|
|
47
|
map { "$_\::BUILD" } reverse @$linear_isa |
125
|
|
|
|
|
|
|
], |
126
|
|
|
|
|
|
|
DEMOLISH => [ |
127
|
|
|
|
|
|
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
128
|
|
|
|
|
|
|
map { "$_\::DEMOLISH" } @$linear_isa |
129
|
|
|
|
|
|
|
], |
130
|
1
|
|
|
1
|
|
6
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
214
|
|
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
|
1
|
|
|
1
|
|
235
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
153
|
|
|
|
|
|
|
shift->DOES( @_ ); |
154
|
|
|
|
|
|
|
} |
155
|
7
|
|
|
7
|
|
13
|
|
156
|
7
|
|
|
|
|
7
|
# Callback which classes consuming this role will call |
157
|
7
|
50
|
|
|
|
12
|
my ( $me, $target, $args ) = @_; |
158
|
7
|
50
|
|
|
|
12
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
159
|
7
|
50
|
0
|
|
|
11
|
|
|
|
|
33
|
|
|
|
|
160
|
0
|
0
|
0
|
|
|
0
|
# Ensure a given target only consumes this role once. |
161
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
162
|
7
|
|
|
|
|
37
|
return; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
$CONSUMERS{$target} = 1; |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
167
|
7
|
|
|
7
|
|
729
|
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
|
1
|
|
|
1
|
|
3
|
|
173
|
1
|
|
|
|
|
2
|
my @roles = ( "YourTest1" ); |
174
|
|
|
|
|
|
|
my %nextargs = %{ $args || {} }; |
175
|
|
|
|
|
|
|
( $nextargs{-indirect} ||= 0 )++; |
176
|
1
|
50
|
|
|
|
5
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
177
|
0
|
|
|
|
|
0
|
for my $role ( @roles ) { |
178
|
|
|
|
|
|
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
179
|
1
|
|
|
|
|
2
|
} |
180
|
|
|
|
|
|
|
|
181
|
1
|
|
|
1
|
|
7
|
my $shim = "Mite::Shim"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
300
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
182
|
1
|
50
|
|
|
|
3
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
183
|
|
|
|
|
|
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
184
|
1
|
|
|
|
|
2
|
my $handler = "HANDLE_$modification"; |
185
|
1
|
50
|
|
|
|
3
|
$shim->$handler( $target, "class", $names, $coderef ); |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
1
|
|
|
|
|
2
|
return; |
189
|
1
|
50
|
|
|
|
2
|
} |
|
1
|
|
|
|
|
7
|
|
190
|
1
|
|
50
|
|
|
7
|
|
191
|
1
|
50
|
|
|
|
4
|
1; |
192
|
1
|
|
|
|
|
1
|
use strict; |
193
|
1
|
|
|
|
|
5
|
use warnings; |
194
|
|
|
|
|
|
|
no warnings qw( once void ); |
195
|
|
|
|
|
|
|
|
196
|
1
|
|
|
|
|
2
|
our $USES_MITE = "Mite::Class"; |
197
|
1
|
|
|
|
|
1
|
our $MITE_SHIM = "Mite::Shim"; |
198
|
0
|
|
|
|
|
0
|
our $MITE_VERSION = "0.011000"; |
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
|
1
|
|
|
|
|
5
|
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
|
1
|
|
|
1
|
|
10
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
210
|
1
|
|
|
1
|
|
4
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
38
|
|
211
|
1
|
|
|
1
|
|
6
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
130
|
|
212
|
|
|
|
|
|
|
); |
213
|
|
|
|
|
|
|
}; |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
216
|
|
|
|
|
|
|
no strict 'refs'; |
217
|
|
|
|
|
|
|
my $class = shift; $class = ref($class) || $class; |
218
|
1
|
|
|
1
|
|
4
|
my $linear_isa = mro::get_linear_isa( $class ); |
219
|
1
|
|
|
|
|
1
|
return { |
220
|
|
|
|
|
|
|
BUILD => [ |
221
|
1
|
|
|
1
|
|
7
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
173
|
|
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
|
1
|
|
|
|
|
3
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
230
|
1
|
|
|
|
|
57
|
}; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
235
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
236
|
1
|
|
|
1
|
|
6
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
692
|
|
237
|
1
|
|
33
|
1
|
|
2
|
my $self = bless {}, $class; |
|
1
|
|
|
|
|
5
|
|
238
|
1
|
|
|
|
|
5
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
239
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
240
|
|
|
|
|
|
|
|
241
|
1
|
50
|
|
|
|
2
|
# Attribute foo |
|
1
|
|
|
|
|
6
|
|
|
0
|
|
|
|
|
0
|
|
242
|
1
|
|
|
|
|
4
|
# has declaration, file ../../../../tmp/zT9igim1nC, line 3 |
243
|
|
|
|
|
|
|
if ( exists $args->{"foo"} ) { $self->{"foo"} = $args->{"foo"}; } ; |
244
|
|
|
|
|
|
|
|
245
|
1
|
50
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
|
0
|
|
|
|
|
0
|
|
246
|
1
|
|
|
|
|
2
|
# Call BUILD methods |
|
1
|
|
|
|
|
3
|
|
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
|
1
|
50
|
|
1
|
|
3161
|
my $class = ref( $_[0] ); |
257
|
1
|
|
33
|
|
|
9
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
258
|
1
|
|
|
|
|
3
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
259
|
1
|
50
|
|
|
|
5
|
} |
|
0
|
50
|
|
|
|
0
|
|
260
|
1
|
|
|
|
|
2
|
|
261
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
262
|
|
|
|
|
|
|
my $self = shift; |
263
|
|
|
|
|
|
|
my $class = ref( $self ) || $self; |
264
|
1
|
50
|
|
|
|
3
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
|
1
|
|
|
|
|
4
|
|
265
|
|
|
|
|
|
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
266
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
267
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
268
|
1
|
50
|
33
|
|
|
3
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
|
1
|
50
|
|
|
|
18
|
|
269
|
|
|
|
|
|
|
my $e = do { |
270
|
|
|
|
|
|
|
local ( $?, $@ ); |
271
|
1
|
50
|
|
|
|
2
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
3
|
|
272
|
|
|
|
|
|
|
$@; |
273
|
1
|
|
|
|
|
8
|
}; |
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/zT9igim1nC, line 3 |
284
|
|
|
|
|
|
|
if ( $__XS ) { |
285
|
1
|
|
|
1
|
|
591
|
Class::XSAccessor->import( |
286
|
1
|
|
33
|
|
|
4
|
chained => 1, |
287
|
1
|
|
33
|
|
|
4
|
"getters" => { "foo" => "foo" }, |
288
|
1
|
50
|
|
|
|
4
|
); |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
else { |
291
|
1
|
50
|
|
|
|
2
|
*foo = sub { @_ == 1 or Mite::Shim::croak( 'Reader "foo" usage: $self->foo()' ); $_[0]{"foo"} }; |
|
1
|
|
|
|
|
4
|
|
292
|
0
|
|
|
|
|
0
|
} |
293
|
0
|
|
|
|
|
0
|
|
294
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
295
|
0
|
|
|
|
|
0
|
BEGIN { |
296
|
|
|
|
|
|
|
|
297
|
1
|
|
|
1
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
227
|
|
298
|
0
|
0
|
|
|
|
0
|
our %DOES = ( "YourTest3" => 1, "YourTest2" => 1, "YourTest1" => 1 ); |
299
|
|
|
|
|
|
|
} |
300
|
1
|
|
|
|
|
11
|
|
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; |