line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
3
|
|
|
3
|
|
36
|
use warnings; |
|
3
|
|
|
|
|
27
|
|
|
3
|
|
|
|
|
234
|
|
4
|
3
|
|
|
3
|
|
24
|
no warnings qw( once void ); |
|
3
|
|
|
|
|
39
|
|
|
3
|
|
|
|
|
297
|
|
5
|
3
|
|
|
3
|
|
21
|
|
|
3
|
|
|
|
|
21
|
|
|
3
|
|
|
|
|
795
|
|
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", "MyTest4" ); |
12
|
3
|
|
|
3
|
|
42
|
( *after, *around, *before, *extends, *field, *has, *param, *signature_for, *with ) = do { |
13
|
3
|
|
|
|
|
9
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
3
|
|
|
3
|
|
36
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
1029
|
|
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
|
3
|
|
|
|
|
39
|
); |
25
|
0
|
|
|
|
|
0
|
}; |
26
|
3
|
|
|
|
|
876
|
|
27
|
|
|
|
|
|
|
# Mite imports |
28
|
|
|
|
|
|
|
BEGIN { |
29
|
|
|
|
|
|
|
require Scalar::Util; |
30
|
|
|
|
|
|
|
*STRICT = \&Mite::Shim::STRICT; |
31
|
|
|
|
|
|
|
*bare = \&Mite::Shim::bare; |
32
|
3
|
|
|
3
|
|
24
|
*blessed = \&Scalar::Util::blessed; |
33
|
3
|
|
|
|
|
12
|
*carp = \&Mite::Shim::carp; |
34
|
3
|
|
|
|
|
6
|
*confess = \&Mite::Shim::confess; |
35
|
3
|
|
|
|
|
21
|
*croak = \&Mite::Shim::croak; |
36
|
3
|
|
|
|
|
9
|
*false = \&Mite::Shim::false; |
37
|
3
|
|
|
|
|
24
|
*guard = \&Mite::Shim::guard; |
38
|
3
|
|
|
|
|
18
|
*lazy = \&Mite::Shim::lazy; |
39
|
3
|
|
|
|
|
30
|
*lock = \&Mite::Shim::lock; |
40
|
3
|
|
|
|
|
9
|
*ro = \&Mite::Shim::ro; |
41
|
3
|
|
|
|
|
6
|
*rw = \&Mite::Shim::rw; |
42
|
3
|
|
|
|
|
18
|
*rwp = \&Mite::Shim::rwp; |
43
|
3
|
|
|
|
|
21
|
*true = \&Mite::Shim::true; |
44
|
3
|
|
|
|
|
21
|
*unlock = \&Mite::Shim::unlock; |
45
|
3
|
|
|
|
|
24
|
}; |
46
|
3
|
|
|
|
|
9
|
|
47
|
3
|
|
|
|
|
108
|
# Gather metadata for constructor and destructor |
48
|
|
|
|
|
|
|
no strict 'refs'; |
49
|
|
|
|
|
|
|
my $class = shift; $class = ref($class) || $class; |
50
|
|
|
|
|
|
|
my $linear_isa = mro::get_linear_isa( $class ); |
51
|
|
|
|
|
|
|
return { |
52
|
3
|
|
|
3
|
|
27
|
BUILD => [ |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
2226
|
|
53
|
0
|
|
0
|
0
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
0
|
|
|
|
|
0
|
|
54
|
0
|
|
|
|
|
0
|
map { "$_\::BUILD" } reverse @$linear_isa |
55
|
|
|
|
|
|
|
], |
56
|
|
|
|
|
|
|
DEMOLISH => [ |
57
|
0
|
0
|
|
|
|
0
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
58
|
0
|
|
|
|
|
0
|
map { "$_\::DEMOLISH" } @$linear_isa |
59
|
|
|
|
|
|
|
], |
60
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
61
|
0
|
0
|
|
|
|
0
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
62
|
0
|
|
|
|
|
0
|
}; |
|
0
|
|
|
|
|
0
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
67
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
68
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
69
|
|
|
|
|
|
|
my $self = bless {}, $class; |
70
|
|
|
|
|
|
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
71
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
72
|
0
|
0
|
|
0
|
|
0
|
|
73
|
0
|
|
0
|
|
|
0
|
|
74
|
0
|
|
|
|
|
0
|
|
75
|
0
|
0
|
|
|
|
0
|
# Call BUILD methods |
|
0
|
0
|
|
|
|
0
|
|
76
|
0
|
|
|
|
|
0
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Unrecognized parameters |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
return $self; |
81
|
0
|
0
|
0
|
|
|
0
|
} |
|
0
|
0
|
|
|
|
0
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
84
|
0
|
0
|
|
|
|
0
|
my $class = ref( $_[0] ); |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
85
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
86
|
0
|
|
|
|
|
0
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
90
|
|
|
|
|
|
|
my $self = shift; |
91
|
0
|
|
|
0
|
|
0
|
my $class = ref( $self ) || $self; |
92
|
0
|
|
0
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
93
|
0
|
0
|
|
|
|
0
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
|
0
|
|
|
|
|
0
|
|
94
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
95
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
96
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
97
|
|
|
|
|
|
|
my $e = do { |
98
|
0
|
|
|
0
|
|
0
|
local ( $?, $@ ); |
99
|
0
|
|
0
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
100
|
0
|
|
0
|
|
|
0
|
$@; |
101
|
0
|
0
|
|
|
|
0
|
}; |
102
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
103
|
|
|
|
|
|
|
die $e if $e; # rethrow |
104
|
0
|
0
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
105
|
0
|
|
|
|
|
0
|
return; |
106
|
0
|
|
|
|
|
0
|
} |
107
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
108
|
0
|
|
|
|
|
0
|
|
109
|
|
|
|
|
|
|
# See UNIVERSAL |
110
|
3
|
|
|
3
|
|
39
|
my ( $self, $role ) = @_; |
|
3
|
|
|
|
|
21
|
|
|
3
|
|
|
|
|
1893
|
|
111
|
0
|
0
|
|
|
|
0
|
our %DOES; |
112
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
113
|
0
|
|
|
|
|
0
|
return 1 if $role eq __PACKAGE__; |
114
|
|
|
|
|
|
|
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
|
72
|
|
|
72
|
|
117
|
|
120
|
72
|
|
|
|
|
66
|
# Alias for Moose/Moo-compatibility |
121
|
72
|
50
|
|
|
|
198
|
shift->DOES( @_ ); |
122
|
72
|
50
|
|
|
|
108
|
} |
123
|
72
|
50
|
0
|
|
|
138
|
|
|
|
|
33
|
|
|
|
|
124
|
0
|
0
|
0
|
|
|
0
|
# Method signatures |
125
|
|
|
|
|
|
|
our %SIGNATURE_FOR; |
126
|
72
|
|
|
|
|
309
|
|
127
|
|
|
|
|
|
|
$SIGNATURE_FOR{"foo"} = sub { |
128
|
|
|
|
|
|
|
my $__NEXT__ = shift; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
my ( @out, %tmp, $tmp, $dtmp, @head ); |
131
|
72
|
|
|
72
|
|
3888
|
|
132
|
|
|
|
|
|
|
@_ == 2 |
133
|
|
|
|
|
|
|
or croak( "Wrong number of parameters in signature for %s: got %d, %s", "foo", scalar( @_ ), "expected exactly 2 parameters" ); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
@head = splice( @_, 0, 0 ); |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
# Parameter $_[0] (type: Int) |
138
|
|
|
|
|
|
|
(do { my $tmp = $_[0]; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) |
139
|
|
|
|
|
|
|
or croak( "Type check failed in signature for foo: %s should be %s", "\$_[0]", "Int" ); |
140
|
|
|
|
|
|
|
push( @out, $_[0] ); |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
# Parameter $_[1] (type: Bool) |
143
|
|
|
|
|
|
|
$tmp = ((!ref $_[1] and (!defined $_[1] or $_[1] eq q() or $_[1] eq '0' or $_[1] eq '1'))) ? $_[1] : ((!!1)) ? scalar(do { local $_ = $_[1]; !!$_ }) : $_[1]; |
144
|
|
|
|
|
|
|
(!ref $tmp and (!defined $tmp or $tmp eq q() or $tmp eq '0' or $tmp eq '1')) |
145
|
|
|
|
|
|
|
or croak( "Type check failed in signature for foo: %s should be %s", "\$_[1]", "Bool" ); |
146
|
|
|
|
|
|
|
push( @out, $tmp ); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
do { @_ = ( @head, @out ); goto $__NEXT__ }; |
149
|
|
|
|
|
|
|
}; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |