line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
2
|
|
|
2
|
|
24
|
use warnings; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
116
|
|
4
|
2
|
|
|
2
|
|
14
|
no warnings qw( once void ); |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
154
|
|
5
|
2
|
|
|
2
|
|
22
|
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
436
|
|
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", "MyTest" ); |
12
|
2
|
|
|
2
|
|
22
|
( *after, *around, *before, *extends, *field, *has, *param, *signature_for, *with ) = do { |
13
|
2
|
|
|
|
|
6
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
2
|
|
|
2
|
|
18
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
540
|
|
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
|
2
|
|
|
|
|
32
|
); |
25
|
0
|
|
|
|
|
0
|
}; |
26
|
2
|
|
|
|
|
414
|
|
27
|
|
|
|
|
|
|
# Mite imports |
28
|
|
|
|
|
|
|
BEGIN { |
29
|
|
|
|
|
|
|
require Scalar::Util; |
30
|
|
|
|
|
|
|
*STRICT = \&Mite::Shim::STRICT; |
31
|
|
|
|
|
|
|
*bare = \&Mite::Shim::bare; |
32
|
2
|
|
|
2
|
|
12
|
*blessed = \&Scalar::Util::blessed; |
33
|
2
|
|
|
|
|
16
|
*carp = \&Mite::Shim::carp; |
34
|
2
|
|
|
|
|
12
|
*confess = \&Mite::Shim::confess; |
35
|
2
|
|
|
|
|
6
|
*croak = \&Mite::Shim::croak; |
36
|
2
|
|
|
|
|
16
|
*false = \&Mite::Shim::false; |
37
|
2
|
|
|
|
|
4
|
*guard = \&Mite::Shim::guard; |
38
|
2
|
|
|
|
|
12
|
*lazy = \&Mite::Shim::lazy; |
39
|
2
|
|
|
|
|
8
|
*ro = \&Mite::Shim::ro; |
40
|
2
|
|
|
|
|
10
|
*rw = \&Mite::Shim::rw; |
41
|
2
|
|
|
|
|
6
|
*rwp = \&Mite::Shim::rwp; |
42
|
2
|
|
|
|
|
4
|
*true = \&Mite::Shim::true; |
43
|
2
|
|
|
|
|
4
|
}; |
44
|
2
|
|
|
|
|
2
|
|
45
|
2
|
|
|
|
|
68
|
# 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
|
2
|
|
|
2
|
|
10
|
BUILD => [ |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
1318
|
|
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
|
2
|
|
|
2
|
|
22
|
my ( $self, $role ) = @_; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
1060
|
|
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
|
44
|
|
|
44
|
|
56
|
|
118
|
44
|
|
|
|
|
32
|
# Alias for Moose/Moo-compatibility |
119
|
44
|
50
|
|
|
|
66
|
shift->DOES( @_ ); |
120
|
44
|
50
|
|
|
|
56
|
} |
121
|
44
|
50
|
0
|
|
|
58
|
|
|
|
|
33
|
|
|
|
|
122
|
0
|
0
|
0
|
|
|
0
|
# Method signatures |
123
|
|
|
|
|
|
|
our %SIGNATURE_FOR; |
124
|
44
|
|
|
|
|
152
|
|
125
|
|
|
|
|
|
|
$SIGNATURE_FOR{"foo"} = sub { |
126
|
|
|
|
|
|
|
my $__NEXT__ = shift; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
my ( @out, %tmp, $tmp, $dtmp, @head ); |
129
|
44
|
|
|
44
|
|
1928
|
|
130
|
|
|
|
|
|
|
@_ == 3 |
131
|
|
|
|
|
|
|
or croak( "Wrong number of parameters in signature for %s: got %d, %s", "foo", scalar( @_ ), "expected exactly 3 parameters" ); |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
@head = splice( @_, 0, 1 ); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# Parameter invocant (type: Defined) |
136
|
|
|
|
|
|
|
(defined($head[0])) |
137
|
|
|
|
|
|
|
or croak( "Type check failed in signature for foo: %s should be %s", "\$_[0]", "Defined" ); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# Parameter $_[0] (type: Int) |
140
|
|
|
|
|
|
|
(do { my $tmp = $_[0]; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) |
141
|
|
|
|
|
|
|
or croak( "Type check failed in signature for foo: %s should be %s", "\$_[1]", "Int" ); |
142
|
|
|
|
|
|
|
push( @out, $_[0] ); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# Parameter $_[1] (type: Bool) |
145
|
|
|
|
|
|
|
$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]; |
146
|
|
|
|
|
|
|
(!ref $tmp and (!defined $tmp or $tmp eq q() or $tmp eq '0' or $tmp eq '1')) |
147
|
|
|
|
|
|
|
or croak( "Type check failed in signature for foo: %s should be %s", "\$_[2]", "Bool" ); |
148
|
|
|
|
|
|
|
push( @out, $tmp ); |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
do { @_ = ( @head, @out ); goto $__NEXT__ }; |
151
|
|
|
|
|
|
|
}; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
1; |