line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
8
|
no warnings qw( once void ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
5
|
2
|
|
|
2
|
|
8
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
280
|
|
6
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
7
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
8
|
|
|
|
|
|
|
our $MITE_VERSION = "0.010008"; |
9
|
|
|
|
|
|
|
# Mite keywords |
10
|
|
|
|
|
|
|
BEGIN { |
11
|
|
|
|
|
|
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "Thingy" ); |
12
|
2
|
|
|
2
|
|
8
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
13
|
2
|
|
|
|
|
4
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
2
|
|
|
2
|
|
12
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
326
|
|
16
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
17
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
18
|
0
|
|
|
|
|
0
|
sub {}, |
19
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
20
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
21
|
2
|
|
|
|
|
12
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
22
|
0
|
|
|
|
|
0
|
); |
23
|
0
|
|
|
|
|
0
|
}; |
24
|
2
|
|
|
|
|
92
|
|
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
|
2
|
|
|
2
|
|
10
|
BUILD => [ |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1082
|
|
31
|
2
|
|
33
|
2
|
|
4
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
2
|
|
|
|
|
10
|
|
32
|
2
|
|
|
|
|
12
|
map { "$_\::BUILD" } reverse @$linear_isa |
33
|
|
|
|
|
|
|
], |
34
|
|
|
|
|
|
|
DEMOLISH => [ |
35
|
2
|
50
|
|
|
|
2
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
2
|
|
|
|
|
18
|
|
|
0
|
|
|
|
|
0
|
|
36
|
2
|
|
|
|
|
10
|
map { "$_\::DEMOLISH" } @$linear_isa |
37
|
|
|
|
|
|
|
], |
38
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
39
|
2
|
50
|
|
|
|
4
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
2
|
|
|
|
|
30
|
|
|
0
|
|
|
|
|
0
|
|
40
|
2
|
|
|
|
|
8
|
}; |
|
2
|
|
|
|
|
6
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
45
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
46
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
47
|
|
|
|
|
|
|
my $self = bless {}, $class; |
48
|
|
|
|
|
|
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
49
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
50
|
2
|
50
|
|
2
|
|
262
|
|
51
|
2
|
|
33
|
|
|
14
|
# Attribute xyz |
52
|
2
|
|
|
|
|
6
|
# has declaration, file ../../../../tmp/J4E0FVuWWV, line 3 |
53
|
2
|
50
|
|
|
|
12
|
if ( exists $args->{"xyz"} ) { $self->{"xyz"} = $args->{"xyz"}; } ; |
|
0
|
50
|
|
|
|
0
|
|
54
|
2
|
|
|
|
|
4
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Call BUILD methods |
57
|
|
|
|
|
|
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
58
|
2
|
50
|
|
|
|
6
|
|
|
2
|
|
|
|
|
8
|
|
59
|
|
|
|
|
|
|
# Unrecognized parameters |
60
|
|
|
|
|
|
|
my @unknown = grep not( /\Axyz\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
61
|
|
|
|
|
|
|
|
62
|
2
|
50
|
33
|
|
|
8
|
return $self; |
|
2
|
50
|
|
|
|
8
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
2
|
50
|
|
|
|
6
|
# Used by constructor to call BUILD methods |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
6
|
|
66
|
|
|
|
|
|
|
my $class = ref( $_[0] ); |
67
|
2
|
|
|
|
|
6
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
68
|
|
|
|
|
|
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
72
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
73
|
0
|
|
0
|
|
|
0
|
my $class = ref( $self ) || $self; |
74
|
0
|
0
|
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
|
0
|
|
|
|
|
0
|
|
75
|
|
|
|
|
|
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
76
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
77
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
78
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
79
|
2
|
|
|
2
|
|
2
|
my $e = do { |
80
|
2
|
|
33
|
|
|
8
|
local ( $?, $@ ); |
81
|
2
|
|
33
|
|
|
6
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
82
|
2
|
50
|
|
|
|
6
|
$@; |
83
|
|
|
|
|
|
|
}; |
84
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
85
|
2
|
50
|
|
|
|
4
|
die $e if $e; # rethrow |
|
2
|
|
|
|
|
6
|
|
86
|
0
|
|
|
|
|
0
|
} |
87
|
0
|
|
|
|
|
0
|
return; |
88
|
0
|
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
89
|
0
|
|
|
|
|
0
|
|
90
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
91
|
2
|
|
|
2
|
|
14
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
614
|
|
92
|
0
|
0
|
|
|
|
0
|
# Accessors for xyz |
93
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/J4E0FVuWWV, line 3 |
94
|
2
|
|
|
|
|
18
|
if ( $__XS ) { |
95
|
|
|
|
|
|
|
Class::XSAccessor->import( |
96
|
|
|
|
|
|
|
chained => 1, |
97
|
|
|
|
|
|
|
"getters" => { "xyz" => "xyz" }, |
98
|
|
|
|
|
|
|
); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
else { |
101
|
|
|
|
|
|
|
*xyz = sub { @_ == 1 or Mite::Shim::croak( 'Reader "xyz" usage: $self->xyz()' ); $_[0]{"xyz"} }; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# See UNIVERSAL |
106
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
107
|
|
|
|
|
|
|
our %DOES; |
108
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
109
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
110
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
111
|
|
|
|
|
|
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
114
|
14
|
|
|
14
|
|
26
|
} |
115
|
14
|
|
|
|
|
14
|
|
116
|
14
|
50
|
|
|
|
24
|
# Alias for Moose/Moo-compatibility |
117
|
14
|
50
|
|
|
|
28
|
shift->DOES( @_ ); |
118
|
14
|
50
|
0
|
|
|
24
|
} |
|
|
|
33
|
|
|
|
|
119
|
0
|
0
|
0
|
|
|
0
|
|
120
|
|
|
|
|
|
|
1; |
121
|
14
|
|
|
|
|
62
|
use strict; |
122
|
|
|
|
|
|
|
use warnings; |
123
|
|
|
|
|
|
|
no warnings qw( once void ); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
126
|
14
|
|
|
14
|
|
3752
|
our $MITE_SHIM = "Mite::Shim"; |
127
|
|
|
|
|
|
|
our $MITE_VERSION = "0.010008"; |
128
|
|
|
|
|
|
|
# Mite keywords |
129
|
|
|
|
|
|
|
BEGIN { |
130
|
|
|
|
|
|
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest" ); |
131
|
|
|
|
|
|
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
132
|
2
|
|
|
2
|
|
12
|
no warnings 'redefine'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
62
|
|
133
|
2
|
|
|
2
|
|
8
|
( |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
50
|
|
134
|
2
|
|
|
2
|
|
6
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
220
|
|
135
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
136
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
137
|
|
|
|
|
|
|
sub {}, |
138
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
139
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
140
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
141
|
2
|
|
|
2
|
|
6
|
); |
142
|
2
|
|
|
|
|
4
|
}; |
143
|
|
|
|
|
|
|
|
144
|
2
|
|
|
2
|
|
10
|
# Gather metadata for constructor and destructor |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
326
|
|
145
|
|
|
|
|
|
|
no strict 'refs'; |
146
|
0
|
|
|
|
|
0
|
my $class = shift; $class = ref($class) || $class; |
147
|
0
|
|
|
|
|
0
|
my $linear_isa = mro::get_linear_isa( $class ); |
148
|
0
|
|
|
|
|
0
|
return { |
149
|
|
|
|
|
|
|
BUILD => [ |
150
|
2
|
|
|
|
|
8
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
151
|
0
|
|
|
|
|
0
|
map { "$_\::BUILD" } reverse @$linear_isa |
152
|
0
|
|
|
|
|
0
|
], |
153
|
2
|
|
|
|
|
94
|
DEMOLISH => [ |
154
|
|
|
|
|
|
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
155
|
|
|
|
|
|
|
map { "$_\::DEMOLISH" } @$linear_isa |
156
|
|
|
|
|
|
|
], |
157
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
158
|
|
|
|
|
|
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
159
|
2
|
|
|
2
|
|
10
|
}; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1040
|
|
160
|
2
|
|
33
|
2
|
|
4
|
} |
|
2
|
|
|
|
|
10
|
|
161
|
2
|
|
|
|
|
22
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
164
|
2
|
50
|
|
|
|
2
|
my $class = ref($_[0]) ? ref(shift) : shift; |
|
2
|
|
|
|
|
38
|
|
|
0
|
|
|
|
|
0
|
|
165
|
2
|
|
|
|
|
8
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
166
|
|
|
|
|
|
|
my $self = bless {}, $class; |
167
|
|
|
|
|
|
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
168
|
2
|
50
|
|
|
|
4
|
my $no_build = delete $args->{__no_BUILD__}; |
|
2
|
|
|
|
|
24
|
|
|
0
|
|
|
|
|
0
|
|
169
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
6
|
|
170
|
|
|
|
|
|
|
# Attribute foo |
171
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/J4E0FVuWWV, line 8 |
172
|
|
|
|
|
|
|
Mite::Shim::croak "Missing key in constructor: foo" unless exists $args->{"foo"}; |
173
|
|
|
|
|
|
|
$self->{"foo"} = $args->{"foo"}; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# Call BUILD methods |
177
|
|
|
|
|
|
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
178
|
|
|
|
|
|
|
|
179
|
4
|
50
|
|
4
|
|
66
|
# Unrecognized parameters |
180
|
4
|
|
66
|
|
|
16
|
my @unknown = grep not( /\Afoo\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
181
|
4
|
|
|
|
|
8
|
|
182
|
4
|
50
|
|
|
|
18
|
return $self; |
|
0
|
50
|
|
|
|
0
|
|
183
|
4
|
|
|
|
|
6
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
186
|
|
|
|
|
|
|
my $class = ref( $_[0] ); |
187
|
4
|
50
|
|
|
|
12
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
188
|
4
|
|
|
|
|
8
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
192
|
4
|
50
|
33
|
|
|
12
|
my $self = shift; |
|
4
|
50
|
|
|
|
26
|
|
193
|
|
|
|
|
|
|
my $class = ref( $self ) || $self; |
194
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
195
|
4
|
50
|
|
|
|
6
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
10
|
|
196
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
197
|
4
|
|
|
|
|
12
|
: Devel::GlobalDestruction::in_global_destruction(); |
198
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
199
|
|
|
|
|
|
|
my $e = do { |
200
|
|
|
|
|
|
|
local ( $?, $@ ); |
201
|
|
|
|
|
|
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
202
|
0
|
|
|
0
|
|
0
|
$@; |
203
|
0
|
|
0
|
|
|
0
|
}; |
204
|
0
|
0
|
|
|
|
0
|
no warnings 'misc'; # avoid (in cleanup) warnings |
|
0
|
|
|
|
|
0
|
|
205
|
|
|
|
|
|
|
die $e if $e; # rethrow |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
return; |
208
|
|
|
|
|
|
|
} |
209
|
4
|
|
|
4
|
|
2442
|
|
210
|
4
|
|
33
|
|
|
12
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
211
|
4
|
|
33
|
|
|
10
|
|
212
|
4
|
50
|
|
|
|
20
|
# Accessors for foo |
213
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/J4E0FVuWWV, line 8 |
214
|
|
|
|
|
|
|
if ( $__XS ) { |
215
|
4
|
50
|
|
|
|
6
|
Class::XSAccessor->import( |
|
4
|
|
|
|
|
14
|
|
216
|
0
|
|
|
|
|
0
|
chained => 1, |
217
|
0
|
|
|
|
|
0
|
"accessors" => { "foo" => "foo" }, |
218
|
0
|
|
|
|
|
0
|
); |
|
0
|
|
|
|
|
0
|
|
219
|
0
|
|
|
|
|
0
|
} |
220
|
|
|
|
|
|
|
else { |
221
|
2
|
|
|
2
|
|
12
|
*foo = sub { @_ > 1 ? do { $_[0]{"foo"} = $_[1]; $_[0]; } : ( $_[0]{"foo"} ) }; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
848
|
|
222
|
0
|
0
|
|
|
|
0
|
} |
223
|
|
|
|
|
|
|
|
224
|
4
|
|
|
|
|
10
|
# Delegated methods for foo |
225
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/J4E0FVuWWV, line 8 |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
# See UNIVERSAL |
229
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
230
|
|
|
|
|
|
|
our %DOES; |
231
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
232
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
233
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
234
|
|
|
|
|
|
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
240
|
6
|
100
|
66
|
6
|
|
6
|
shift->DOES( @_ ); |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
60
|
|
|
4
|
|
|
|
|
60
|
|
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
1; |
244
|
2
|
|
|
2
|
|
8
|
use strict; |
245
|
4
|
|
|
4
|
|
28
|
use warnings; |
246
|
|
|
|
|
|
|
no warnings qw( once void ); |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
249
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
250
|
14
|
|
|
14
|
|
20
|
our $MITE_VERSION = "0.010008"; |
251
|
14
|
|
|
|
|
14
|
# Mite keywords |
252
|
14
|
50
|
|
|
|
88
|
BEGIN { |
253
|
14
|
50
|
|
|
|
20
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest2" ); |
254
|
14
|
50
|
0
|
|
|
24
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
|
|
|
33
|
|
|
|
|
255
|
0
|
0
|
0
|
|
|
0
|
no warnings 'redefine'; |
256
|
|
|
|
|
|
|
( |
257
|
14
|
|
|
|
|
54
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
258
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
259
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
260
|
|
|
|
|
|
|
sub {}, |
261
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
262
|
14
|
|
|
14
|
|
1376
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
263
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
264
|
|
|
|
|
|
|
); |
265
|
|
|
|
|
|
|
}; |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
268
|
2
|
|
|
2
|
|
12
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
34
|
|
269
|
2
|
|
|
2
|
|
8
|
my $class = shift; $class = ref($class) || $class; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
64
|
|
270
|
2
|
|
|
2
|
|
10
|
my $linear_isa = mro::get_linear_isa( $class ); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
204
|
|
271
|
|
|
|
|
|
|
return { |
272
|
|
|
|
|
|
|
BUILD => [ |
273
|
|
|
|
|
|
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
274
|
|
|
|
|
|
|
map { "$_\::BUILD" } reverse @$linear_isa |
275
|
|
|
|
|
|
|
], |
276
|
|
|
|
|
|
|
DEMOLISH => [ |
277
|
2
|
|
|
2
|
|
8
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
278
|
2
|
|
|
|
|
2
|
map { "$_\::DEMOLISH" } @$linear_isa |
279
|
|
|
|
|
|
|
], |
280
|
2
|
|
|
2
|
|
10
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
300
|
|
281
|
|
|
|
|
|
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
282
|
0
|
|
|
|
|
0
|
}; |
283
|
0
|
|
|
|
|
0
|
} |
284
|
0
|
|
|
|
|
0
|
|
285
|
|
|
|
|
|
|
|
286
|
2
|
|
|
|
|
8
|
# Standard Moose/Moo-style constructor |
287
|
0
|
|
|
|
|
0
|
my $class = ref($_[0]) ? ref(shift) : shift; |
288
|
0
|
|
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
289
|
2
|
|
|
|
|
74
|
my $self = bless {}, $class; |
290
|
|
|
|
|
|
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
291
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
# Attribute foo |
294
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/J4E0FVuWWV, line 18 |
295
|
2
|
|
|
2
|
|
10
|
Mite::Shim::croak "Missing key in constructor: foo" unless exists $args->{"foo"}; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
1094
|
|
296
|
2
|
|
33
|
2
|
|
10
|
$self->{"foo"} = $args->{"foo"}; |
|
2
|
|
|
|
|
14
|
|
297
|
2
|
|
|
|
|
10
|
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
# Call BUILD methods |
300
|
2
|
50
|
|
|
|
4
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
|
2
|
|
|
|
|
14
|
|
|
0
|
|
|
|
|
0
|
|
301
|
2
|
|
|
|
|
8
|
|
302
|
|
|
|
|
|
|
# Unrecognized parameters |
303
|
|
|
|
|
|
|
my @unknown = grep not( /\Afoo\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
304
|
2
|
50
|
|
|
|
2
|
|
|
2
|
|
|
|
|
26
|
|
|
0
|
|
|
|
|
0
|
|
305
|
2
|
|
|
|
|
8
|
return $self; |
|
2
|
|
|
|
|
6
|
|
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
309
|
|
|
|
|
|
|
my $class = ref( $_[0] ); |
310
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
311
|
|
|
|
|
|
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
315
|
2
|
50
|
|
2
|
|
26
|
my $self = shift; |
316
|
2
|
|
33
|
|
|
28
|
my $class = ref( $self ) || $self; |
317
|
2
|
|
|
|
|
4
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
318
|
2
|
50
|
|
|
|
12
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
|
0
|
50
|
|
|
|
0
|
|
319
|
2
|
|
|
|
|
4
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
320
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
321
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
322
|
|
|
|
|
|
|
my $e = do { |
323
|
2
|
50
|
|
|
|
6
|
local ( $?, $@ ); |
324
|
2
|
|
|
|
|
6
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
325
|
|
|
|
|
|
|
$@; |
326
|
|
|
|
|
|
|
}; |
327
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
328
|
2
|
50
|
33
|
|
|
8
|
die $e if $e; # rethrow |
|
2
|
50
|
|
|
|
22
|
|
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
return; |
331
|
2
|
50
|
|
|
|
6
|
} |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
8
|
|
332
|
|
|
|
|
|
|
|
333
|
2
|
|
|
|
|
6
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
# Accessors for foo |
336
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/J4E0FVuWWV, line 18 |
337
|
|
|
|
|
|
|
if ( $__XS ) { |
338
|
0
|
|
|
0
|
|
0
|
Class::XSAccessor->import( |
339
|
0
|
|
0
|
|
|
0
|
chained => 1, |
340
|
0
|
0
|
|
|
|
0
|
"accessors" => { "foo" => "foo" }, |
|
0
|
|
|
|
|
0
|
|
341
|
|
|
|
|
|
|
); |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
else { |
344
|
|
|
|
|
|
|
*foo = sub { @_ > 1 ? do { $_[0]{"foo"} = $_[1]; $_[0]; } : ( $_[0]{"foo"} ) }; |
345
|
2
|
|
|
2
|
|
960
|
} |
346
|
2
|
|
33
|
|
|
10
|
|
347
|
2
|
|
33
|
|
|
6
|
# Delegated methods for foo |
348
|
2
|
50
|
|
|
|
8
|
# has declaration, file ../../../../tmp/J4E0FVuWWV, line 18 |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
|
351
|
2
|
50
|
|
|
|
4
|
# See UNIVERSAL |
|
2
|
|
|
|
|
8
|
|
352
|
0
|
|
|
|
|
0
|
my ( $self, $role ) = @_; |
353
|
0
|
|
|
|
|
0
|
our %DOES; |
354
|
0
|
|
|
|
|
0
|
return $DOES{$role} if exists $DOES{$role}; |
|
0
|
|
|
|
|
0
|
|
355
|
0
|
|
|
|
|
0
|
return 1 if $role eq __PACKAGE__; |
356
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
357
|
2
|
|
|
2
|
|
12
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
864
|
|
358
|
0
|
0
|
|
|
|
0
|
} |
359
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
360
|
2
|
|
|
|
|
10
|
} |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
363
|
|
|
|
|
|
|
shift->DOES( @_ ); |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
1; |