line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Card::Numeric; |
4
|
4
|
|
|
4
|
|
29
|
use strict; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
126
|
|
5
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
115
|
|
6
|
4
|
|
|
4
|
|
19
|
no warnings qw( once void ); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
505
|
|
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
|
4
|
|
|
4
|
|
20
|
my ( $SHIM, $CALLER ) = |
15
|
|
|
|
|
|
|
( "Acme::Mitey::Cards::Mite", "Acme::Mitey::Cards::Card::Numeric" ); |
16
|
|
|
|
|
|
|
( |
17
|
|
|
|
|
|
|
*after, *around, *before, *extends, *field, |
18
|
|
|
|
|
|
|
*has, *param, *signature_for, *with |
19
|
|
|
|
|
|
|
) |
20
|
4
|
|
|
|
|
8
|
= do { |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Mite; |
23
|
4
|
|
|
4
|
|
28
|
no warnings 'redefine'; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
887
|
|
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
|
|
|
|
4
|
|
|
sub { }, |
29
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) }, |
30
|
8
|
|
|
8
|
|
35
|
sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, |
31
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, |
32
|
8
|
|
|
8
|
|
30
|
sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) }, |
33
|
0
|
|
|
0
|
|
0
|
sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, |
34
|
4
|
|
|
|
|
798
|
); |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Mite imports |
39
|
|
|
|
|
|
|
BEGIN { |
40
|
4
|
|
|
4
|
|
31
|
require Scalar::Util; |
41
|
4
|
|
|
|
|
13
|
*STRICT = \&Acme::Mitey::Cards::Mite::STRICT; |
42
|
4
|
|
|
|
|
10
|
*bare = \&Acme::Mitey::Cards::Mite::bare; |
43
|
4
|
|
|
|
|
10
|
*blessed = \&Scalar::Util::blessed; |
44
|
4
|
|
|
|
|
8
|
*carp = \&Acme::Mitey::Cards::Mite::carp; |
45
|
4
|
|
|
|
|
8
|
*confess = \&Acme::Mitey::Cards::Mite::confess; |
46
|
4
|
|
|
|
|
9
|
*croak = \&Acme::Mitey::Cards::Mite::croak; |
47
|
4
|
|
|
|
|
10
|
*false = \&Acme::Mitey::Cards::Mite::false; |
48
|
4
|
|
|
|
|
30
|
*guard = \&Acme::Mitey::Cards::Mite::guard; |
49
|
4
|
|
|
|
|
9
|
*lazy = \&Acme::Mitey::Cards::Mite::lazy; |
50
|
4
|
|
|
|
|
8
|
*lock = \&Acme::Mitey::Cards::Mite::lock; |
51
|
4
|
|
|
|
|
9
|
*ro = \&Acme::Mitey::Cards::Mite::ro; |
52
|
4
|
|
|
|
|
8
|
*rw = \&Acme::Mitey::Cards::Mite::rw; |
53
|
4
|
|
|
|
|
6
|
*rwp = \&Acme::Mitey::Cards::Mite::rwp; |
54
|
4
|
|
|
|
|
10
|
*true = \&Acme::Mitey::Cards::Mite::true; |
55
|
4
|
|
|
|
|
180
|
*unlock = \&Acme::Mitey::Cards::Mite::unlock; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
BEGIN { |
59
|
4
|
|
|
4
|
|
1105
|
require Acme::Mitey::Cards::Card; |
60
|
|
|
|
|
|
|
|
61
|
4
|
|
|
4
|
|
27
|
use mro 'c3'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
95
|
|
62
|
4
|
|
|
|
|
10
|
our @ISA; |
63
|
4
|
|
|
|
|
1266
|
push @ISA, "Acme::Mitey::Cards::Card"; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Standard Moose/Moo-style constructor |
67
|
|
|
|
|
|
|
sub new { |
68
|
42
|
50
|
|
42
|
0
|
216
|
my $class = ref( $_[0] ) ? ref(shift) : shift; |
69
|
42
|
|
66
|
|
|
119
|
my $meta = ( $Mite::META{$class} ||= $class->__META__ ); |
70
|
42
|
|
|
|
|
86
|
my $self = bless {}, $class; |
71
|
|
|
|
|
|
|
my $args = |
72
|
|
|
|
|
|
|
$meta->{HAS_BUILDARGS} |
73
|
|
|
|
|
|
|
? $class->BUILDARGS(@_) |
74
|
42
|
50
|
|
|
|
157
|
: { ( @_ == 1 ) ? %{ $_[0] } : @_ }; |
|
0
|
50
|
|
|
|
0
|
|
75
|
42
|
|
|
|
|
83
|
my $no_build = delete $args->{__no_BUILD__}; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Attribute deck (type: Deck) |
78
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card.pm, line 9 |
79
|
42
|
100
|
|
|
|
82
|
if ( exists $args->{"deck"} ) { |
80
|
|
|
|
|
|
|
blessed( $args->{"deck"} ) |
81
|
40
|
50
|
33
|
|
|
207
|
&& $args->{"deck"}->isa("Acme::Mitey::Cards::Deck") |
82
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
83
|
|
|
|
|
|
|
"deck", "Deck"; |
84
|
40
|
|
|
|
|
97
|
$self->{"deck"} = $args->{"deck"}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
require Scalar::Util && Scalar::Util::weaken( $self->{"deck"} ) |
87
|
42
|
100
|
33
|
|
|
606
|
if ref $self->{"deck"}; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# Attribute reverse (type: Str) |
90
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card.pm, line 19 |
91
|
42
|
100
|
|
|
|
85
|
if ( exists $args->{"reverse"} ) { |
92
|
2
|
50
|
|
|
|
3
|
do { |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Mite; |
95
|
2
|
50
|
|
|
|
6
|
defined( $args->{"reverse"} ) and do { |
96
|
|
|
|
|
|
|
ref( \$args->{"reverse"} ) eq 'SCALAR' |
97
|
2
|
50
|
|
|
|
12
|
or ref( \( my $val = $args->{"reverse"} ) ) eq 'SCALAR'; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
101
|
|
|
|
|
|
|
"reverse", "Str"; |
102
|
2
|
|
|
|
|
5
|
$self->{"reverse"} = $args->{"reverse"}; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Attribute suit (type: Suit) |
106
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card/Numeric.pm, line 13 |
107
|
42
|
50
|
|
|
|
116
|
croak "Missing key in constructor: suit" unless exists $args->{"suit"}; |
108
|
42
|
|
|
|
|
58
|
do { |
109
|
42
|
|
|
|
|
60
|
my $coerced_value = do { |
110
|
42
|
|
|
|
|
65
|
my $to_coerce = $args->{"suit"}; |
111
|
|
|
|
|
|
|
( |
112
|
|
|
|
|
|
|
( |
113
|
|
|
|
|
|
|
do { |
114
|
4
|
|
|
4
|
|
32
|
use Scalar::Util (); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
4230
|
|
115
|
42
|
50
|
|
|
|
251
|
Scalar::Util::blessed($to_coerce) |
116
|
|
|
|
|
|
|
and $to_coerce->isa(q[Acme::Mitey::Cards::Suit]); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
) |
119
|
|
|
|
|
|
|
) ? $to_coerce : ( |
120
|
|
|
|
|
|
|
do { |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Mite; |
123
|
0
|
0
|
|
|
|
0
|
defined($to_coerce) and do { |
124
|
0
|
0
|
|
|
|
0
|
ref( \$to_coerce ) eq 'SCALAR' |
125
|
|
|
|
|
|
|
or ref( \( my $val = $to_coerce ) ) eq 'SCALAR'; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
) |
129
|
|
|
|
|
|
|
? scalar( |
130
|
42
|
0
|
|
|
|
66
|
do { |
|
|
50
|
|
|
|
|
|
131
|
0
|
|
|
|
|
0
|
local $_ = $to_coerce; |
132
|
0
|
|
|
|
|
0
|
do { |
133
|
0
|
|
|
|
|
0
|
my $method = lc($_); |
134
|
0
|
|
|
|
|
0
|
'Acme::Mitey::Cards::Suit'->$method; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
) |
138
|
|
|
|
|
|
|
: $to_coerce; |
139
|
|
|
|
|
|
|
}; |
140
|
42
|
50
|
33
|
|
|
195
|
blessed($coerced_value) |
141
|
|
|
|
|
|
|
&& $coerced_value->isa("Acme::Mitey::Cards::Suit") |
142
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
143
|
|
|
|
|
|
|
"suit", "Suit"; |
144
|
42
|
|
|
|
|
97
|
$self->{"suit"} = $coerced_value; |
145
|
|
|
|
|
|
|
}; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# Attribute number (type: CardNumber) |
148
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card/Numeric.pm, line 20 |
149
|
|
|
|
|
|
|
croak "Missing key in constructor: number" |
150
|
42
|
50
|
|
|
|
89
|
unless exists $args->{"number"}; |
151
|
42
|
|
|
|
|
56
|
do { |
152
|
42
|
|
|
|
|
59
|
my $coerced_value = do { |
153
|
42
|
|
|
|
|
60
|
my $to_coerce = $args->{"number"}; |
154
|
|
|
|
|
|
|
( |
155
|
|
|
|
|
|
|
( |
156
|
|
|
|
|
|
|
do { |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Mite; |
159
|
|
|
|
|
|
|
( |
160
|
|
|
|
|
|
|
do { |
161
|
|
|
|
|
|
|
my $tmp = $to_coerce; |
162
|
|
|
|
|
|
|
defined($tmp) |
163
|
|
|
|
|
|
|
and !ref($tmp) |
164
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
&& ( $to_coerce >= 1 ) |
169
|
|
|
|
|
|
|
&& ( $to_coerce <= 10 ) |
170
|
|
|
|
|
|
|
) |
171
|
|
|
|
|
|
|
) ? $to_coerce : ( |
172
|
|
|
|
|
|
|
do { |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Mite; |
175
|
0
|
0
|
0
|
|
|
0
|
( defined($to_coerce) |
176
|
|
|
|
|
|
|
and !ref($to_coerce) |
177
|
|
|
|
|
|
|
and $to_coerce =~ m{\A(?:[Aa])\z} ); |
178
|
|
|
|
|
|
|
} |
179
|
42
|
0
|
33
|
|
|
63
|
) ? scalar( do { local $_ = $to_coerce; 1 } ) : $to_coerce; |
|
0
|
50
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
180
|
|
|
|
|
|
|
}; |
181
|
|
|
|
|
|
|
( |
182
|
42
|
50
|
33
|
|
|
76
|
do { |
|
|
|
33
|
|
|
|
|
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
package Acme::Mitey::Cards::Mite; |
185
|
|
|
|
|
|
|
( |
186
|
42
|
|
|
|
|
58
|
do { |
187
|
42
|
|
|
|
|
61
|
my $tmp = $coerced_value; |
188
|
42
|
50
|
33
|
|
|
342
|
defined($tmp) |
189
|
|
|
|
|
|
|
and !ref($tmp) |
190
|
|
|
|
|
|
|
and $tmp =~ /\A-?[0-9]+\z/; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
); |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
&& ( $coerced_value >= 1 ) |
195
|
|
|
|
|
|
|
&& ( $coerced_value <= 10 ) |
196
|
|
|
|
|
|
|
) |
197
|
|
|
|
|
|
|
or croak "Type check failed in constructor: %s should be %s", |
198
|
|
|
|
|
|
|
"number", "CardNumber"; |
199
|
42
|
|
|
|
|
92
|
$self->{"number"} = $coerced_value; |
200
|
|
|
|
|
|
|
}; |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
# Call BUILD methods |
203
|
42
|
50
|
33
|
|
|
88
|
$self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } ); |
|
42
|
50
|
|
|
|
127
|
|
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
# Unrecognized parameters |
206
|
|
|
|
|
|
|
my @unknown = grep not(/\A(?:deck|number|reverse|suit)\z/), |
207
|
42
|
|
|
|
|
67
|
keys %{$args}; |
|
42
|
|
|
|
|
238
|
|
208
|
|
|
|
|
|
|
@unknown |
209
|
42
|
50
|
|
|
|
108
|
and croak( |
210
|
|
|
|
|
|
|
"Unexpected keys in constructor: " . join( q[, ], sort @unknown ) ); |
211
|
|
|
|
|
|
|
|
212
|
42
|
|
|
|
|
157
|
return $self; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
my $__XS = !$ENV{PERL_ONLY} |
216
|
|
|
|
|
|
|
&& eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") }; |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
# Accessors for number |
219
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card/Numeric.pm, line 20 |
220
|
|
|
|
|
|
|
if ($__XS) { |
221
|
|
|
|
|
|
|
Class::XSAccessor->import( |
222
|
|
|
|
|
|
|
chained => 1, |
223
|
|
|
|
|
|
|
"getters" => { "number" => "number" }, |
224
|
|
|
|
|
|
|
); |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
else { |
227
|
|
|
|
|
|
|
*number = sub { |
228
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "number" usage: $self->number()'); |
229
|
|
|
|
|
|
|
$_[0]{"number"}; |
230
|
|
|
|
|
|
|
}; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
# Accessors for suit |
234
|
|
|
|
|
|
|
# has declaration, file lib/Acme/Mitey/Cards/Card/Numeric.pm, line 13 |
235
|
|
|
|
|
|
|
if ($__XS) { |
236
|
|
|
|
|
|
|
Class::XSAccessor->import( |
237
|
|
|
|
|
|
|
chained => 1, |
238
|
|
|
|
|
|
|
"getters" => { "suit" => "suit" }, |
239
|
|
|
|
|
|
|
); |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
else { |
242
|
|
|
|
|
|
|
*suit = sub { |
243
|
|
|
|
|
|
|
@_ == 1 or croak('Reader "suit" usage: $self->suit()'); |
244
|
|
|
|
|
|
|
$_[0]{"suit"}; |
245
|
|
|
|
|
|
|
}; |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
# See UNIVERSAL |
249
|
|
|
|
|
|
|
sub DOES { |
250
|
0
|
|
|
0
|
0
|
|
my ( $self, $role ) = @_; |
251
|
0
|
|
|
|
|
|
our %DOES; |
252
|
0
|
0
|
|
|
|
|
return $DOES{$role} if exists $DOES{$role}; |
253
|
0
|
0
|
|
|
|
|
return 1 if $role eq __PACKAGE__; |
254
|
0
|
0
|
0
|
|
|
|
if ( $INC{'Moose/Util.pm'} |
|
|
|
0
|
|
|
|
|
255
|
|
|
|
|
|
|
and my $meta = Moose::Util::find_meta( ref $self or $self ) ) |
256
|
|
|
|
|
|
|
{ |
257
|
0
|
0
|
0
|
|
|
|
$meta->can('does_role') and $meta->does_role($role) and return 1; |
258
|
|
|
|
|
|
|
} |
259
|
0
|
|
|
|
|
|
return $self->SUPER::DOES($role); |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
# Alias for Moose/Moo-compatibility |
263
|
|
|
|
|
|
|
sub does { |
264
|
0
|
|
|
0
|
0
|
|
shift->DOES(@_); |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
# Method signatures |
268
|
|
|
|
|
|
|
our %SIGNATURE_FOR; |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
$SIGNATURE_FOR{"number_or_a"} = sub { |
271
|
|
|
|
|
|
|
my $__NEXT__ = shift; |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
my ( %tmp, $tmp, @head ); |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
@_ == 1 |
276
|
|
|
|
|
|
|
or |
277
|
|
|
|
|
|
|
croak( "Wrong number of parameters in signature for %s: got %d, %s", |
278
|
|
|
|
|
|
|
"number_or_a", scalar(@_), "expected exactly 1 parameters" ); |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
@head = splice( @_, 0, 1 ); |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
# Parameter invocant (type: Defined) |
283
|
|
|
|
|
|
|
( defined( $head[0] ) ) |
284
|
|
|
|
|
|
|
or croak( |
285
|
|
|
|
|
|
|
"Type check failed in signature for number_or_a: %s should be %s", |
286
|
|
|
|
|
|
|
"\$_[0]", "Defined" ); |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
do { @_ = ( @head, @_ ); goto $__NEXT__ }; |
289
|
|
|
|
|
|
|
}; |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
$SIGNATURE_FOR{"to_string"} = |
292
|
|
|
|
|
|
|
$Acme::Mitey::Cards::Card::SIGNATURE_FOR{"to_string"}; |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
1; |
295
|
|
|
|
|
|
|
} |