| 1 | package Game::Durak::Error; | ||||||||||
| 2 | |||||||||||
| 3 | 21 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 21 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 21 | ▶ | use Object::Proto::Sugar -types; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 21 | our $VERSION = '0.03'; | |||||||||
| 9 | |||||||||||
| 10 | 21 | my %MESSAGE = ( | |||||||||
| 11 | no_seed => 'a deal needs a seed', | ||||||||||
| 12 | bad_deal => 'a deal number counts from one', | ||||||||||
| 13 | bad_seats => 'this engine deals two seats', | ||||||||||
| 14 | game_over => 'the deal is over', | ||||||||||
| 15 | not_your_turn => 'it is not your turn', | ||||||||||
| 16 | wrong_phase => 'that move does not fit this stage of the bout', | ||||||||||
| 17 | not_legal => 'the rules do not offer that', | ||||||||||
| 18 | card_not_held => 'you do not hold that card', | ||||||||||
| 19 | beats_nothing => 'that card does not beat the one in front of you', | ||||||||||
| 20 | rank_not_in_bout => 'nothing on the table has that rank', | ||||||||||
| 21 | bout_full => 'the attack is already as large as it may be', | ||||||||||
| 22 | must_attack => 'a bout has to be opened before it can be beaten off', | ||||||||||
| 23 | not_the_six => 'that exchange is not yours to make', | ||||||||||
| 24 | talon_shut => 'the turned up trump has been drawn', | ||||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | 21 | has code => (is => 'ro', isa => Str); | |||||||||
| 28 | 21 | has message => (is => 'ro', isa => Str); | |||||||||
| 29 | |||||||||||
| 30 | 33 | ▶ | sub new_code { | ||||||||
|
Subroutine
new_code: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 31 | 33 | my ($class, $code) = @_; | |||||||||
| 32 | return $class->new( | ||||||||||
| 33 | code => $code, | ||||||||||
| 34 | 33 | ▶ | message => defined $MESSAGE{$code} ? $MESSAGE{$code} : $code, | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | ); | ||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 1 | ▶ | sub codes { return sort keys %MESSAGE } | ||||||||
|
Subroutine
codes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 39 | |||||||||||
| 40 | 21 | 1; | |||||||||
| 41 | |||||||||||
| 42 | __END__ | ||||||||||