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
|
|
5
|
no warnings qw( once void ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
5
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
117
|
|
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
|
|
|
|
|
1
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
1
|
|
|
1
|
|
6
|
sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
173
|
|
16
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "role", @_ ) }, |
17
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "role", @_ ) }, |
18
|
1
|
|
|
|
|
4
|
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
|
|
|
|
|
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
|
|
13
|
BUILD => [ |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
437
|
|
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
|
|
|
|
|
7
|
} |
51
|
7
|
50
|
|
|
|
11
|
return $self->SUPER::DOES( $role ); |
52
|
7
|
50
|
|
|
|
8
|
} |
53
|
7
|
50
|
0
|
|
|
13
|
|
|
|
|
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
|
|
1790
|
|
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 = grep( !$target->can($_), "xyz", "zyx" ) |
73
|
1
|
|
|
|
|
2
|
and Mite::Shim::croak( "$me requires $target to implement methods: " . join q[, ], @missing_methods ); |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
1
|
|
6
|
my @roles = ( ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
310
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1
|
|
|
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
|
|
|
|
7
|
for my $role ( @roles ) { |
80
|
|
|
|
|
|
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
81
|
|
|
|
|
|
|
} |
82
|
1
|
|
|
|
|
2
|
|
83
|
1
|
50
|
|
|
|
2
|
my $shim = "Mite::Shim"; |
|
1
|
|
|
|
|
7
|
|
84
|
1
|
|
50
|
|
|
6
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
85
|
1
|
50
|
|
|
|
3
|
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
|
|
|
|
|
1
|
return; |
91
|
1
|
|
|
|
|
24
|
} |
92
|
1
|
|
|
|
|
4
|
|
93
|
1
|
|
|
|
|
2
|
1; |
94
|
1
|
|
|
|
|
5
|
use strict; |
95
|
|
|
|
|
|
|
use warnings; |
96
|
|
|
|
|
|
|
no warnings qw( once void ); |
97
|
1
|
|
|
|
|
7
|
|
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
|
|
7
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest2" ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
104
|
1
|
|
|
1
|
|
3
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
105
|
1
|
|
|
1
|
|
7
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
105
|
|
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
|
|
5
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
113
|
1
|
|
|
|
|
1
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
114
|
|
|
|
|
|
|
); |
115
|
1
|
|
|
1
|
|
15
|
}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
163
|
|
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
|
|
|
|
|
3
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
124
|
1
|
|
|
|
|
47
|
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
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
529
|
|
131
|
0
|
|
0
|
0
|
|
0
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
0
|
|
|
|
|
0
|
|
132
|
0
|
|
|
|
|
0
|
}; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
136
|
0
|
|
|
|
|
0
|
# Standard Moose/Moo-style constructor |
137
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
138
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
139
|
0
|
0
|
|
|
|
0
|
my $self = bless {}, $class; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
140
|
0
|
|
|
|
|
0
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
|
0
|
|
|
|
|
0
|
|
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
|
0
|
0
|
|
0
|
|
0
|
return $self; |
151
|
0
|
|
0
|
|
|
0
|
} |
152
|
0
|
|
|
|
|
0
|
|
153
|
0
|
0
|
|
|
|
0
|
# Used by constructor to call BUILD methods |
|
0
|
0
|
|
|
|
0
|
|
154
|
0
|
|
|
|
|
0
|
my $class = ref( $_[0] ); |
155
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
156
|
|
|
|
|
|
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
0
|
0
|
0
|
|
|
0
|
# Destructor should call DEMOLISH methods |
|
0
|
0
|
|
|
|
0
|
|
160
|
|
|
|
|
|
|
my $self = shift; |
161
|
|
|
|
|
|
|
my $class = ref( $self ) || $self; |
162
|
0
|
0
|
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
163
|
|
|
|
|
|
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
164
|
0
|
|
|
|
|
0
|
? ${^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
|
0
|
|
|
0
|
|
0
|
} |
177
|
0
|
|
0
|
|
|
0
|
|
178
|
0
|
|
0
|
|
|
0
|
|
179
|
0
|
0
|
|
|
|
0
|
BEGIN { |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
|
182
|
0
|
0
|
|
|
|
0
|
our %DOES = ( "MyTest2" => 1, "MyTest1" => 1 ); |
|
0
|
|
|
|
|
0
|
|
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
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
78
|
|
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
|
0
|
|
|
|
|
0
|
$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
|
|
170
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
1; |