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
|
6
|
|
|
6
|
|
103
|
use 5.020; |
|
6
|
|
|
|
|
20
|
|
6
|
6
|
|
|
6
|
|
30
|
use strict; # redundant, but still useful to document |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
111
|
|
7
|
6
|
|
|
6
|
|
47
|
use warnings; |
|
6
|
|
|
|
|
24
|
|
|
6
|
|
|
|
|
311
|
|
8
|
|
|
|
|
|
|
{ our $VERSION = '0.004'; } |
9
|
6
|
|
|
6
|
|
38
|
use English qw< -no_match_vars >; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
33
|
|
10
|
6
|
|
|
6
|
|
2251
|
use Mo qw< build default >; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
29
|
|
11
|
6
|
|
|
6
|
|
1741
|
use Ouch; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
31
|
|
12
|
6
|
|
|
6
|
|
543
|
use List::Util qw< shuffle >; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
634
|
|
13
|
|
|
|
|
|
|
|
14
|
6
|
|
|
6
|
|
51
|
use experimental qw< signatures postderef >; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
69
|
|
15
|
6
|
|
|
6
|
|
950
|
no warnings qw< experimental::signatures experimental::postderef >; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
1896
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has description => (default => ''); |
18
|
|
|
|
|
|
|
has group => (default => ''); |
19
|
|
|
|
|
|
|
has id => (default => undef); |
20
|
|
|
|
|
|
|
has name => (default => ''); |
21
|
|
|
|
|
|
|
has _cards => (default => []); |
22
|
|
|
|
|
|
|
|
23
|
8
|
|
|
8
|
1
|
318
|
sub BUILD ($self) { |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
15
|
|
24
|
8
|
|
|
|
|
50
|
$self->_cards(delete $self->{cards}); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
23
|
|
|
23
|
1
|
27
|
sub card_at ($self, $i) { |
|
23
|
|
|
|
|
29
|
|
|
23
|
|
|
|
|
27
|
|
|
23
|
|
|
|
|
31
|
|
28
|
23
|
|
|
|
|
38
|
my $cards = $self->_cards; |
29
|
23
|
50
|
33
|
|
|
165
|
ouch 500, 'invalid card index', $i |
30
|
|
|
|
|
|
|
if ($i < 0) || ($i > $#$cards); |
31
|
23
|
|
|
|
|
80
|
return $cards->[$i]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
22
|
|
|
22
|
1
|
6393
|
sub n_cards ($self) { return scalar($self->_cards->@*) } |
|
22
|
|
|
|
|
36
|
|
|
22
|
|
|
|
|
30
|
|
|
22
|
|
|
|
|
42
|
|
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
3
|
1
|
1696
|
sub cards ($self, @rest) { |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
5
|
|
37
|
3
|
50
|
|
|
|
16
|
$self->_cards([@rest]) if @rest > 0; |
38
|
3
|
|
|
|
|
12
|
return $self->_cards->@*; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |