line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
7
|
no warnings qw( once void ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
5
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
156
|
|
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
|
|
4
|
( *after, *around, *before, *extends, *field, *has, *param, *signature_for, *with ) = do { |
13
|
1
|
|
|
|
|
4
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
1
|
|
|
1
|
|
7
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
258
|
|
16
|
|
|
|
|
|
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
17
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
18
|
0
|
|
|
0
|
|
0
|
sub {}, |
19
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) }, |
20
|
|
|
|
0
|
|
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
21
|
1
|
|
|
1
|
|
3
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
22
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
23
|
1
|
|
|
1
|
|
7
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
24
|
0
|
|
|
0
|
|
0
|
); |
25
|
0
|
|
|
0
|
|
0
|
}; |
26
|
1
|
|
|
|
|
94
|
|
27
|
|
|
|
|
|
|
# Mite imports |
28
|
|
|
|
|
|
|
BEGIN { |
29
|
|
|
|
|
|
|
*false = \&Mite::Shim::false; |
30
|
|
|
|
|
|
|
*true = \&Mite::Shim::true; |
31
|
|
|
|
|
|
|
}; |
32
|
1
|
|
|
1
|
|
5
|
|
33
|
1
|
|
|
|
|
38
|
# Gather metadata for constructor and destructor |
34
|
|
|
|
|
|
|
no strict 'refs'; |
35
|
|
|
|
|
|
|
my $class = shift; $class = ref($class) || $class; |
36
|
|
|
|
|
|
|
my $linear_isa = mro::get_linear_isa( $class ); |
37
|
|
|
|
|
|
|
return { |
38
|
1
|
|
|
1
|
|
12
|
BUILD => [ |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
659
|
|
39
|
1
|
|
33
|
1
|
|
2
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
1
|
|
|
|
|
5
|
|
40
|
1
|
|
|
|
|
4
|
map { "$_\::BUILD" } reverse @$linear_isa |
41
|
|
|
|
|
|
|
], |
42
|
|
|
|
|
|
|
DEMOLISH => [ |
43
|
1
|
50
|
|
|
|
2
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
1
|
|
|
|
|
6
|
|
|
0
|
|
|
|
|
0
|
|
44
|
1
|
|
|
|
|
4
|
map { "$_\::DEMOLISH" } @$linear_isa |
45
|
|
|
|
|
|
|
], |
46
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
47
|
1
|
50
|
|
|
|
1
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
1
|
|
|
|
|
19
|
|
|
0
|
|
|
|
|
0
|
|
48
|
1
|
|
|
|
|
2
|
}; |
|
1
|
|
|
|
|
3
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
53
|
|
|
|
|
|
|
my $class = ref($_[0]) ? ref(shift) : shift; |
54
|
|
|
|
|
|
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
55
|
|
|
|
|
|
|
my $self = bless {}, $class; |
56
|
|
|
|
|
|
|
my $args = $meta->{HAS_BUILDARGS} ? $class->BUILDARGS( @_ ) : { ( @_ == 1 ) ? %{$_[0]} : @_ }; |
57
|
|
|
|
|
|
|
my $no_build = delete $args->{__no_BUILD__}; |
58
|
3
|
50
|
|
3
|
|
2857
|
|
59
|
3
|
|
66
|
|
|
13
|
# Attribute foo |
60
|
3
|
|
|
|
|
5
|
# param declaration, file ../../../../tmp/GizcqLidYE, line 3 |
61
|
3
|
50
|
|
|
|
13
|
Mite::Shim::croak "Missing key in constructor: foo" unless exists $args->{"foo"}; |
|
0
|
50
|
|
|
|
0
|
|
62
|
3
|
|
|
|
|
6
|
$self->{"foo"} = $args->{"foo"}; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# Call BUILD methods |
66
|
3
|
100
|
|
|
|
9
|
$self->BUILDALL( $args ) if ( ! $no_build and @{ $meta->{BUILD} || [] } ); |
67
|
2
|
|
|
|
|
5
|
|
68
|
|
|
|
|
|
|
# Unrecognized parameters |
69
|
|
|
|
|
|
|
my @unknown = grep not( /\Afoo\z/ ), keys %{$args}; @unknown and Mite::Shim::croak( "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
70
|
|
|
|
|
|
|
|
71
|
2
|
50
|
33
|
|
|
8
|
return $self; |
|
2
|
50
|
|
|
|
8
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
2
|
100
|
|
|
|
2
|
# Used by constructor to call BUILD methods |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
12
|
|
75
|
|
|
|
|
|
|
my $class = ref( $_[0] ); |
76
|
1
|
|
|
|
|
9
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
77
|
|
|
|
|
|
|
$_->( @_ ) for @{ $meta->{BUILD} || [] }; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
81
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
82
|
0
|
|
0
|
|
|
0
|
my $class = ref( $self ) || $self; |
83
|
0
|
0
|
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
|
0
|
|
|
|
|
0
|
|
84
|
|
|
|
|
|
|
my $in_global_destruction = defined ${^GLOBAL_PHASE} |
85
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
86
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
87
|
|
|
|
|
|
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
88
|
3
|
|
|
3
|
|
607
|
my $e = do { |
89
|
3
|
|
33
|
|
|
8
|
local ( $?, $@ ); |
90
|
3
|
|
33
|
|
|
21
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
91
|
3
|
50
|
|
|
|
11
|
$@; |
92
|
|
|
|
|
|
|
}; |
93
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
94
|
3
|
50
|
|
|
|
4
|
die $e if $e; # rethrow |
|
3
|
|
|
|
|
14
|
|
95
|
0
|
|
|
|
|
0
|
} |
96
|
0
|
|
|
|
|
0
|
return; |
97
|
0
|
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
98
|
0
|
|
|
|
|
0
|
|
99
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
100
|
1
|
|
|
1
|
|
7
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
444
|
|
101
|
0
|
0
|
|
|
|
0
|
# Accessors for bar |
102
|
|
|
|
|
|
|
# field declaration, file ../../../../tmp/GizcqLidYE, line 4 |
103
|
3
|
|
|
|
|
12
|
|
104
|
|
|
|
|
|
|
# Accessors for foo |
105
|
|
|
|
|
|
|
# param declaration, file ../../../../tmp/GizcqLidYE, line 3 |
106
|
|
|
|
|
|
|
if ( $__XS ) { |
107
|
|
|
|
|
|
|
Class::XSAccessor->import( |
108
|
|
|
|
|
|
|
chained => 1, |
109
|
|
|
|
|
|
|
"getters" => { "foo" => "foo" }, |
110
|
1
|
50
|
|
1
|
|
1050
|
); |
|
1
|
50
|
|
|
|
5
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
|
|
|
|
|
|
*foo = sub { @_ == 1 or Mite::Shim::croak( 'Reader "foo" usage: $self->foo()' ); $_[0]{"foo"} }; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# See UNIVERSAL |
118
|
|
|
|
|
|
|
my ( $self, $role ) = @_; |
119
|
|
|
|
|
|
|
our %DOES; |
120
|
|
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
121
|
|
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
122
|
|
|
|
|
|
|
if ( $INC{'Moose/Util.pm'} and my $meta = Moose::Util::find_meta( ref $self or $self ) ) { |
123
|
|
|
|
|
|
|
$meta->can( 'does_role' ) and $meta->does_role( $role ) and return 1; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
return $self->SUPER::DOES( $role ); |
126
|
|
|
|
|
|
|
} |
127
|
0
|
|
|
0
|
|
|
|
128
|
0
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
129
|
0
|
0
|
|
|
|
|
shift->DOES( @_ ); |
130
|
0
|
0
|
|
|
|
|
} |
131
|
0
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
132
|
0
|
0
|
0
|
|
|
|
1; |