line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
65
|
|
4
|
1
|
|
|
1
|
|
12
|
no warnings qw( once void ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
82
|
|
5
|
1
|
|
|
1
|
|
10
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
219
|
|
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", "OurTest1" ); |
12
|
1
|
|
|
1
|
|
4
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
13
|
1
|
|
|
|
|
6
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
1
|
|
|
1
|
|
7
|
sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
201
|
|
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
|
|
|
|
|
10
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
21
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
22
|
0
|
|
|
|
|
0
|
); |
23
|
0
|
|
|
|
|
0
|
}; |
24
|
1
|
|
|
|
|
51
|
|
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
|
|
6
|
BUILD => [ |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
452
|
|
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
|
|
9
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
50
|
7
|
|
|
|
|
6
|
} |
51
|
7
|
50
|
|
|
|
20
|
return $self->SUPER::DOES( $role ); |
52
|
7
|
50
|
|
|
|
10
|
} |
53
|
7
|
50
|
0
|
|
|
14
|
|
|
|
|
33
|
|
|
|
|
54
|
0
|
0
|
0
|
|
|
0
|
# Alias for Moose/Moo-compatibility |
55
|
|
|
|
|
|
|
shift->DOES( @_ ); |
56
|
7
|
|
|
|
|
34
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Callback which classes consuming this role will call |
59
|
|
|
|
|
|
|
my ( $me, $target, $args ) = @_; |
60
|
|
|
|
|
|
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
61
|
7
|
|
|
7
|
|
603
|
|
62
|
|
|
|
|
|
|
# Ensure a given target only consumes this role once. |
63
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
64
|
|
|
|
|
|
|
return; |
65
|
|
|
|
|
|
|
} |
66
|
2
|
|
|
2
|
|
5
|
$CONSUMERS{$target} = 1; |
67
|
2
|
|
|
|
|
2
|
|
68
|
|
|
|
|
|
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
69
|
|
|
|
|
|
|
return if $type ne 'Mite::Class'; |
70
|
2
|
50
|
|
|
|
4
|
|
71
|
0
|
|
|
|
|
0
|
my @missing_methods; |
72
|
|
|
|
|
|
|
@missing_methods = () |
73
|
2
|
|
|
|
|
3
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
1
|
|
10
|
my @roles = ( ); |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
264
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
6
|
|
76
|
2
|
100
|
|
|
|
6
|
my %nextargs = %{ $args || {} }; |
77
|
|
|
|
|
|
|
( $nextargs{-indirect} ||= 0 )++; |
78
|
1
|
|
|
|
|
1
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
79
|
1
|
50
|
|
|
|
4
|
for my $role ( @roles ) { |
80
|
|
|
|
|
|
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
81
|
|
|
|
|
|
|
} |
82
|
1
|
|
|
|
|
1
|
|
83
|
1
|
50
|
|
|
|
1
|
my $shim = "Mite::Shim"; |
|
1
|
|
|
|
|
4
|
|
84
|
1
|
|
50
|
|
|
3
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
85
|
1
|
50
|
|
|
|
2
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
86
|
1
|
|
|
|
|
2
|
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
|
|
|
|
|
2
|
|
98
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Role"; |
99
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
100
|
|
|
|
|
|
|
our $MITE_VERSION = "0.010008"; |
101
|
|
|
|
|
|
|
# Mite keywords |
102
|
|
|
|
|
|
|
BEGIN { |
103
|
1
|
|
|
1
|
|
110
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "OurTest2" ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
49
|
|
104
|
1
|
|
|
1
|
|
5
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
72
|
|
105
|
1
|
|
|
1
|
|
7
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
119
|
|
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
|
|
7
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
113
|
1
|
|
|
|
|
2
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
114
|
|
|
|
|
|
|
); |
115
|
1
|
|
|
1
|
|
10
|
}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
154
|
|
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
|
|
|
|
|
8
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
124
|
1
|
|
|
|
|
38
|
map { "$_\::BUILD" } reverse @$linear_isa |
125
|
|
|
|
|
|
|
], |
126
|
|
|
|
|
|
|
DEMOLISH => [ |
127
|
|
|
|
|
|
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
128
|
|
|
|
|
|
|
map { "$_\::DEMOLISH" } @$linear_isa |
129
|
|
|
|
|
|
|
], |
130
|
1
|
|
|
1
|
|
5
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
178
|
|
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
|
1
|
|
|
1
|
|
247
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
153
|
|
|
|
|
|
|
shift->DOES( @_ ); |
154
|
|
|
|
|
|
|
} |
155
|
7
|
|
|
7
|
|
9
|
|
156
|
7
|
|
|
|
|
6
|
# Methods from roles |
157
|
7
|
50
|
|
|
|
10
|
|
158
|
7
|
50
|
|
|
|
10
|
# Callback which classes consuming this role will call |
159
|
7
|
50
|
0
|
|
|
11
|
my ( $me, $target, $args ) = @_; |
|
|
|
33
|
|
|
|
|
160
|
0
|
0
|
0
|
|
|
0
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
161
|
|
|
|
|
|
|
|
162
|
7
|
|
|
|
|
26
|
# Ensure a given target only consumes this role once. |
163
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
164
|
|
|
|
|
|
|
return; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
$CONSUMERS{$target} = 1; |
167
|
7
|
|
|
7
|
|
588
|
|
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
|
1
|
|
|
1
|
|
2
|
my %nextargs = %{ $args || {} }; |
177
|
1
|
|
|
|
|
2
|
( $nextargs{-indirect} ||= 0 )++; |
178
|
|
|
|
|
|
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
179
|
|
|
|
|
|
|
for my $role ( @roles ) { |
180
|
1
|
50
|
|
|
|
2
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
181
|
0
|
|
|
|
|
0
|
} |
182
|
|
|
|
|
|
|
|
183
|
1
|
|
|
|
|
2
|
my $shim = "Mite::Shim"; |
184
|
|
|
|
|
|
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
185
|
1
|
|
|
1
|
|
5
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
266
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
2
|
|
186
|
1
|
50
|
|
|
|
3
|
my $handler = "HANDLE_$modification"; |
187
|
|
|
|
|
|
|
$shim->$handler( $target, "class", $names, $coderef ); |
188
|
1
|
|
|
|
|
2
|
} |
189
|
1
|
50
|
|
|
|
3
|
|
190
|
|
|
|
|
|
|
return; |
191
|
|
|
|
|
|
|
} |
192
|
1
|
|
|
|
|
2
|
|
193
|
1
|
50
|
|
|
|
2
|
1; |
|
1
|
|
|
|
|
5
|
|
194
|
1
|
|
50
|
|
|
6
|
use strict; |
195
|
1
|
50
|
|
|
|
3
|
use warnings; |
196
|
1
|
|
|
|
|
2
|
no warnings qw( once void ); |
197
|
1
|
|
|
|
|
3
|
|
198
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
199
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
200
|
1
|
|
|
|
|
2
|
our $MITE_VERSION = "0.010008"; |
201
|
1
|
|
|
|
|
1
|
# 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
|
1
|
|
|
|
|
3
|
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
|
1
|
|
|
1
|
|
7
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
214
|
1
|
|
|
1
|
|
5
|
); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
215
|
1
|
|
|
1
|
|
4
|
}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
95
|
|
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
|
1
|
|
|
1
|
|
3
|
BUILD => [ |
223
|
1
|
|
|
|
|
4
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
224
|
|
|
|
|
|
|
map { "$_\::BUILD" } reverse @$linear_isa |
225
|
1
|
|
|
1
|
|
7
|
], |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
177
|
|
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
|
1
|
|
|
|
|
3
|
} |
234
|
1
|
|
|
|
|
47
|
|
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
|
1
|
|
|
1
|
|
10
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
652
|
|
241
|
1
|
|
33
|
1
|
|
1
|
my $no_build = delete $args->{__no_BUILD__}; |
|
1
|
|
|
|
|
4
|
|
242
|
1
|
|
|
|
|
6
|
|
243
|
|
|
|
|
|
|
# Attribute foo |
244
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/vLY2X7vcfY, line 3 |
245
|
1
|
50
|
|
|
|
2
|
if ( exists $args->{"foo"} ) { $self->{"foo"} = $args->{"foo"}; } ; |
|
1
|
|
|
|
|
6
|
|
|
0
|
|
|
|
|
0
|
|
246
|
1
|
|
|
|
|
2
|
|
247
|
|
|
|
|
|
|
# Attribute bar |
248
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/vLY2X7vcfY, line 3 |
249
|
1
|
50
|
|
|
|
2
|
if ( exists $args->{"bar"} ) { $self->{"bar"} = $args->{"bar"}; } ; |
|
1
|
|
|
|
|
32
|
|
|
0
|
|
|
|
|
0
|
|
250
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
251
|
|
|
|
|
|
|
# Attribute baz |
252
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/vLY2X7vcfY, 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
|
1
|
50
|
|
1
|
|
1959
|
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
|
1
|
|
33
|
|
|
8
|
|
262
|
1
|
|
|
|
|
3
|
return $self; |
263
|
1
|
50
|
|
|
|
4
|
} |
|
0
|
50
|
|
|
|
0
|
|
264
|
1
|
|
|
|
|
2
|
|
265
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
266
|
|
|
|
|
|
|
my $class = ref( $_[0] ); |
267
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
268
|
1
|
50
|
|
|
|
2
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
|
1
|
|
|
|
|
5
|
|
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
272
|
1
|
50
|
|
|
|
2
|
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
|
1
|
50
|
|
|
|
2
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
|
0
|
|
|
|
|
0
|
|
277
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
278
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
279
|
|
|
|
|
|
|
my $e = do { |
280
|
1
|
50
|
33
|
|
|
4
|
local ( $?, $@ ); |
|
1
|
50
|
|
|
|
10
|
|
281
|
|
|
|
|
|
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
282
|
|
|
|
|
|
|
$@; |
283
|
1
|
50
|
|
|
|
2
|
}; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
2
|
|
284
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
285
|
1
|
|
|
|
|
4
|
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/vLY2X7vcfY, line 3 |
294
|
|
|
|
|
|
|
if ( $__XS ) { |
295
|
|
|
|
|
|
|
Class::XSAccessor->import( |
296
|
|
|
|
|
|
|
chained => 1, |
297
|
1
|
|
|
1
|
|
361
|
"getters" => { "bar" => "bar" }, |
298
|
1
|
|
33
|
|
|
3
|
); |
299
|
1
|
|
33
|
|
|
3
|
} |
300
|
1
|
50
|
|
|
|
4
|
else { |
301
|
|
|
|
|
|
|
*bar = sub { @_ == 1 or Mite::Shim::croak( 'Reader "bar" usage: $self->bar()' ); $_[0]{"bar"} }; |
302
|
|
|
|
|
|
|
} |
303
|
1
|
50
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
304
|
0
|
|
|
|
|
0
|
# Accessors for baz |
305
|
0
|
|
|
|
|
0
|
# has declaration, file ../../../../tmp/vLY2X7vcfY, line 3 |
306
|
0
|
|
|
|
|
0
|
if ( $__XS ) { |
|
0
|
|
|
|
|
0
|
|
307
|
0
|
|
|
|
|
0
|
Class::XSAccessor->import( |
308
|
|
|
|
|
|
|
chained => 1, |
309
|
1
|
|
|
1
|
|
6
|
"getters" => { "baz" => "baz" }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
295
|
|
310
|
0
|
0
|
|
|
|
0
|
); |
311
|
|
|
|
|
|
|
} |
312
|
1
|
|
|
|
|
5
|
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/vLY2X7vcfY, 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; |