Gin/Error.pm

filter: Statementstmt 94.1% 16 / 17 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod 100% 2 / 2 totaltotal 79.3% 23 / 29 CC 2 SCAR 4.6
CC
2
Cov
85%
new_code
2.3
codes
2.0
BEGIN
1.0
CRAP 1.6
« Gin/Hand.pm ↑ Summary
1 package Game::Gin::Error;
2  
3 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 10 ▶use Object::Proto::Sugar -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 10 our $VERSION = '0.03';
9  
10 10 my %MESSAGE = (
11 hand_over => 'the hand is over',
12 not_your_turn => 'it is not your turn',
13 not_legal => 'the rules do not offer that',
14 not_held => 'that card is not in your hand',
15 just_taken => 'you may not discard the card you have just taken',
16 cannot_knock => 'your deadwood is above the knock threshold',
17 not_big_gin => 'that hand is not big gin',
18 no_seed => 'a hand needs a seed',
19 );
20  
21 10 has code => (is => 'ro', isa => Str);
22 10 has message => (is => 'ro', isa => Str);
23  
24 9 ▶sub new_code {
Subroutine new_code: called CC=2 SCAR=8.1
Pod documented
25 9 my ($class, $code) = @_;
26 return $class->new(
27 code => $code,
28 9 ▶ message => $MESSAGE{$code} // $code,
Condition33%1/3
$MESSAGE{$code} // $code
l!l&&r!l&&!r
900
MC/DC0%0/2
$MESSAGE{$code} // $code
$MESSAGE{$code} $code
Truth table33%1/3
A // B
A= $MESSAGE{$code}B= $code
ABresult
1X1
011
000
29 );
30 }
31  
32 0 ▶sub codes { return sort keys %MESSAGE }
Subroutine codes: not called CC=1 SCAR=6.9
Pod documented
33  
34 10 1;
35  
36 __END__
« Gin/Hand.pm ↑ Summary