| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
{ |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use strict; |
|
4
|
108
|
|
|
108
|
|
784
|
use warnings; |
|
|
108
|
|
|
|
|
258
|
|
|
|
108
|
|
|
|
|
3059
|
|
|
5
|
108
|
|
|
108
|
|
518
|
no warnings qw( once void ); |
|
|
108
|
|
|
|
|
238
|
|
|
|
108
|
|
|
|
|
3496
|
|
|
6
|
108
|
|
|
108
|
|
489
|
|
|
|
108
|
|
|
|
|
213
|
|
|
|
108
|
|
|
|
|
12019
|
|
|
7
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Role"; |
|
8
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
|
9
|
|
|
|
|
|
|
our $MITE_VERSION = "0.010007"; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Mite keywords |
|
12
|
|
|
|
|
|
|
BEGIN { |
|
13
|
|
|
|
|
|
|
my ( $SHIM, $CALLER ) = |
|
14
|
108
|
|
|
108
|
|
586
|
( "Mite::Shim", "Mite::Trait::HasRoles" ); |
|
15
|
|
|
|
|
|
|
( |
|
16
|
|
|
|
|
|
|
*after, *around, *before, |
|
17
|
|
|
|
|
|
|
*field, *has, *param, |
|
18
|
|
|
|
|
|
|
*requires, *signature_for, *with |
|
19
|
|
|
|
|
|
|
) |
|
20
|
|
|
|
|
|
|
= do { |
|
21
|
108
|
|
|
|
|
232
|
|
|
22
|
|
|
|
|
|
|
no warnings 'redefine'; |
|
23
|
|
|
|
|
|
|
( |
|
24
|
108
|
|
|
108
|
|
669
|
sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, |
|
|
108
|
|
|
|
|
264
|
|
|
|
108
|
|
|
|
|
22516
|
|
|
25
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "role", @_ ) }, |
|
26
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "role", @_ ) }, |
|
27
|
216
|
|
|
216
|
|
747
|
sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) }, |
|
28
|
108
|
|
|
108
|
|
618
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
|
29
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
|
30
|
216
|
|
|
216
|
|
129541
|
sub { }, |
|
31
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
|
32
|
|
|
|
108
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
|
33
|
0
|
|
|
0
|
|
0
|
); |
|
34
|
0
|
|
|
0
|
|
0
|
} |
|
35
|
108
|
|
|
|
|
16918
|
|
|
36
|
|
|
|
|
|
|
# Mite imports |
|
37
|
|
|
|
|
|
|
BEGIN { |
|
38
|
|
|
|
|
|
|
require Scalar::Util; |
|
39
|
|
|
|
|
|
|
*STRICT = \&Mite::Shim::STRICT; |
|
40
|
|
|
|
|
|
|
*bare = \&Mite::Shim::bare; |
|
41
|
108
|
|
|
108
|
|
737
|
*blessed = \&Scalar::Util::blessed; |
|
42
|
108
|
|
|
|
|
349
|
*carp = \&Mite::Shim::carp; |
|
43
|
108
|
|
|
|
|
321
|
*confess = \&Mite::Shim::confess; |
|
44
|
108
|
|
|
|
|
254
|
*croak = \&Mite::Shim::croak; |
|
45
|
108
|
|
|
|
|
261
|
*false = \&Mite::Shim::false; |
|
46
|
108
|
|
|
|
|
202
|
*guard = \&Mite::Shim::guard; |
|
47
|
108
|
|
|
|
|
278
|
*lazy = \&Mite::Shim::lazy; |
|
48
|
108
|
|
|
|
|
248
|
*ro = \&Mite::Shim::ro; |
|
49
|
108
|
|
|
|
|
233
|
*rw = \&Mite::Shim::rw; |
|
50
|
108
|
|
|
|
|
261
|
*rwp = \&Mite::Shim::rwp; |
|
51
|
108
|
|
|
|
|
205
|
*true = \&Mite::Shim::true; |
|
52
|
108
|
|
|
|
|
227
|
} |
|
53
|
108
|
|
|
|
|
273
|
|
|
54
|
108
|
|
|
|
|
3562
|
# Gather metadata for constructor and destructor |
|
55
|
|
|
|
|
|
|
no strict 'refs'; |
|
56
|
|
|
|
|
|
|
my $class = shift; |
|
57
|
|
|
|
|
|
|
$class = ref($class) || $class; |
|
58
|
|
|
|
|
|
|
my $linear_isa = mro::get_linear_isa($class); |
|
59
|
108
|
|
|
108
|
|
633
|
return { |
|
|
108
|
|
|
|
|
222
|
|
|
|
108
|
|
|
|
|
35007
|
|
|
60
|
0
|
|
|
0
|
|
0
|
BUILD => [ |
|
61
|
0
|
|
0
|
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
62
|
0
|
|
|
|
|
0
|
map { "$_\::BUILD" } reverse @$linear_isa |
|
63
|
|
|
|
|
|
|
], |
|
64
|
|
|
|
|
|
|
DEMOLISH => [ |
|
65
|
0
|
0
|
|
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
66
|
0
|
|
|
|
|
0
|
map { "$_\::DEMOLISH" } @$linear_isa |
|
67
|
|
|
|
|
|
|
], |
|
68
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
|
69
|
0
|
0
|
|
|
|
0
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
70
|
0
|
|
|
|
|
0
|
}; |
|
|
0
|
|
|
|
|
0
|
|
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# See UNIVERSAL |
|
74
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
|
75
|
|
|
|
|
|
|
our %DOES; |
|
76
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
|
77
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
|
78
|
|
|
|
|
|
|
return $self->SUPER::DOES($role); |
|
79
|
0
|
|
|
0
|
0
|
0
|
} |
|
80
|
0
|
|
|
|
|
0
|
|
|
81
|
0
|
0
|
|
|
|
0
|
# Alias for Moose/Moo-compatibility |
|
82
|
0
|
0
|
|
|
|
0
|
shift->DOES(@_); |
|
83
|
0
|
|
|
|
|
0
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Callback which classes consuming this role will call |
|
86
|
|
|
|
|
|
|
my ( $me, $target, $args ) = @_; |
|
87
|
|
|
|
|
|
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
|
88
|
0
|
|
|
0
|
0
|
0
|
|
|
89
|
|
|
|
|
|
|
# Ensure a given target only consumes this role once. |
|
90
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
|
91
|
|
|
|
|
|
|
return; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
123
|
|
|
123
|
|
390
|
$CONSUMERS{$target} = 1; |
|
94
|
123
|
|
|
|
|
214
|
|
|
95
|
|
|
|
|
|
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
|
96
|
|
|
|
|
|
|
return if $type ne 'Mite::Class'; |
|
97
|
123
|
50
|
|
|
|
429
|
|
|
98
|
0
|
|
|
|
|
0
|
my @missing_methods; |
|
99
|
|
|
|
|
|
|
@missing_methods = grep( !$target->can($_), |
|
100
|
123
|
|
|
|
|
331
|
"_compile_mop_postamble", "compilation_stages", |
|
101
|
|
|
|
|
|
|
"inject_mite_functions", "native_methods", |
|
102
|
108
|
|
|
108
|
|
791
|
"source" ) |
|
|
108
|
|
|
|
|
262
|
|
|
|
108
|
|
|
|
|
28992
|
|
|
|
123
|
|
|
|
|
237
|
|
|
|
123
|
|
|
|
|
210
|
|
|
|
123
|
|
|
|
|
516
|
|
|
103
|
123
|
50
|
|
|
|
470
|
and croak( "$me requires $target to implement methods: " . join q[, ], |
|
104
|
|
|
|
|
|
|
@missing_methods ); |
|
105
|
123
|
|
|
|
|
248
|
|
|
106
|
123
|
50
|
|
|
|
1949
|
my @roles = (); |
|
107
|
|
|
|
|
|
|
my %nextargs = %{ $args || {} }; |
|
108
|
|
|
|
|
|
|
( $nextargs{-indirect} ||= 0 )++; |
|
109
|
|
|
|
|
|
|
croak("PANIC!") if $nextargs{-indirect} > 100; |
|
110
|
|
|
|
|
|
|
for my $role (@roles) { |
|
111
|
|
|
|
|
|
|
$role->__FINALIZE_APPLICATION__( $target, {%nextargs} ); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
123
|
|
|
|
|
300
|
|
|
114
|
123
|
50
|
|
|
|
273
|
my $shim = "Mite::Shim"; |
|
|
123
|
|
|
|
|
1175
|
|
|
115
|
123
|
|
50
|
|
|
937
|
for my $modifier_rule (@METHOD_MODIFIERS) { |
|
116
|
123
|
50
|
|
|
|
514
|
my ( $modification, $names, $coderef ) = @$modifier_rule; |
|
117
|
123
|
|
|
|
|
310
|
my $handler = "HANDLE_$modification"; |
|
118
|
0
|
|
|
|
|
0
|
$shim->$handler( $target, "class", $names, $coderef ); |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
123
|
|
|
|
|
266
|
return; |
|
122
|
123
|
|
|
|
|
320
|
} |
|
123
|
369
|
|
|
|
|
959
|
|
|
124
|
369
|
|
|
|
|
853
|
1; |
|
125
|
369
|
|
|
|
|
1251
|
|