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