line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
4
|
no warnings qw( once void ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
5
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
143
|
|
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
|
|
6
|
sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
185
|
|
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
|
1
|
|
|
|
|
6
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, |
21
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
22
|
0
|
|
|
|
|
0
|
); |
23
|
0
|
|
|
|
|
0
|
}; |
24
|
1
|
|
|
|
|
53
|
|
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
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
368
|
|
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
|
|
11
|
$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
|
|
|
|
9
|
} |
53
|
7
|
50
|
0
|
|
|
17
|
|
|
|
|
33
|
|
|
|
|
54
|
0
|
0
|
0
|
|
|
0
|
# Alias for Moose/Moo-compatibility |
55
|
|
|
|
|
|
|
shift->DOES( @_ ); |
56
|
7
|
|
|
|
|
33
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Callback which classes consuming this role will call |
59
|
|
|
|
|
|
|
my ( $me, $target, $args ) = @_; |
60
|
|
|
|
|
|
|
our ( %CONSUMERS, @METHOD_MODIFIERS ); |
61
|
7
|
|
|
7
|
|
1983
|
|
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
|
|
|
|
4
|
|
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
|
|
16
|
my @roles = ( ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
262
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
76
|
1
|
50
|
|
|
|
4
|
my %nextargs = %{ $args || {} }; |
77
|
|
|
|
|
|
|
( $nextargs{-indirect} ||= 0 )++; |
78
|
1
|
|
|
|
|
24
|
Mite::Shim::croak( "PANIC!" ) if $nextargs{-indirect} > 100; |
79
|
1
|
50
|
|
|
|
5
|
for my $role ( @roles ) { |
80
|
|
|
|
|
|
|
$role->__FINALIZE_APPLICATION__( $target, { %nextargs } ); |
81
|
|
|
|
|
|
|
} |
82
|
1
|
|
|
|
|
2
|
|
83
|
1
|
50
|
|
|
|
1
|
my $shim = "Mite::Shim"; |
|
1
|
|
|
|
|
7
|
|
84
|
1
|
|
50
|
|
|
22
|
for my $modifier_rule ( @METHOD_MODIFIERS ) { |
85
|
1
|
50
|
|
|
|
7
|
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
|
|
|
|
|
4
|
} |
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
|
|
6
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest2" ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
104
|
1
|
|
|
1
|
|
5
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
105
|
1
|
|
|
1
|
|
6
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
98
|
|
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
|
|
6
|
}; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
171
|
|
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
|
1
|
|
|
|
|
4
|
return { |
122
|
0
|
|
|
|
|
0
|
BUILD => [ |
123
|
1
|
|
|
|
|
4
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
124
|
1
|
|
|
|
|
55
|
map { "$_\::BUILD" } reverse @$linear_isa |
125
|
|
|
|
|
|
|
], |
126
|
|
|
|
|
|
|
DEMOLISH => [ |
127
|
|
|
|
|
|
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
128
|
|
|
|
|
|
|
map { "$_\::DEMOLISH" } @$linear_isa |
129
|
|
|
|
|
|
|
], |
130
|
1
|
|
|
1
|
|
6
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
538
|
|
131
|
1
|
|
33
|
1
|
|
2
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
1
|
|
|
|
|
4
|
|
132
|
1
|
|
|
|
|
6
|
}; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
1
|
50
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
|
0
|
|
|
|
|
0
|
|
136
|
1
|
|
|
|
|
12
|
# Standard Moose/Moo-style constructor |
137
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
138
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
139
|
1
|
50
|
|
|
|
3
|
my $self = bless {}, $class; |
|
1
|
|
|
|
|
28
|
|
|
0
|
|
|
|
|
0
|
|
140
|
1
|
|
|
|
|
3
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
|
1
|
|
|
|
|
16
|
|
141
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
# Attribute abc |
144
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/vER6fMg7yO, line 7 |
145
|
|
|
|
|
|
|
$self->{"abc"} = ( exists( $args->{"abc"} ) ? $args->{"abc"} : "456" ); |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
# Call BUILD methods |
149
|
|
|
|
|
|
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
150
|
1
|
50
|
|
1
|
|
152
|
|
151
|
1
|
|
33
|
|
|
6
|
# Unrecognized parameters |
152
|
1
|
|
|
|
|
4
|
my @unknown = grep not( /\Aabc\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
153
|
1
|
50
|
|
|
|
6
|
|
|
0
|
50
|
|
|
|
0
|
|
154
|
1
|
|
|
|
|
2
|
return $self; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
158
|
1
|
50
|
|
|
|
5
|
my $class = ref( $_[0] ); |
159
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
160
|
|
|
|
|
|
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
161
|
|
|
|
|
|
|
} |
162
|
1
|
50
|
33
|
|
|
6
|
|
|
1
|
50
|
|
|
|
4
|
|
163
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
164
|
|
|
|
|
|
|
my $self = shift; |
165
|
1
|
50
|
|
|
|
2
|
my $class = ref( $self ) || $self; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
166
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
167
|
1
|
|
|
|
|
4
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
168
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
169
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
170
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
171
|
|
|
|
|
|
|
my $e = do { |
172
|
0
|
|
|
0
|
|
0
|
local ( $?, $@ ); |
173
|
0
|
|
0
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
174
|
0
|
0
|
|
|
|
0
|
$@; |
|
0
|
|
|
|
|
0
|
|
175
|
|
|
|
|
|
|
}; |
176
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
177
|
|
|
|
|
|
|
die $e if $e; # rethrow |
178
|
|
|
|
|
|
|
} |
179
|
1
|
|
|
1
|
|
1627
|
return; |
180
|
1
|
|
33
|
|
|
5
|
} |
181
|
1
|
|
33
|
|
|
4
|
|
182
|
1
|
50
|
|
|
|
5
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# Accessors for abc |
185
|
1
|
50
|
|
|
|
2
|
# has declaration, file ../../../../tmp/vER6fMg7yO, line 7 |
|
1
|
|
|
|
|
4
|
|
186
|
0
|
|
|
|
|
0
|
if ( $__XS ) { |
187
|
0
|
|
|
|
|
0
|
Class::XSAccessor->import( |
188
|
0
|
|
|
|
|
0
|
chained => 1, |
|
0
|
|
|
|
|
0
|
|
189
|
0
|
|
|
|
|
0
|
"getters" => { "abc" => "abc" }, |
190
|
|
|
|
|
|
|
); |
191
|
1
|
|
|
1
|
|
6
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
207
|
|
192
|
0
|
0
|
|
|
|
0
|
else { |
193
|
|
|
|
|
|
|
*abc = sub { @_ == 1 or Mite::Shim::croak( 'Reader "abc" usage: $self->abc()' ); $_[0]{"abc"} }; |
194
|
1
|
|
|
|
|
10
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
BEGIN { |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
our %DOES = ( "MyTest2" => 1, "MyTest1" => 1 ); |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
# See UNIVERSAL |
204
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
205
|
|
|
|
|
|
|
our %DOES; |
206
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
207
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
208
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
209
|
|
|
|
|
|
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
215
|
1
|
|
|
1
|
|
170
|
shift->DOES( @_ ); |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
1; |