File Coverage

blib/lib/Games/AssaultCube/Log/Line/CallVote.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             # Declare our package
2             package Games::AssaultCube::Log::Line::CallVote;
3              
4             # import the Moose stuff
5 1     1   2706 use Moose;
  0            
  0            
6              
7             # Initialize our version
8             use vars qw( $VERSION );
9             $VERSION = '0.04';
10              
11             extends 'Games::AssaultCube::Log::Line::Base';
12              
13             with 'Games::AssaultCube::Log::Line::Base::NickIP';
14              
15             # TODO improve validation for everything here, ha!
16              
17             has 'type' => (
18             isa => 'Str',
19             is => 'ro',
20             required => 1,
21             );
22              
23             has 'target' => (
24             isa => 'Str',
25             is => 'ro',
26             required => 1,
27             );
28              
29             has 'failure' => (
30             isa => 'Bool',
31             is => 'ro',
32             default => 0,
33             );
34              
35             has 'failure_reason' => (
36             isa => 'Str',
37             is => 'ro',
38             );
39              
40             has 'tostr' => (
41             isa => 'Str',
42             is => 'ro',
43             lazy => 1,
44             default => sub {
45             my $self = shift;
46             return $self->nick . " called a vote: " . $self->type . " to: " . $self->target . ( $self->failure ? " FAILED(" . $self->failure_reason . ")" : "" );
47             },
48             );
49              
50             no Moose;
51             __PACKAGE__->meta->make_immutable;
52              
53             1;
54             __END__
55              
56             =for stopwords mapname playername ip
57              
58             =head1 NAME
59              
60             Games::AssaultCube::Log::Line::CallVote - Describes the CallVote event in a log line
61              
62             =head1 ABSTRACT
63              
64             Describes the CallVote event in a log line
65              
66             =head1 DESCRIPTION
67              
68             This module holds the "CallVote" event data from a log line. Normally, you would not use this class directly
69             but via the L<Games::AssaultCube::Log::Line> class.
70              
71             This line is emitted when a client called a vote in the game.
72              
73             =head2 Attributes
74              
75             Those attributes hold information about the event. As this class extends the L<Games::AssaultCube::Log::Line::Base>
76             class, you can also use it's attributes too.
77              
78             =head3 nick
79              
80             The nick of the client who said something
81              
82             =head3 ip
83              
84             The ip of the client
85              
86             =head3 type
87              
88             The type of the vote
89              
90             ban [ nick ]
91             kick [ nick ]
92             force [ nick ]
93              
94             shuffle [ teams ]
95             load [ mapname - mode ]
96              
97             enable [ autoteam ]
98             disable [ autoteam ]
99              
100             stop [ demo ]
101             change [ mastermode ]
102             remove [ all bans ]
103             set [ server description ]
104              
105             invalid [ invalid ]
106              
107             =head3 target
108              
109             The target of the vote ( playername, mapname, etc - depends on the type )
110              
111             =head3 failure
112              
113             Boolean indicating if the vote failed or succeeded?
114              
115             =head3 failure_reason
116              
117             The reason for failure if it was true
118              
119             =head1 AUTHOR
120              
121             Apocalypse E<lt>apocal@cpan.orgE<gt>
122              
123             Props goes to the BS clan for the support!
124              
125             This project is sponsored by L<http://cubestats.net>
126              
127             =head1 COPYRIGHT AND LICENSE
128              
129             Copyright 2009 by Apocalypse
130              
131             This library is free software; you can redistribute it and/or modify
132             it under the same terms as Perl itself.
133              
134             =cut