line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
4
|
no warnings qw( once void ); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
137
|
|
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", "MyTest1" ); |
12
|
1
|
|
|
1
|
|
4
|
( *after, *around, *before, *has, *requires, *signature_for, *with ) = do { |
13
|
1
|
|
|
|
|
2
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
1
|
|
|
1
|
|
5
|
sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
202
|
|
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
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
21
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
22
|
0
|
|
|
|
|
0
|
); |
23
|
0
|
|
|
|
|
0
|
}; |
24
|
1
|
|
|
|
|
58
|
|
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
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
372
|
|
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
|
|
|
|
|
15
|
} |
51
|
7
|
50
|
|
|
|
11
|
return $self->SUPER::DOES( $role ); |
52
|
7
|
50
|
|
|
|
9
|
} |
53
|
7
|
50
|
0
|
|
|
11
|
|
|
|
|
33
|
|
|
|
|
54
|
0
|
0
|
0
|
|
|
0
|
# Alias for Moose/Moo-compatibility |
55
|
|
|
|
|
|
|
shift->DOES( @_ ); |
56
|
7
|
|
|
|
|
30
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Callback which classes consuming this role will call |
59
|
|
|
|
|
|
|
my ( $me, $target, $args ) = @_; |
60
|
|
|
|
|
|
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
61
|
7
|
|
|
7
|
|
1739
|
|
62
|
|
|
|
|
|
|
# Ensure a given target only consumes this role once. |
63
|
|
|
|
|
|
|
if ( exists $CONSUMERS{$target} ) { |
64
|
|
|
|
|
|
|
return; |
65
|
|
|
|
|
|
|
} |
66
|
1
|
|
|
1
|
|
2
|
$CONSUMERS{$target} = 1; |
67
|
1
|
|
|
|
|
1
|
|
68
|
|
|
|
|
|
|
my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; |
69
|
|
|
|
|
|
|
return if $type ne 'Mite::Class'; |
70
|
1
|
50
|
|
|
|
3
|
|
71
|
0
|
|
|
|
|
0
|
my @missing_methods; |
72
|
|
|
|
|
|
|
@missing_methods = () |
73
|
1
|
|
|
|
|
2
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
1
|
|
7
|
my @roles = ( ); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
253
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
76
|
1
|
50
|
|
|
|
3
|
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
|
|
|
|
1
|
my $shim = "Mite::Shim"; |
|
1
|
|
|
|
|
5
|
|
84
|
1
|
|
50
|
|
|
7
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
85
|
1
|
50
|
|
|
|
4
|
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
|
|
|
|
|
3
|
} |
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::Class"; |
99
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
100
|
|
|
|
|
|
|
our $MITE_VERSION = "0.010008"; |
101
|
|
|
|
|
|
|
# Mite keywords |
102
|
|
|
|
|
|
|
BEGIN { |
103
|
1
|
|
|
1
|
|
5
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest2" ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
104
|
1
|
|
|
1
|
|
3
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
|
1
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
32
|
|
105
|
1
|
|
|
1
|
|
6
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
94
|
|
106
|
|
|
|
|
|
|
( |
107
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
108
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
109
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
110
|
|
|
|
|
|
|
sub {}, |
111
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
112
|
1
|
|
|
1
|
|
3
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
113
|
1
|
|
|
|
|
3
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
114
|
|
|
|
|
|
|
); |
115
|
1
|
|
|
1
|
|
6
|
}; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
192
|
|
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
|
|
|
|
|
|
|
my $linear_isa = mro::get_linear_isa( $class ); |
121
|
0
|
|
|
|
|
0
|
return { |
122
|
0
|
|
|
|
|
0
|
BUILD => [ |
123
|
1
|
|
|
|
|
4
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
124
|
1
|
|
|
|
|
37
|
map { "$_\::BUILD" } reverse @$linear_isa |
125
|
|
|
|
|
|
|
], |
126
|
|
|
|
|
|
|
DEMOLISH => [ |
127
|
|
|
|
|
|
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
128
|
|
|
|
|
|
|
map { "$_\::DEMOLISH" } @$linear_isa |
129
|
|
|
|
|
|
|
], |
130
|
1
|
|
|
1
|
|
23
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
541
|
|
131
|
1
|
|
33
|
1
|
|
2
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
1
|
|
|
|
|
12
|
|
132
|
1
|
|
|
|
|
8
|
}; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
1
|
50
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
|
0
|
|
|
|
|
0
|
|
136
|
1
|
|
|
|
|
3
|
# Standard Moose/Moo-style constructor |
137
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
138
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
139
|
1
|
50
|
|
|
|
2
|
my $self = bless {}, $class; |
|
1
|
|
|
|
|
16
|
|
|
0
|
|
|
|
|
0
|
|
140
|
1
|
|
|
|
|
3
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
|
1
|
|
|
|
|
11
|
|
141
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# Call BUILD methods |
146
|
|
|
|
|
|
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
# Unrecognized parameters |
149
|
|
|
|
|
|
|
|
150
|
1
|
50
|
|
1
|
|
171
|
return $self; |
151
|
1
|
|
33
|
|
|
5
|
} |
152
|
1
|
|
|
|
|
2
|
|
153
|
1
|
50
|
|
|
|
5
|
# Used by constructor to call BUILD methods |
|
0
|
50
|
|
|
|
0
|
|
154
|
1
|
|
|
|
|
22
|
my $class = ref( $_[0] ); |
155
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
156
|
|
|
|
|
|
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
1
|
50
|
33
|
|
|
5
|
# Destructor should call DEMOLISH methods |
|
1
|
50
|
|
|
|
11
|
|
160
|
|
|
|
|
|
|
my $self = shift; |
161
|
|
|
|
|
|
|
my $class = ref( $self ) || $self; |
162
|
1
|
0
|
|
|
|
2
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
50
|
|
|
|
0
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
163
|
|
|
|
|
|
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
164
|
1
|
|
|
|
|
14
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
165
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
166
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
167
|
|
|
|
|
|
|
my $e = do { |
168
|
|
|
|
|
|
|
local ( $?, $@ ); |
169
|
0
|
|
|
0
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
170
|
0
|
|
0
|
|
|
0
|
$@; |
171
|
0
|
0
|
|
|
|
0
|
}; |
|
0
|
|
|
|
|
0
|
|
172
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
173
|
|
|
|
|
|
|
die $e if $e; # rethrow |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
return; |
176
|
1
|
|
|
1
|
|
364
|
} |
177
|
1
|
|
33
|
|
|
4
|
|
178
|
1
|
|
33
|
|
|
3
|
|
179
|
1
|
50
|
|
|
|
4
|
BEGIN { |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
1
|
50
|
|
|
|
1
|
our %DOES = ( "MyTest2" => 1, "MyTest1" => 1 ); |
|
1
|
|
|
|
|
3
|
|
183
|
0
|
|
|
|
|
0
|
} |
184
|
0
|
|
|
|
|
0
|
|
185
|
0
|
|
|
|
|
0
|
# See UNIVERSAL |
|
0
|
|
|
|
|
0
|
|
186
|
0
|
|
|
|
|
0
|
my ( $self, $role ) = @_; |
187
|
|
|
|
|
|
|
our %DOES; |
188
|
1
|
|
|
1
|
|
6
|
return $DOES{$role} if exists $DOES{$role}; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
80
|
|
189
|
0
|
0
|
|
|
|
0
|
return 1 if $role eq __PACKAGE__; |
190
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
191
|
1
|
|
|
|
|
10
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
197
|
|
|
|
|
|
|
shift->DOES( @_ ); |
198
|
1
|
|
|
1
|
|
224
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
# Methods from roles |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
1; |