line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Card; |
4
|
9
|
|
|
9
|
|
63
|
use strict; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
271
|
|
5
|
9
|
|
|
9
|
|
47
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
250
|
|
6
|
9
|
|
|
9
|
|
48
|
no warnings qw( once void ); |
|
9
|
|
|
|
|
25
|
|
|
9
|
|
|
|
|
1107
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $USES_MITE = "Mite::Class"; |
9
|
|
|
|
|
|
|
our $MITE_SHIM = "Acme::Mitey::Cards::Mite"; |
10
|
|
|
|
|
|
|
our $MITE_VERSION = "0.011000"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Mite keywords |
13
|
|
|
|
|
|
|
BEGIN { |
14
|
9
|
|
|
9
|
|
53
|
my ( $SHIM, $CALLER ) = |
15
|
|
|
|
|
|
|
( "Acme::Mitey::Cards::Mite", "Acme::Mitey::Cards::Card" ); |
16
|
|
|
|
|
|
|
( |
17
|
|
|
|
|
|
|
*after, *around, *before, *extends, *field, |
18
|
|
|
|
|
|
|
*has, *param, *signature_for, *with |
19
|
|
|
|
|
|
|
) |
20
|
9
|
|
|
|
|
21
|
= do { |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Mite; |
23
|
9
|
|
|
9
|
|
60
|
no warnings 'redefine'; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
2017
|
|
24
|
|
|
|
|
|
|
( |
25
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) }, |
26
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) }, |
27
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) }, |
28
|
|
|
|
0
|
|
|
sub { }, |
29
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) }, |
30
|
18
|
|
|
18
|
|
104
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
31
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
32
|
9
|
|
|
9
|
|
46
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
33
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
34
|
9
|
|
|
|
|
1745
|
); |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Mite imports |
39
|
|
|
|
|
|
|
BEGIN { |
40
|
9
|
|
|
9
|
|
67
|
require Scalar::Util; |
41
|
9
|
|
|
|
|
62
|
*STRICT = \&Acme::Mitey::Cards::Mite::STRICT; |
42
|
9
|
|
|
|
|
24
|
*bare = \&Acme::Mitey::Cards::Mite::bare; |
43
|
9
|
|
|
|
|
19
|
*blessed = \&Scalar::Util::blessed; |
44
|
9
|
|
|
|
|
21
|
*carp = \&Acme::Mitey::Cards::Mite::carp; |
45
|
9
|
|
|
|
|
16
|
*confess = \&Acme::Mitey::Cards::Mite::confess; |
46
|
9
|
|
|
|
|
20
|
*croak = \&Acme::Mitey::Cards::Mite::croak; |
47
|
9
|
|
|
|
|
28
|
*false = \&Acme::Mitey::Cards::Mite::false; |
48
|
9
|
|
|
|
|
17
|
*guard = \&Acme::Mitey::Cards::Mite::guard; |
49
|
9
|
|
|
|
|
27
|
*lazy = \&Acme::Mitey::Cards::Mite::lazy; |
50
|
9
|
|
|
|
|
19
|
*lock = \&Acme::Mitey::Cards::Mite::lock; |
51
|
9
|
|
|
|
|
16
|
*ro = \&Acme::Mitey::Cards::Mite::ro; |
52
|
9
|
|
|
|
|
18
|
*rw = \&Acme::Mitey::Cards::Mite::rw; |
53
|
9
|
|
|
|
|
17
|
*rwp = \&Acme::Mitey::Cards::Mite::rwp; |
54
|
9
|
|
|
|
|
16
|
*true = \&Acme::Mitey::Cards::Mite::true; |
55
|
9
|
|
|
|
|
352
|
*unlock = \&Acme::Mitey::Cards::Mite::unlock; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Gather metadata for constructor and destructor |
59
|
|
|
|
|
|
|
sub __META__ { |
60
|
9
|
|
|
9
|
|
64
|
no strict 'refs'; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
7380
|
|
61
|
9
|
|
|
9
|
|
26
|
my $class = shift; |
62
|
9
|
|
33
|
|
|
44
|
$class = ref($class) || $class; |
63
|
9
|
|
|
|
|
47
|
my $linear_isa = mro::get_linear_isa($class); |
64
|
|
|
|
|
|
|
return { |
65
|
|
|
|
|
|
|
BUILD => [ |
66
|
15
|
50
|
|
|
|
23
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
15
|
|
|
|
|
98
|
|
|
0
|
|
|
|
|
0
|
|
67
|
15
|
|
|
|
|
55
|
map { "$_\::BUILD" } reverse @$linear_isa |
68
|
|
|
|
|
|
|
], |
69
|
|
|
|
|
|
|
DEMOLISH => [ |
70
|
15
|
50
|
|
|
|
25
|
map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } |
|
15
|
|
|
|
|
196
|
|
|
0
|
|
|
|
|
0
|
|
71
|
9
|
|
|
|
|
30
|
map { "$_\::DEMOLISH" } @$linear_isa |
|
15
|
|
|
|
|
47
|
|
72
|
|
|
|
|
|
|
], |
73
|
|
|
|
|
|
|
HAS_BUILDARGS => $class->can('BUILDARGS'), |
74
|
|
|
|
|
|
|
HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Moose-compatibility method |
79
|
|
|
|
|
|
|
sub meta { |
80
|
0
|
|
|
0
|
0
|
0
|
require Acme::Mitey::Cards::MOP; |
81
|
0
|
|
0
|
|
|
0
|
Moose::Util::find_meta( ref $_[0] or $_[0] ); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
85
|
|
|
|
|
|
|
sub new { |
86
|
6
|
50
|
|
6
|
0
|
1207
|
my $class = ref( $_[0] ) ? ref(shift) : shift; |
87
|
6
|
|
66
|
|
|
46
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
88
|
6
|
|
|
|
|
26
|
my $self = bless {}, $class; |
89
|
|
|
|
|
|
|
my $args = |
90
|
|
|
|
|
|
|
$meta->{HAS_BUILDARGS} |
91
|
|
|
|
|
|
|
? $class->BUILDARGS(@_) |
92
|
6
|
50
|
|
|
|
38
|
: { ( @_ == 1 ) ? %{ $_[0] } : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
93
|
6
|
|
|
|
|
17
|
my $no_build = delete $args->{__no_BUILD__}; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Attribute deck (type: Deck) |
96
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card.pm, line 9 |
97
|
6
|
100
|
|
|
|
24
|
if ( exists $args->{"deck"} ) { |
98
|
|
|
|
|
|
|
blessed( $args->{"deck"} ) |
99
|
2
|
50
|
33
|
|
|
50
|
&& $args->{"deck"}->isa("Acme::Mitey::Cards::Deck") |
100
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
101
|
|
|
|
|
|
|
"deck", "Deck"; |
102
|
2
|
|
|
|
|
13
|
$self->{"deck"} = $args->{"deck"}; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
require Scalar::Util && Scalar::Util::weaken( $self->{"deck"} ) |
105
|
6
|
100
|
33
|
|
|
42
|
if ref $self->{"deck"}; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# Attribute reverse (type: Str) |
108
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card.pm, line 19 |
109
|
6
|
100
|
|
|
|
24
|
if ( exists $args->{"reverse"} ) { |
110
|
2
|
50
|
|
|
|
3
|
do { |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Mite; |
113
|
2
|
50
|
|
|
|
9
|
defined( $args->{"reverse"} ) and do { |
114
|
|
|
|
|
|
|
ref( \$args->{"reverse"} ) eq 'SCALAR' |
115
|
2
|
50
|
|
|
|
13
|
or ref( \( my $val = $args->{"reverse"} ) ) eq 'SCALAR'; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
119
|
|
|
|
|
|
|
"reverse", "Str"; |
120
|
2
|
|
|
|
|
7
|
$self->{"reverse"} = $args->{"reverse"}; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# Call BUILD methods |
124
|
6
|
50
|
33
|
|
|
44
|
$self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } ); |
|
6
|
50
|
|
|
|
33
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
# Unrecognized parameters |
127
|
6
|
|
|
|
|
16
|
my @unknown = grep not(/\A(?:deck|reverse)\z/), keys %{$args}; |
|
6
|
|
|
|
|
53
|
|
128
|
|
|
|
|
|
|
@unknown |
129
|
6
|
50
|
|
|
|
23
|
and croak( |
130
|
|
|
|
|
|
|
"Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
131
|
|
|
|
|
|
|
|
132
|
6
|
|
|
|
|
353
|
return $self; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# Used by constructor to call BUILD methods |
136
|
|
|
|
|
|
|
sub BUILDALL { |
137
|
0
|
|
|
0
|
0
|
0
|
my $class = ref( $_[0] ); |
138
|
0
|
|
0
|
|
|
0
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
139
|
0
|
0
|
|
|
|
0
|
$_->(@_) for @{ $meta->{BUILD} || [] }; |
|
0
|
|
|
|
|
0
|
|
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
# Destructor should call DEMOLISH methods |
143
|
|
|
|
|
|
|
sub DESTROY { |
144
|
63
|
|
|
63
|
|
4432
|
my $self = shift; |
145
|
63
|
|
33
|
|
|
143
|
my $class = ref($self) || $self; |
146
|
63
|
|
33
|
|
|
133
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
147
|
63
|
50
|
|
|
|
161
|
my $in_global_destruction = |
148
|
|
|
|
|
|
|
defined ${^GLOBAL_PHASE} |
149
|
|
|
|
|
|
|
? ${^GLOBAL_PHASE} eq 'DESTRUCT' |
150
|
|
|
|
|
|
|
: Devel::GlobalDestruction::in_global_destruction(); |
151
|
63
|
50
|
|
|
|
91
|
for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) { |
|
63
|
|
|
|
|
163
|
|
152
|
0
|
|
|
|
|
0
|
my $e = do { |
153
|
0
|
|
|
|
|
0
|
local ( $?, $@ ); |
154
|
0
|
|
|
|
|
0
|
eval { $demolisher->( $self, $in_global_destruction ) }; |
|
0
|
|
|
|
|
0
|
|
155
|
0
|
|
|
|
|
0
|
$@; |
156
|
|
|
|
|
|
|
}; |
157
|
9
|
|
|
9
|
|
75
|
no warnings 'misc'; # avoid (in cleanup) warnings |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
5734
|
|
158
|
0
|
0
|
|
|
|
0
|
die $e if $e; # rethrow |
159
|
|
|
|
|
|
|
} |
160
|
63
|
|
|
|
|
883
|
return; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} |
164
|
|
|
|
|
|
|
&& eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
# Accessors for deck |
167
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card.pm, line 9 |
168
|
|
|
|
|
|
|
if ($__XS) { |
169
|
|
|
|
|
|
|
Class::XSAccessor->import( |
170
|
|
|
|
|
|
|
chained => 1, |
171
|
|
|
|
|
|
|
"getters" => { "deck" => "deck" }, |
172
|
|
|
|
|
|
|
); |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
else { |
175
|
|
|
|
|
|
|
*deck = sub { |
176
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "deck" usage: $self->deck()'); |
177
|
|
|
|
|
|
|
$_[0]{"deck"}; |
178
|
|
|
|
|
|
|
}; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
# Accessors for reverse |
182
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card.pm, line 19 |
183
|
|
|
|
|
|
|
sub reverse { |
184
|
6
|
50
|
|
6
|
0
|
908
|
@_ == 1 or croak('Reader "reverse" usage: $self->reverse()'); |
185
|
|
|
|
|
|
|
( |
186
|
|
|
|
|
|
|
exists( $_[0]{"reverse"} ) ? $_[0]{"reverse"} : ( |
187
|
6
|
100
|
|
|
|
52
|
$_[0]{"reverse"} = do { |
188
|
1
|
|
|
|
|
8
|
my $default_value = $_[0]->_build_reverse; |
189
|
1
|
50
|
|
|
|
3
|
do { |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Mite; |
192
|
1
|
50
|
|
|
|
5
|
defined($default_value) and do { |
193
|
1
|
50
|
|
|
|
8
|
ref( \$default_value ) eq 'SCALAR' |
194
|
|
|
|
|
|
|
or ref( \( my $val = $default_value ) ) eq |
195
|
|
|
|
|
|
|
'SCALAR'; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
or croak( "Type check failed in default: %s should be %s", |
199
|
|
|
|
|
|
|
"reverse", "Str" ); |
200
|
1
|
|
|
|
|
7
|
$default_value; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
) |
203
|
|
|
|
|
|
|
); |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
# See UNIVERSAL |
207
|
|
|
|
|
|
|
sub DOES { |
208
|
0
|
|
|
0
|
0
|
|
my ( $self, $role ) = @_; |
209
|
0
|
|
|
|
|
|
our %DOES; |
210
|
0
|
0
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
211
|
0
|
0
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
212
|
0
|
0
|
0
|
|
|
|
if ( $INC{'Moose/Util.pm'} |
|
|
|
0
|
|
|
|
|
213
|
|
|
|
|
|
|
and my $meta = Moose::Util::find_meta( ref $self or $self ) ) |
214
|
|
|
|
|
|
|
{ |
215
|
0
|
0
|
0
|
|
|
|
$meta->can('does_role') and $meta->does_role($role) and return 1; |
216
|
|
|
|
|
|
|
} |
217
|
0
|
|
|
|
|
|
return $self->SUPER::DOES($role); |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
221
|
|
|
|
|
|
|
sub does { |
222
|
0
|
|
|
0
|
0
|
|
shift->DOES(@_); |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
# Method signatures |
226
|
|
|
|
|
|
|
our %SIGNATURE_FOR; |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
$SIGNATURE_FOR{"to_string"} = sub { |
229
|
|
|
|
|
|
|
my $__NEXT__ = shift; |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
my ( %tmp, $tmp, @head ); |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
@_ == 1 |
234
|
|
|
|
|
|
|
or |
235
|
|
|
|
|
|
|
croak( "Wrong number of parameters in signature for %s: got %d, %s", |
236
|
|
|
|
|
|
|
"to_string", scalar(@_), "expected exactly 1 parameters" ); |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
@head = splice( @_, 0, 1 ); |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
# Parameter invocant (type: Defined) |
241
|
|
|
|
|
|
|
( defined( $head[0] ) ) |
242
|
|
|
|
|
|
|
or croak( |
243
|
|
|
|
|
|
|
"Type check failed in signature for to_string: %s should be %s", |
244
|
|
|
|
|
|
|
"\$_[0]", "Defined" ); |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
do { @_ = ( @head, @_ ); goto $__NEXT__ }; |
247
|
|
|
|
|
|
|
}; |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
1; |
250
|
|
|
|
|
|
|
} |