line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ordeal::Model::Deck; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# vim: ts=3 sts=3 sw=3 et ai : |
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
84
|
use 5.020; |
|
5
|
|
|
|
|
21
|
|
6
|
5
|
|
|
5
|
|
25
|
use strict; # redundant, but still useful to document |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
91
|
|
7
|
5
|
|
|
5
|
|
30
|
use warnings; |
|
5
|
|
|
|
|
39
|
|
|
5
|
|
|
|
|
268
|
|
8
|
|
|
|
|
|
|
{ our $VERSION = '0.003'; } |
9
|
5
|
|
|
5
|
|
30
|
use English qw< -no_match_vars >; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
28
|
|
10
|
5
|
|
|
5
|
|
1945
|
use Mo qw< build default >; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
32
|
|
11
|
5
|
|
|
5
|
|
1394
|
use Ouch; |
|
5
|
|
|
|
|
22
|
|
|
5
|
|
|
|
|
24
|
|
12
|
5
|
|
|
5
|
|
479
|
use List::Util qw< shuffle >; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
570
|
|
13
|
|
|
|
|
|
|
|
14
|
5
|
|
|
5
|
|
45
|
use experimental qw< signatures postderef >; |
|
5
|
|
|
|
|
25
|
|
|
5
|
|
|
|
|
54
|
|
15
|
5
|
|
|
5
|
|
764
|
no warnings qw< experimental::signatures experimental::postderef >; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
1629
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has description => (default => ''); |
18
|
|
|
|
|
|
|
has group => (default => ''); |
19
|
|
|
|
|
|
|
has id => (default => undef); |
20
|
|
|
|
|
|
|
has name => (default => ''); |
21
|
|
|
|
|
|
|
has _cards => (default => []); |
22
|
|
|
|
|
|
|
|
23
|
7
|
|
|
7
|
1
|
273
|
sub BUILD ($self) { |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
11
|
|
24
|
7
|
|
|
|
|
39
|
$self->_cards(delete $self->{cards}); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
23
|
|
|
23
|
1
|
31
|
sub card_at ($self, $i) { |
|
23
|
|
|
|
|
28
|
|
|
23
|
|
|
|
|
26
|
|
|
23
|
|
|
|
|
33
|
|
28
|
23
|
|
|
|
|
36
|
my $cards = $self->_cards; |
29
|
23
|
50
|
33
|
|
|
177
|
ouch 500, 'invalid card index', $i |
30
|
|
|
|
|
|
|
if ($i < 0) || ($i > $#$cards); |
31
|
23
|
|
|
|
|
73
|
return $cards->[$i]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
21
|
|
|
21
|
1
|
4302
|
sub n_cards ($self) { return scalar($self->_cards->@*) } |
|
21
|
|
|
|
|
34
|
|
|
21
|
|
|
|
|
32
|
|
|
21
|
|
|
|
|
48
|
|
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
2
|
1
|
1141
|
sub cards ($self, @rest) { |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
4
|
|
37
|
2
|
50
|
|
|
|
10
|
$self->_cards([@rest]) if @rest > 0; |
38
|
2
|
|
|
|
|
7
|
return $self->_cards->@*; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |