« Games/AssaultCube/Log/Line/ClientStatus.pm
↑ Summary
Games/AssaultCube/Log/Line/Base/RoleInfo.pm »
| 1 | # the gamemode role | ||||||||||||||||||||||||||||||||||||||||||
| 2 | package Games::AssaultCube::Log::Line::Base::GameMode; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | # Initialize our version | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use vars qw( $VERSION ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | $VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use Games::AssaultCube::Utils qw( get_gamemode_from_name get_gamemode_from_fullname get_gamemode_name get_gamemode_fullname ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | has 'gamemode' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 12 | isa => 'Int', | ||||||||||||||||||||||||||||||||||||||||||
| 13 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 14 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | ▶ | if ( exists $self->{'gamemode_name'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | return get_gamemode_from_name( $self->gamemode_name ); | |||||||||||||||||||||||||||||||||||||||||
| 19 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 6 | return get_gamemode_from_fullname( $self->gamemode_fullname ); | |||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||
| 22 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | ); | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | has 'gamemode_name' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 26 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||
| 27 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 28 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 6 | return get_gamemode_name( $self->gamemode ); | |||||||||||||||||||||||||||||||||||||||||
| 32 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | ); | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | has 'gamemode_fullname' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 36 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||
| 37 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 38 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | return get_gamemode_fullname( $self->gamemode ); | |||||||||||||||||||||||||||||||||||||||||
| 42 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | ); | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 8 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | # check role | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 8 | ▶ | if ( ! exists $self->{'gamemode'} and ! exists $self->{'gamemode_name'} and ! exists $self->{'gamemode_fullname'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
exists $self->{"gamemode"} or exists $self->{"gamemode_name"} or exists $self->{"gamemode_fullname"}
exists $self->{"gamemode"} or exists $self->{"gamemode_name"}
MC/DC0%0/3
exists $self->{"gamemode"} or exists $self->{"gamemode_name"} or exists $self->{"gamemode_fullname"}
exists $self->{"gamemode"}
exists $self->{"gamemode_name"}
exists $self->{"gamemode_fullname"}
Truth table50%2/4
A or B or C
A= exists $self->{"gamemode"}B= exists $self->{"gamemode_name"}C= exists $self->{"gamemode_fullname"}
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | die "Gamemode information is missing"; | |||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 8 | return; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 56 | __END__ | ||||||||||||||||||||||||||||||||||||||||||