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