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