line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
3
|
|
|
3
|
|
201
|
use warnings; |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
165
|
|
4
|
3
|
|
|
3
|
|
45
|
no warnings qw( once void ); |
|
3
|
|
|
|
|
24
|
|
|
3
|
|
|
|
|
273
|
|
5
|
3
|
|
|
3
|
|
30
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
681
|
|
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", "MyTest2" ); |
12
|
3
|
|
|
3
|
|
15
|
( *after, *around, *before, *extends, *field, *has, *param, *signature_for, *with ) = do { |
13
|
3
|
|
|
|
|
3
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
3
|
|
|
3
|
|
21
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
969
|
|
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, field => @_ ) }, |
20
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
21
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
22
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
23
|
0
|
|
|
|
|
0
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
24
|
6
|
|
|
|
|
24
|
); |
25
|
0
|
|
|
|
|
0
|
}; |
26
|
3
|
|
|
|
|
729
|
|
27
|
|
|
|
|
|
|
# Mite imports |
28
|
|
|
|
|
|
|
BEGIN { |
29
|
|
|
|
|
|
|
require Scalar::Util; |
30
|
|
|
|
|
|
|
*STRICT = \&Mite::Shim::STRICT; |
31
|
|
|
|
|
|
|
*bare = \&Mite::Shim::bare; |
32
|
3
|
|
|
3
|
|
18
|
*blessed = \&Scalar::Util::blessed; |
33
|
3
|
|
|
|
|
30
|
*carp = \&Mite::Shim::carp; |
34
|
3
|
|
|
|
|
6
|
*confess = \&Mite::Shim::confess; |
35
|
3
|
|
|
|
|
6
|
*croak = \&Mite::Shim::croak; |
36
|
3
|
|
|
|
|
27
|
*false = \&Mite::Shim::false; |
37
|
3
|
|
|
|
|
6
|
*guard = \&Mite::Shim::guard; |
38
|
3
|
|
|
|
|
6
|
*lazy = \&Mite::Shim::lazy; |
39
|
3
|
|
|
|
|
6
|
*ro = \&Mite::Shim::ro; |
40
|
3
|
|
|
|
|
9
|
*rw = \&Mite::Shim::rw; |
41
|
3
|
|
|
|
|
15
|
*rwp = \&Mite::Shim::rwp; |
42
|
3
|
|
|
|
|
9
|
*true = \&Mite::Shim::true; |
43
|
3
|
|
|
|
|
6
|
}; |
44
|
3
|
|
|
|
|
6
|
|
45
|
3
|
|
|
|
|
117
|
# Gather metadata for constructor and destructor |
46
|
|
|
|
|
|
|
no strict 'refs'; |
47
|
|
|
|
|
|
|
my $class = shift; $class = ref($class) || $class; |
48
|
|
|
|
|
|
|
my $linear_isa = mro::get_linear_isa( $class ); |
49
|
|
|
|
|
|
|
return { |
50
|
3
|
|
|
3
|
|
15
|
BUILD => [ |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1842
|
|
51
|
0
|
|
0
|
0
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
0
|
|
|
|
|
0
|
|
52
|
0
|
|
|
|
|
0
|
map { "$_\::BUILD" } reverse @$linear_isa |
53
|
|
|
|
|
|
|
], |
54
|
|
|
|
|
|
|
DEMOLISH => [ |
55
|
0
|
0
|
|
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
56
|
0
|
|
|
|
|
0
|
map { "$_\::DEMOLISH" } @$linear_isa |
57
|
|
|
|
|
|
|
], |
58
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
59
|
0
|
0
|
|
|
|
0
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
60
|
0
|
|
|
|
|
0
|
}; |
|
0
|
|
|
|
|
0
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
65
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
66
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
67
|
|
|
|
|
|
|
my $self = bless {}, $class; |
68
|
|
|
|
|
|
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
69
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
70
|
0
|
0
|
|
0
|
|
0
|
|
71
|
0
|
|
0
|
|
|
0
|
|
72
|
0
|
|
|
|
|
0
|
|
73
|
0
|
0
|
|
|
|
0
|
# Call BUILD methods |
|
0
|
0
|
|
|
|
0
|
|
74
|
0
|
|
|
|
|
0
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Unrecognized parameters |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
return $self; |
79
|
0
|
0
|
0
|
|
|
0
|
} |
|
0
|
0
|
|
|
|
0
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
82
|
0
|
0
|
|
|
|
0
|
my $class = ref( $_[0] ); |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
83
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
84
|
0
|
|
|
|
|
0
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
88
|
|
|
|
|
|
|
my $self = shift; |
89
|
0
|
|
|
0
|
|
0
|
my $class = ref( $self ) || $self; |
90
|
0
|
|
0
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
91
|
0
|
0
|
|
|
|
0
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
|
0
|
|
|
|
|
0
|
|
92
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
93
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
94
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
95
|
|
|
|
|
|
|
my $e = do { |
96
|
0
|
|
|
0
|
|
0
|
local ( $?, $@ ); |
97
|
0
|
|
0
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
98
|
0
|
|
0
|
|
|
0
|
$@; |
99
|
0
|
0
|
|
|
|
0
|
}; |
100
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
101
|
|
|
|
|
|
|
die $e if $e; # rethrow |
102
|
0
|
0
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
103
|
0
|
|
|
|
|
0
|
return; |
104
|
0
|
|
|
|
|
0
|
} |
105
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
106
|
0
|
|
|
|
|
0
|
|
107
|
|
|
|
|
|
|
# See UNIVERSAL |
108
|
3
|
|
|
3
|
|
21
|
my ( $self, $role ) = @_; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1098
|
|
109
|
0
|
0
|
|
|
|
0
|
our %DOES; |
110
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
111
|
0
|
|
|
|
|
0
|
return 1 if $role eq __PACKAGE__; |
112
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
113
|
|
|
|
|
|
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
116
|
|
|
|
|
|
|
} |
117
|
66
|
|
|
66
|
|
90
|
|
118
|
66
|
|
|
|
|
42
|
# Alias for Moose/Moo-compatibility |
119
|
66
|
50
|
|
|
|
111
|
shift->DOES( @_ ); |
120
|
66
|
50
|
|
|
|
75
|
} |
121
|
66
|
50
|
0
|
|
|
93
|
|
|
|
|
33
|
|
|
|
|
122
|
0
|
0
|
0
|
|
|
0
|
# Method signatures |
123
|
|
|
|
|
|
|
our %SIGNATURE_FOR; |
124
|
66
|
|
|
|
|
225
|
|
125
|
|
|
|
|
|
|
$SIGNATURE_FOR{"bar"} = sub { |
126
|
|
|
|
|
|
|
my $__NEXT__ = shift; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
my ( %out, %in, %tmp, $tmp, $dtmp, @head ); |
129
|
66
|
|
|
66
|
|
3204
|
|
130
|
|
|
|
|
|
|
@_ == 2 && (ref($_[1]) eq 'HASH') |
131
|
|
|
|
|
|
|
or @_ % 2 == 1 && @_ == 5 |
132
|
|
|
|
|
|
|
or croak( "Wrong number of parameters in signature for %s: got %d, %s", "bar", scalar( @_ ), "that does not seem right" ); |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
@head = splice( @_, 0, 1 ); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# Parameter invocant (type: Defined) |
137
|
|
|
|
|
|
|
(defined($head[0])) |
138
|
|
|
|
|
|
|
or croak( "Type check failed in signature for bar: %s should be %s", "\$_[0]", "Defined" ); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
%in = ( @_ == 1 and (ref($_[0]) eq 'HASH') ) ? %{ $_[0] } : @_; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
# Parameter xxx (type: Num) |
143
|
|
|
|
|
|
|
exists( $in{"xxx"} ) |
144
|
|
|
|
|
|
|
or croak( "Failure in signature for bar: " . 'Missing required parameter: xxx' ); |
145
|
|
|
|
|
|
|
or croak( "Type check failed in signature for bar: %s should be %s", "\$_{\"xxx\"}", "Num" ); |
146
|
|
|
|
|
|
|
$out{"xxx"} = $in{"xxx"} if exists( $in{"xxx"} ); |
147
|
|
|
|
|
|
|
delete( $in{"xxx"} ); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# Parameter yyy (type: Object) |
150
|
|
|
|
|
|
|
exists( $in{"yyy"} ) |
151
|
|
|
|
|
|
|
or croak( "Failure in signature for bar: " . 'Missing required parameter: yyy' ); |
152
|
|
|
|
|
|
|
or croak( "Type check failed in signature for bar: %s should be %s", "\$_{\"yyy\"}", "Object" ); |
153
|
|
|
|
|
|
|
$out{"yyy"} = $in{"yyy"} if exists( $in{"yyy"} ); |
154
|
|
|
|
|
|
|
delete( $in{"yyy"} ); |
155
|
3
|
|
|
3
|
|
33
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
246
|
|
156
|
|
|
|
|
|
|
# Unrecognized parameters |
157
|
|
|
|
|
|
|
croak( "Failure in signature for bar: " . sprintf( q{Unrecognized parameter%s: %s}, keys( %in ) > 1 ? q{s} : q{}, join( q{, }, sort keys %in ) ) ) if keys %in; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
do { @_ = ( @head, bless( \%out, "MyTest2::__NAMED_ARGUMENTS__::bar" ) ); goto $__NEXT__ }; |
160
|
|
|
|
|
|
|
}; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
{ |
163
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
519
|
|
164
|
|
|
|
|
|
|
no warnings; |
165
|
|
|
|
|
|
|
1; |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
$SIGNATURE_FOR{"foo"} = sub { |
168
|
|
|
|
|
|
|
my $__NEXT__ = shift; |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
my ( %out, %in, %tmp, $tmp, $dtmp, @head ); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
@_ == 2 && (ref($_[1]) eq 'HASH') |
173
|
|
|
|
|
|
|
or @_ % 2 == 1 && @_ == 5 |
174
|
|
|
|
|
|
|
or croak( "Wrong number of parameters in signature for %s: got %d, %s", "foo", scalar( @_ ), "that does not seem right" ); |
175
|
|
|
|
|
|
|
|
176
|
3
|
|
|
3
|
|
18
|
@head = splice( @_, 0, 1 ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
78
|
|
177
|
3
|
|
|
3
|
|
30
|
|
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
1542
|
|
178
|
0
|
|
|
0
|
|
0
|
# Parameter invocant (type: Defined) |
179
|
0
|
|
|
0
|
|
0
|
(defined($head[0])) |
180
|
|
|
|
|
|
|
or croak( "Type check failed in signature for foo: %s should be %s", "\$_[0]", "Defined" ); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
%in = ( @_ == 1 and (ref($_[0]) eq 'HASH') ) ? %{ $_[0] } : @_; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# Parameter xxx (type: Int) |
185
|
|
|
|
|
|
|
exists( $in{"xxx"} ) |
186
|
|
|
|
|
|
|
or croak( "Failure in signature for foo: " . 'Missing required parameter: xxx' ); |
187
|
|
|
|
|
|
|
(do { my $tmp = $in{"xxx"}; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) |
188
|
|
|
|
|
|
|
or croak( "Type check failed in signature for foo: %s should be %s", "\$_{\"xxx\"}", "Int" ); |
189
|
|
|
|
|
|
|
$out{"xxx"} = $in{"xxx"} if exists( $in{"xxx"} ); |
190
|
|
|
|
|
|
|
delete( $in{"xxx"} ); |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
# Parameter yyy (type: Bool) |
193
|
|
|
|
|
|
|
exists( $in{"yyy"} ) |
194
|
|
|
|
|
|
|
or croak( "Failure in signature for foo: " . 'Missing required parameter: yyy' ); |
195
|
|
|
|
|
|
|
(!ref $tmp and (!defined $tmp or $tmp eq q() or $tmp eq '0' or $tmp eq '1')) |
196
|
|
|
|
|
|
|
or croak( "Type check failed in signature for foo: %s should be %s", "\$_{\"yyy\"}", "Bool" ); |
197
|
|
|
|
|
|
|
$out{"yyy"} = $tmp; |
198
|
|
|
|
|
|
|
delete( $in{"yyy"} ); |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
# Unrecognized parameters |
201
|
|
|
|
|
|
|
croak( "Failure in signature for foo: " . sprintf( q{Unrecognized parameter%s: %s}, keys( %in ) > 1 ? q{s} : q{}, join( q{, }, sort keys %in ) ) ) if keys %in; |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
do { @_ = ( @head, bless( \%out, "MyTest2::__NAMED_ARGUMENTS__::foo" ) ); goto $__NEXT__ }; |
204
|
|
|
|
|
|
|
}; |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
{ |
207
|
|
|
|
|
|
|
use strict; |
208
|
|
|
|
|
|
|
no warnings; |
209
|
|
|
|
|
|
|
1; |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
1; |