line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
package OurTest1; |
3
|
2
|
|
|
2
|
|
34
|
use strict; |
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
314
|
|
4
|
2
|
|
|
2
|
|
20
|
use warnings; |
|
2
|
|
|
|
|
34
|
|
|
2
|
|
|
|
|
286
|
|
5
|
2
|
|
|
2
|
|
30
|
no warnings qw( once void ); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
880
|
|
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
|
2
|
|
|
2
|
|
36
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "OurTest1" ); |
13
|
2
|
|
|
|
|
12
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
14
|
|
|
|
|
|
|
package Mite::Shim; |
15
|
2
|
|
|
2
|
|
20
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
28
|
|
|
2
|
|
|
|
|
986
|
|
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
|
2
|
|
|
|
|
38
|
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
|
2
|
|
|
|
|
106
|
); |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
29
|
|
|
|
|
|
|
sub __META__ { |
30
|
2
|
|
|
2
|
|
78
|
no strict 'refs'; |
|
2
|
|
|
|
|
26
|
|
|
2
|
|
|
|
|
1440
|
|
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
|
14
|
|
|
14
|
|
28
|
my ( $self, $role ) = @_; |
50
|
14
|
|
|
|
|
16
|
our %DOES; |
51
|
14
|
50
|
|
|
|
34
|
return $DOES{$role} if exists $DOES{$role}; |
52
|
14
|
50
|
|
|
|
34
|
return 1 if $role eq __PACKAGE__; |
53
|
14
|
50
|
0
|
|
|
34
|
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
|
14
|
|
|
|
|
100
|
return $self->SUPER::DOES( $role ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
60
|
|
|
|
|
|
|
sub does { |
61
|
14
|
|
|
14
|
|
1972
|
shift->DOES( @_ ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Callback which classes consuming this role will call |
65
|
|
|
|
|
|
|
sub __FINALIZE_APPLICATION__ { |
66
|
4
|
|
|
4
|
|
12
|
my ( $me, $target, $args ) = @_; |
67
|
4
|
|
|
|
|
6
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Ensure a given target only consumes this role once. |
70
|
4
|
50
|
|
|
|
10
|
if ( exists $CONSUMERS{$target} ) { |
71
|
0
|
|
|
|
|
0
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
4
|
|
|
|
|
10
|
$CONSUMERS{$target} = 1; |
74
|
|
|
|
|
|
|
|
75
|
2
|
|
|
2
|
|
20
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
|
2
|
|
|
|
|
42
|
|
|
2
|
|
|
|
|
1004
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
18
|
|
76
|
4
|
100
|
|
|
|
32
|
return if $type ne 'Mite::Class'; |
77
|
|
|
|
|
|
|
|
78
|
2
|
|
|
|
|
14
|
my @missing_methods; |
79
|
2
|
50
|
|
|
|
6
|
@missing_methods = () |
80
|
|
|
|
|
|
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
81
|
|
|
|
|
|
|
|
82
|
2
|
|
|
|
|
6
|
my @roles = ( ); |
83
|
2
|
50
|
|
|
|
4
|
my %nextargs = %{ $args || {} }; |
|
2
|
|
|
|
|
10
|
|
84
|
2
|
|
50
|
|
|
44
|
( $nextargs{-indirect} ||= 0 )++; |
85
|
2
|
50
|
|
|
|
10
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
86
|
2
|
|
|
|
|
8
|
for my $role ( @roles ) { |
87
|
0
|
|
|
|
|
0
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
2
|
|
|
|
|
4
|
my $shim = "Mite::Shim"; |
91
|
2
|
|
|
|
|
6
|
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
|
2
|
|
|
|
|
10
|
return; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
}{ |
102
|
|
|
|
|
|
|
package OurTest2; |
103
|
2
|
|
|
2
|
|
30
|
use strict; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
88
|
|
104
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
82
|
|
105
|
2
|
|
|
2
|
|
26
|
no warnings qw( once void ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
342
|
|
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
|
2
|
|
|
2
|
|
32
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "OurTest2" ); |
113
|
2
|
|
|
|
|
4
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
114
|
|
|
|
|
|
|
package Mite::Shim; |
115
|
2
|
|
|
2
|
|
40
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
562
|
|
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
|
2
|
|
|
|
|
26
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
124
|
2
|
|
|
|
|
164
|
); |
125
|
|
|
|
|
|
|
}; |
126
|
|
|
|
|
|
|
}; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
129
|
|
|
|
|
|
|
sub __META__ { |
130
|
2
|
|
|
2
|
|
20
|
no strict 'refs'; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
544
|
|
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
|
2
|
|
|
2
|
|
748
|
our %DOES = ( "OurTest2" => 1, "OurTest1" => 1 ); |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
# See UNIVERSAL |
154
|
|
|
|
|
|
|
sub DOES { |
155
|
14
|
|
|
14
|
|
26
|
my ( $self, $role ) = @_; |
156
|
14
|
|
|
|
|
16
|
our %DOES; |
157
|
14
|
50
|
|
|
|
32
|
return $DOES{$role} if exists $DOES{$role}; |
158
|
14
|
50
|
|
|
|
28
|
return 1 if $role eq __PACKAGE__; |
159
|
14
|
50
|
0
|
|
|
28
|
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
|
14
|
|
|
|
|
80
|
return $self->SUPER::DOES( $role ); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
166
|
|
|
|
|
|
|
sub does { |
167
|
14
|
|
|
14
|
|
1706
|
shift->DOES( @_ ); |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
# Methods from roles |
171
|
0
|
|
|
0
|
|
0
|
sub get_baz { goto \&OurTest1::get_baz; } |
172
|
0
|
|
|
0
|
|
0
|
sub get_foo { goto \&OurTest1::get_foo; } |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
# Callback which classes consuming this role will call |
175
|
|
|
|
|
|
|
sub __FINALIZE_APPLICATION__ { |
176
|
2
|
|
|
2
|
|
16
|
my ( $me, $target, $args ) = @_; |
177
|
2
|
|
|
|
|
8
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
# Ensure a given target only consumes this role once. |
180
|
2
|
50
|
|
|
|
8
|
if ( exists $CONSUMERS{$target} ) { |
181
|
0
|
|
|
|
|
0
|
return; |
182
|
|
|
|
|
|
|
} |
183
|
2
|
|
|
|
|
22
|
$CONSUMERS{$target} = 1; |
184
|
|
|
|
|
|
|
|
185
|
2
|
|
|
2
|
|
52
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
768
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
186
|
2
|
50
|
|
|
|
10
|
return if $type ne 'Mite::Class'; |
187
|
|
|
|
|
|
|
|
188
|
2
|
|
|
|
|
4
|
my @missing_methods; |
189
|
2
|
50
|
|
|
|
38
|
@missing_methods = () |
190
|
|
|
|
|
|
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
191
|
|
|
|
|
|
|
|
192
|
2
|
|
|
|
|
8
|
my @roles = ( "OurTest1" ); |
193
|
2
|
50
|
|
|
|
4
|
my %nextargs = %{ $args || {} }; |
|
2
|
|
|
|
|
22
|
|
194
|
2
|
|
50
|
|
|
14
|
( $nextargs{-indirect} ||= 0 )++; |
195
|
2
|
50
|
|
|
|
12
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
196
|
2
|
|
|
|
|
4
|
for my $role ( @roles ) { |
197
|
2
|
|
|
|
|
14
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
2
|
|
|
|
|
4
|
my $shim = "Mite::Shim"; |
201
|
2
|
|
|
|
|
4
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
202
|
0
|
|
|
|
|
0
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
203
|
0
|
|
|
|
|
0
|
my $handler = "HANDLE_$modification"; |
204
|
0
|
|
|
|
|
0
|
$shim->$handler( $target, "class", $names, $coderef ); |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
2
|
|
|
|
|
14
|
return; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
1; |
211
|
|
|
|
|
|
|
}{ |
212
|
|
|
|
|
|
|
package OurTest3; |
213
|
2
|
|
|
2
|
|
16
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
52
|
|
214
|
2
|
|
|
2
|
|
30
|
use warnings; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
86
|
|
215
|
2
|
|
|
2
|
|
22
|
no warnings qw( once void ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
382
|
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
218
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
219
|
|
|
|
|
|
|
our $MITE_VERSION = "0.012000"; |
220
|
|
|
|
|
|
|
# Mite keywords |
221
|
|
|
|
|
|
|
BEGIN { |
222
|
2
|
|
|
2
|
|
10
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "OurTest3" ); |
223
|
2
|
|
|
|
|
4
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
224
|
|
|
|
|
|
|
package Mite::Shim; |
225
|
2
|
|
|
2
|
|
18
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
550
|
|
226
|
|
|
|
|
|
|
( |
227
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
228
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
229
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
230
|
|
|
|
|
|
|
sub {}, |
231
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
232
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
233
|
2
|
|
|
|
|
8
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
234
|
2
|
|
|
|
|
140
|
); |
235
|
|
|
|
|
|
|
}; |
236
|
|
|
|
|
|
|
}; |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
239
|
|
|
|
|
|
|
sub __META__ { |
240
|
2
|
|
|
2
|
|
22
|
no strict 'refs'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
2050
|
|
241
|
2
|
|
33
|
2
|
|
4
|
my $class = shift; $class = ref($class) || $class; |
|
2
|
|
|
|
|
12
|
|
242
|
2
|
|
|
|
|
32
|
my $linear_isa = mro::get_linear_isa( $class ); |
243
|
|
|
|
|
|
|
return { |
244
|
|
|
|
|
|
|
BUILD => [ |
245
|
2
|
50
|
|
|
|
4
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
2
|
|
|
|
|
16
|
|
|
0
|
|
|
|
|
0
|
|
246
|
2
|
|
|
|
|
6
|
map { "$_\::BUILD" } reverse @$linear_isa |
247
|
|
|
|
|
|
|
], |
248
|
|
|
|
|
|
|
DEMOLISH => [ |
249
|
2
|
50
|
|
|
|
6
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
2
|
|
|
|
|
30
|
|
|
0
|
|
|
|
|
0
|
|
250
|
2
|
|
|
|
|
8
|
map { "$_\::DEMOLISH" } @$linear_isa |
|
2
|
|
|
|
|
4
|
|
251
|
|
|
|
|
|
|
], |
252
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
253
|
|
|
|
|
|
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
254
|
|
|
|
|
|
|
}; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
259
|
|
|
|
|
|
|
sub new { |
260
|
2
|
50
|
|
2
|
|
5088
|
my $class = ref($_[0]) ? ref(shift) : shift; |
261
|
2
|
|
33
|
|
|
14
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
262
|
2
|
|
|
|
|
6
|
my $self = bless {}, $class; |
263
|
2
|
50
|
|
|
|
10
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
264
|
2
|
|
|
|
|
4
|
my $no_build = delete $args->{__no_BUILD__}; |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
# Attribute foo |
267
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/RWkZRrKKDT, line 3 |
268
|
2
|
50
|
|
|
|
8
|
if ( exists $args->{"foo"} ) { $self->{"foo"} = $args->{"foo"}; } ; |
|
2
|
|
|
|
|
28
|
|
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
# Attribute bar |
271
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/RWkZRrKKDT, line 3 |
272
|
2
|
50
|
|
|
|
8
|
if ( exists $args->{"bar"} ) { $self->{"bar"} = $args->{"bar"}; } ; |
|
0
|
|
|
|
|
0
|
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
# Attribute baz |
275
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/RWkZRrKKDT, line 3 |
276
|
2
|
50
|
|
|
|
6
|
if ( exists $args->{"baz"} ) { $self->{"baz"} = $args->{"baz"}; } ; |
|
0
|
|
|
|
|
0
|
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
# Call BUILD methods |
280
|
2
|
50
|
33
|
|
|
6
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
|
2
|
50
|
|
|
|
24
|
|
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
# Unrecognized parameters |
283
|
2
|
50
|
|
|
|
4
|
my @unknown = grep not( /\A(?:ba[rz]|foo)\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
6
|
|
284
|
|
|
|
|
|
|
|
285
|
2
|
|
|
|
|
10
|
return $self; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
289
|
|
|
|
|
|
|
sub BUILDALL { |
290
|
0
|
|
|
0
|
|
0
|
my $class = ref( $_[0] ); |
291
|
0
|
|
0
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
292
|
0
|
0
|
|
|
|
0
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
|
0
|
|
|
|
|
0
|
|
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
296
|
|
|
|
|
|
|
sub DESTROY { |
297
|
2
|
|
|
2
|
|
856
|
my $self = shift; |
298
|
2
|
|
33
|
|
|
8
|
my $class = ref( $self ) || $self; |
299
|
2
|
|
33
|
|
|
10
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
300
|
2
|
50
|
|
|
|
26
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
301
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
302
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
303
|
2
|
50
|
|
|
|
2
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
|
2
|
|
|
|
|
12
|
|
304
|
0
|
|
|
|
|
0
|
my $e = do { |
305
|
0
|
|
|
|
|
0
|
local ( $?, $@ ); |
306
|
0
|
|
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
|
0
|
|
|
|
|
0
|
|
307
|
0
|
|
|
|
|
0
|
$@; |
308
|
|
|
|
|
|
|
}; |
309
|
2
|
|
|
2
|
|
36
|
no warnings 'misc'; # avoid (in cleanup) warnings |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
996
|
|
310
|
0
|
0
|
|
|
|
0
|
die $e if $e; # rethrow |
311
|
|
|
|
|
|
|
} |
312
|
2
|
|
|
|
|
16
|
return; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
# Accessors for bar |
318
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/RWkZRrKKDT, line 3 |
319
|
|
|
|
|
|
|
if ( $__XS ) { |
320
|
|
|
|
|
|
|
Class::XSAccessor->import( |
321
|
|
|
|
|
|
|
chained => 1, |
322
|
|
|
|
|
|
|
"getters" => { "bar" => "bar" }, |
323
|
|
|
|
|
|
|
); |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
else { |
326
|
|
|
|
|
|
|
*bar = sub { @_ == 1 or Mite::Shim::croak( 'Reader "bar" usage: $self->bar()' ); $_[0]{"bar"} }; |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
# Accessors for baz |
330
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/RWkZRrKKDT, line 3 |
331
|
|
|
|
|
|
|
if ( $__XS ) { |
332
|
|
|
|
|
|
|
Class::XSAccessor->import( |
333
|
|
|
|
|
|
|
chained => 1, |
334
|
|
|
|
|
|
|
"getters" => { "baz" => "baz" }, |
335
|
|
|
|
|
|
|
); |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
else { |
338
|
|
|
|
|
|
|
*baz = sub { @_ == 1 or Mite::Shim::croak( 'Reader "baz" usage: $self->baz()' ); $_[0]{"baz"} }; |
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
# Accessors for foo |
342
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/RWkZRrKKDT, line 3 |
343
|
|
|
|
|
|
|
if ( $__XS ) { |
344
|
|
|
|
|
|
|
Class::XSAccessor->import( |
345
|
|
|
|
|
|
|
chained => 1, |
346
|
|
|
|
|
|
|
"getters" => { "foo" => "foo" }, |
347
|
|
|
|
|
|
|
); |
348
|
|
|
|
|
|
|
} |
349
|
|
|
|
|
|
|
else { |
350
|
|
|
|
|
|
|
*foo = sub { @_ == 1 or Mite::Shim::croak( 'Reader "foo" usage: $self->foo()' ); $_[0]{"foo"} }; |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
BEGIN { |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
|
357
|
2
|
|
|
2
|
|
576
|
our %DOES = ( "OurTest3" => 1, "OurTest2" => 1, "OurTest1" => 1 ); |
358
|
|
|
|
|
|
|
} |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
# See UNIVERSAL |
361
|
|
|
|
|
|
|
sub DOES { |
362
|
22
|
|
|
22
|
|
72
|
my ( $self, $role ) = @_; |
363
|
22
|
|
|
|
|
32
|
our %DOES; |
364
|
22
|
100
|
|
|
|
74
|
return $DOES{$role} if exists $DOES{$role}; |
365
|
16
|
50
|
|
|
|
32
|
return 1 if $role eq __PACKAGE__; |
366
|
16
|
50
|
0
|
|
|
38
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
|
|
|
33
|
|
|
|
|
367
|
0
|
0
|
0
|
|
|
0
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
368
|
|
|
|
|
|
|
} |
369
|
16
|
|
|
|
|
136
|
return $self->SUPER::DOES( $role ); |
370
|
|
|
|
|
|
|
} |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
373
|
|
|
|
|
|
|
sub does { |
374
|
22
|
|
|
22
|
|
1704
|
shift->DOES( @_ ); |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
# Methods from roles |
378
|
2
|
|
|
2
|
|
8
|
sub get_bar { goto \&OurTest2::get_bar; } |
379
|
2
|
|
|
2
|
|
16
|
sub get_foo { goto \&OurTest1::get_foo; } |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
1; |
382
|
|
|
|
|
|
|
} |