line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
16
|
use warnings; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
71
|
|
4
|
1
|
|
|
1
|
|
16
|
no warnings qw( once void ); |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
115
|
|
5
|
1
|
|
|
1
|
|
17
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
323
|
|
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", "MyTestXX" ); |
12
|
1
|
|
|
1
|
|
7
|
( *after, *around, *before, *extends, *has, *signature_for, *with ) = do { |
13
|
1
|
|
|
|
|
2
|
no warnings 'redefine'; |
14
|
|
|
|
|
|
|
( |
15
|
1
|
|
|
1
|
|
10
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
357
|
|
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
|
|
|
|
|
26
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
22
|
0
|
|
|
|
|
0
|
); |
23
|
0
|
|
|
|
|
0
|
}; |
24
|
1
|
|
|
|
|
100
|
|
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
|
|
21
|
BUILD => [ |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
976
|
|
31
|
1
|
|
33
|
1
|
|
5
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
1
|
|
|
|
|
12
|
|
32
|
1
|
|
|
|
|
9
|
map { "$_\::BUILD" } reverse @$linear_isa |
33
|
|
|
|
|
|
|
], |
34
|
|
|
|
|
|
|
DEMOLISH => [ |
35
|
1
|
50
|
|
|
|
2
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
1
|
|
|
|
|
11
|
|
|
0
|
|
|
|
|
0
|
|
36
|
1
|
|
|
|
|
4
|
map { "$_\::DEMOLISH" } @$linear_isa |
37
|
|
|
|
|
|
|
], |
38
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
39
|
1
|
50
|
|
|
|
1
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
|
1
|
|
|
|
|
26
|
|
|
0
|
|
|
|
|
0
|
|
40
|
1
|
|
|
|
|
4
|
}; |
|
1
|
|
|
|
|
4
|
|
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
|
|
4280
|
|
51
|
4
|
|
66
|
|
|
30
|
# Attribute foo |
52
|
4
|
|
|
|
|
10
|
# has declaration, file ../../../../tmp/qPbyxg5Jk0, line 3 |
53
|
4
|
50
|
|
|
|
21
|
$self->{"foo"} = ( exists( $args->{"foo"} ) ? $args->{"foo"} : "99" ); |
|
0
|
50
|
|
|
|
0
|
|
54
|
4
|
|
|
|
|
7
|
|
55
|
|
|
|
|
|
|
# Attribute foo2 |
56
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/qPbyxg5Jk0, line 3 |
57
|
|
|
|
|
|
|
$self->{"foo2"} = ( exists( $args->{"foo2"} ) ? $args->{"foo2"} : "99" ); |
58
|
4
|
50
|
|
|
|
15
|
|
59
|
|
|
|
|
|
|
# Attribute xxx |
60
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/qPbyxg5Jk0, 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
|
|
|
|
8
|
|
|
1
|
|
|
|
|
2
|
|
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
|
|
|
14
|
return $self; |
|
4
|
50
|
|
|
|
16
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
4
|
100
|
|
|
|
5
|
# Used by constructor to call BUILD methods |
|
4
|
|
|
|
|
30
|
|
|
4
|
|
|
|
|
31
|
|
74
|
|
|
|
|
|
|
my $class = ref( $_[0] ); |
75
|
1
|
|
|
|
|
5
|
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
|
|
609
|
my $e = do { |
88
|
4
|
|
33
|
|
|
12
|
local ( $?, $@ ); |
89
|
4
|
|
33
|
|
|
12
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
90
|
4
|
50
|
|
|
|
23
|
$@; |
91
|
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
no warnings 'misc'; # avoid (in cleanup) warnings |
93
|
4
|
50
|
|
|
|
7
|
die $e if $e; # rethrow |
|
4
|
|
|
|
|
18
|
|
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
|
|
14
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
654
|
|
100
|
0
|
0
|
|
|
|
0
|
# Accessors for foo |
101
|
|
|
|
|
|
|
# has declaration, file ../../../../tmp/qPbyxg5Jk0, line 3 |
102
|
4
|
|
|
|
|
22
|
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/qPbyxg5Jk0, 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/qPbyxg5Jk0, 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/qPbyxg5Jk0, 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
|
|
19
|
} |
159
|
7
|
|
|
|
|
9
|
|
160
|
7
|
50
|
|
|
|
16
|
# Alias for Moose/Moo-compatibility |
161
|
7
|
50
|
|
|
|
11
|
shift->DOES( @_ ); |
162
|
7
|
50
|
0
|
|
|
17
|
} |
|
|
|
33
|
|
|
|
|
163
|
0
|
0
|
0
|
|
|
0
|
|
164
|
|
|
|
|
|
|
1; |