| 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
MC/DC0%0/2
$MESSAGE{$code} // $code
$MESSAGE{$code}
$code
Truth table33%1/3
A // B
A= $MESSAGE{$code}B= $code
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||