line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
5
|
no warnings qw( once void ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
168
|
|
6
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
7
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
8
|
|
|
|
|
|
|
our $MITE_VERSION = "0.011000"; |
9
|
|
|
|
|
|
|
# Mite keywords |
10
|
|
|
|
|
|
|
BEGIN { |
11
|
|
|
|
|
|
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest" ); |
12
|
1
|
|
|
1
|
|
5
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
13
|
1
|
|
|
|
|
1
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
1
|
|
|
1
|
|
8
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
214
|
|
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
|
1
|
|
|
|
|
6
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
22
|
0
|
|
|
|
|
0
|
); |
23
|
0
|
|
|
|
|
0
|
}; |
24
|
1
|
|
|
|
|
54
|
|
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
|
|
|
|
|
722
|
|
31
|
2
|
|
33
|
2
|
|
9
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
2
|
|
|
|
|
10
|
|
32
|
2
|
|
|
|
|
8
|
map { "$_\::BUILD" } reverse @$linear_isa |
33
|
|
|
|
|
|
|
], |
34
|
|
|
|
|
|
|
DEMOLISH => [ |
35
|
3
|
50
|
|
|
|
5
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
3
|
|
|
|
|
14
|
|
|
0
|
|
|
|
|
0
|
|
36
|
3
|
|
|
|
|
8
|
map { "$_\::DEMOLISH" } @$linear_isa |
37
|
|
|
|
|
|
|
], |
38
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
39
|
3
|
50
|
|
|
|
4
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
3
|
|
|
|
|
40
|
|
|
0
|
|
|
|
|
0
|
|
40
|
2
|
|
|
|
|
4
|
}; |
|
3
|
|
|
|
|
7
|
|
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
|
3
|
50
|
|
3
|
|
608
|
|
51
|
3
|
|
66
|
|
|
15
|
# Attribute foo (type: Int) |
52
|
3
|
|
|
|
|
7
|
# has declaration, file ../../../../tmp/F6g84O9qlx, line 3 |
53
|
3
|
50
|
|
|
|
25
|
if ( exists $args->{"foo"} ) { (do { my $tmp = $args->{"foo"}; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) or Mite::Shim::croak "Type check failed in constructor: %s should be %s", "foo", "Int"; $self->{"foo"} = $args->{"foo"}; } ; |
|
0
|
50
|
|
|
|
0
|
|
54
|
3
|
|
|
|
|
6
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Call BUILD methods |
57
|
|
|
|
|
|
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
58
|
3
|
50
|
33
|
|
|
8
|
|
|
3
|
50
|
|
|
|
3
|
|
|
3
|
50
|
|
|
|
4
|
|
|
3
|
|
|
|
|
88
|
|
|
3
|
|
|
|
|
14
|
|
59
|
|
|
|
|
|
|
# Unrecognized parameters |
60
|
|
|
|
|
|
|
my @unknown = grep not( /\Afoo\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
61
|
|
|
|
|
|
|
|
62
|
3
|
50
|
33
|
|
|
13
|
return $self; |
|
3
|
50
|
|
|
|
13
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
3
|
50
|
|
|
|
4
|
# Used by constructor to call BUILD methods |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
8
|
|
66
|
|
|
|
|
|
|
my $class = ref( $_[0] ); |
67
|
3
|
|
|
|
|
10
|
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
|
5
|
|
|
5
|
|
564
|
my $e = do { |
80
|
5
|
|
33
|
|
|
12
|
local ( $?, $@ ); |
81
|
5
|
|
33
|
|
|
9
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
82
|
5
|
50
|
|
|
|
12
|
$@; |
83
|
|
|
|
|
|
|
}; |
84
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
85
|
5
|
50
|
|
|
|
6
|
die $e if $e; # rethrow |
|
5
|
|
|
|
|
11
|
|
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
|
1
|
|
|
1
|
|
8
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
662
|
|
92
|
0
|
0
|
|
|
|
0
|
# Accessors for foo |
93
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/F6g84O9qlx, line 3 |
94
|
5
|
|
|
|
|
20
|
defined wantarray or Mite::Shim::croak( "This method cannot be called in void context" ); |
95
|
|
|
|
|
|
|
my $get = "foo"; |
96
|
|
|
|
|
|
|
my $set = "foo"; |
97
|
|
|
|
|
|
|
my $has = sub { exists $_[0]{"foo"} }; |
98
|
|
|
|
|
|
|
my $clear = sub { delete $_[0]{"foo"}; $_[0]; }; |
99
|
|
|
|
|
|
|
my $old = undef; |
100
|
|
|
|
|
|
|
my ( $self, $new ) = @_; |
101
|
15
|
50
|
33
|
15
|
|
85
|
my $restorer = $self->$has |
|
5
|
50
|
|
|
|
30
|
|
|
5
|
100
|
|
|
|
7
|
|
|
5
|
|
|
|
|
44
|
|
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
11
|
|
102
|
|
|
|
|
|
|
? do { $old = $self->$get; sub { $self->$set( $old ) } } |
103
|
3
|
50
|
|
3
|
|
32
|
: sub { $self->$clear }; |
104
|
3
|
|
|
|
|
6
|
@_ == 2 ? $self->$set( $new ) : $self->$clear; |
105
|
3
|
|
|
|
|
4
|
&Mite::Shim::guard( $restorer, $old ); |
106
|
3
|
|
|
3
|
|
10
|
} |
|
3
|
|
|
|
|
7
|
|
107
|
3
|
|
|
0
|
|
7
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
108
|
3
|
|
|
|
|
4
|
|
109
|
3
|
|
|
|
|
5
|
# See UNIVERSAL |
110
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
111
|
3
|
|
|
2
|
|
7
|
our %DOES; |
|
3
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
5
|
|
112
|
3
|
50
|
|
0
|
|
7
|
return $DOES{$role} if exists $DOES{$role}; |
|
0
|
|
|
|
|
0
|
|
113
|
3
|
50
|
|
|
|
13
|
return 1 if $role eq __PACKAGE__; |
114
|
3
|
|
|
|
|
19
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
115
|
|
|
|
|
|
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
15
|
|
|
15
|
|
21
|
# Alias for Moose/Moo-compatibility |
121
|
15
|
|
|
|
|
17
|
shift->DOES( @_ ); |
122
|
15
|
50
|
|
|
|
22
|
} |
123
|
15
|
50
|
|
|
|
23
|
|
124
|
15
|
50
|
0
|
|
|
24
|
1; |
|
|
|
33
|
|
|
|
|
125
|
0
|
0
|
0
|
|
|
0
|
use strict; |
126
|
|
|
|
|
|
|
use warnings; |
127
|
15
|
|
|
|
|
70
|
no warnings qw( once void ); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
130
|
|
|
|
|
|
|
our $MITE_SHIM = "Mite::Shim"; |
131
|
|
|
|
|
|
|
our $MITE_VERSION = "0.011000"; |
132
|
7
|
|
|
7
|
|
1983
|
# Mite keywords |
133
|
|
|
|
|
|
|
BEGIN { |
134
|
|
|
|
|
|
|
my ( $SHIM, $CALLER ) = ( "Mite::Shim", "MyTest2" ); |
135
|
|
|
|
|
|
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
136
|
|
|
|
|
|
|
no warnings 'redefine'; |
137
|
|
|
|
|
|
|
( |
138
|
1
|
|
|
1
|
|
8
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
139
|
1
|
|
|
1
|
|
6
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
140
|
1
|
|
|
1
|
|
6
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
129
|
|
141
|
|
|
|
|
|
|
sub {}, |
142
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
143
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
144
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
145
|
|
|
|
|
|
|
); |
146
|
|
|
|
|
|
|
}; |
147
|
1
|
|
|
1
|
|
5
|
|
148
|
1
|
|
|
|
|
2
|
# Mite imports |
149
|
|
|
|
|
|
|
BEGIN { |
150
|
1
|
|
|
1
|
|
7
|
*guard = \&Mite::Shim::guard; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
181
|
|
151
|
|
|
|
|
|
|
}; |
152
|
0
|
|
|
|
|
0
|
|
153
|
0
|
|
|
|
|
0
|
|
154
|
0
|
|
|
|
|
0
|
BEGIN { |
155
|
|
|
|
|
|
|
|
156
|
1
|
|
|
|
|
5
|
|
157
|
0
|
|
|
|
|
0
|
use mro 'c3'; |
158
|
0
|
|
|
|
|
0
|
our @ISA; |
159
|
1
|
|
|
|
|
46
|
push @ISA, "MyTest"; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
163
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
164
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
165
|
1
|
|
|
1
|
|
36
|
my $self = bless {}, $class; |
166
|
|
|
|
|
|
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
167
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
# Attribute foo (type: Int) |
170
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/F6g84O9qlx, line 11 |
171
|
|
|
|
|
|
|
if ( exists $args->{"foo"} ) { (do { my $tmp = $args->{"foo"}; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) or Mite::Shim::croak "Type check failed in constructor: %s should be %s", "foo", "Int"; $self->{"foo"} = $args->{"foo"}; } ; |
172
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
173
|
1
|
|
|
1
|
|
45
|
|
174
|
1
|
|
|
|
|
930
|
# Call BUILD methods |
175
|
|
|
|
|
|
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
# Unrecognized parameters |
178
|
|
|
|
|
|
|
my @unknown = grep not( /\Afoo\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
179
|
2
|
50
|
|
2
|
|
7
|
|
180
|
2
|
|
66
|
|
|
13
|
return $self; |
181
|
2
|
|
|
|
|
7
|
} |
182
|
2
|
50
|
|
|
|
8
|
|
|
0
|
50
|
|
|
|
0
|
|
183
|
2
|
|
|
|
|
4
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
# Accessors for foo |
186
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/F6g84O9qlx, line 11 |
187
|
2
|
50
|
33
|
|
|
4
|
if ( $__XS ) { |
|
1
|
50
|
|
|
|
1
|
|
|
1
|
100
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
3
|
|
188
|
|
|
|
|
|
|
Class::XSAccessor->import( |
189
|
|
|
|
|
|
|
chained => 1, |
190
|
|
|
|
|
|
|
"exists_predicates" => { "has_foo" => "foo" }, |
191
|
2
|
50
|
33
|
|
|
6
|
); |
|
2
|
50
|
|
|
|
7
|
|
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
else { |
194
|
2
|
50
|
|
|
|
3
|
*has_foo = sub { @_ == 1 or Mite::Shim::croak( 'Predicate "has_foo" usage: $self->has_foo()' ); exists $_[0]{"foo"} }; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
5
|
|
195
|
|
|
|
|
|
|
} |
196
|
2
|
|
|
|
|
10
|
defined wantarray or Mite::Shim::croak( "This method cannot be called in void context" ); |
197
|
|
|
|
|
|
|
my $get = "foo"; |
198
|
|
|
|
|
|
|
my $set = "foo"; |
199
|
|
|
|
|
|
|
my $has = "has_foo"; |
200
|
|
|
|
|
|
|
my $clear = sub { delete $_[0]{"foo"}; $_[0]; }; |
201
|
|
|
|
|
|
|
my $old = undef; |
202
|
|
|
|
|
|
|
my ( $self, $new ) = @_; |
203
|
|
|
|
|
|
|
my $restorer = $self->$has |
204
|
|
|
|
|
|
|
? do { $old = $self->$get; sub { $self->$set( $old ) } } |
205
|
|
|
|
|
|
|
: sub { $self->$clear }; |
206
|
|
|
|
|
|
|
@_ == 2 ? $self->$set( $new ) : $self->$clear; |
207
|
|
|
|
|
|
|
&guard( $restorer, $old ); |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
# See UNIVERSAL |
212
|
8
|
50
|
33
|
8
|
|
1381
|
my ( $self, $role ) = @_; |
|
3
|
50
|
|
|
|
4
|
|
|
3
|
100
|
|
|
|
3
|
|
|
3
|
|
|
|
|
32
|
|
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
8
|
|
213
|
|
|
|
|
|
|
our %DOES; |
214
|
2
|
50
|
|
2
|
|
987
|
return $DOES{$role} if exists $DOES{$role}; |
215
|
2
|
|
|
|
|
5
|
return 1 if $role eq __PACKAGE__; |
216
|
2
|
|
|
|
|
3
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
217
|
2
|
|
|
|
|
2
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
218
|
2
|
|
|
2
|
|
7
|
} |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
6
|
|
219
|
2
|
|
|
|
|
3
|
return $self->SUPER::DOES( $role ); |
220
|
2
|
|
|
|
|
4
|
} |
221
|
|
|
|
|
|
|
|
222
|
1
|
|
|
1
|
|
3
|
# Alias for Moose/Moo-compatibility |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
223
|
2
|
100
|
|
1
|
|
12
|
shift->DOES( @_ ); |
|
1
|
|
|
|
|
3
|
|
224
|
2
|
100
|
|
|
|
9
|
} |
225
|
2
|
|
|
|
|
5
|
|
226
|
|
|
|
|
|
|
1; |