File Coverage

blib/lib/Games/AssaultCube/Log/Line/Says.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::Says;
3              
4             # import the Moose stuff
5 1     1   2681 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 'text' => (
18             isa => 'Str',
19             is => 'ro',
20             required => 1,
21             );
22              
23             has 'isteam' => (
24             isa => 'Bool',
25             is => 'ro',
26             default => 0,
27             );
28              
29             has 'spam' => (
30             isa => 'Bool',
31             is => 'ro',
32             default => 0,
33             );
34              
35             has 'tostr' => (
36             isa => 'Str',
37             is => 'ro',
38             lazy => 1,
39             default => sub {
40             my $self = shift;
41             return $self->nick . " said" . ( $self->isteam ? " to team: " : ": " ) . $self->text;
42             },
43             );
44              
45             no Moose;
46             __PACKAGE__->meta->make_immutable;
47              
48             1;
49             __END__
50              
51             =for stopwords isteam ip
52              
53             =head1 NAME
54              
55             Games::AssaultCube::Log::Line::Says - Describes the Says event in a log line
56              
57             =head1 ABSTRACT
58              
59             Describes the Says event in a log line
60              
61             =head1 DESCRIPTION
62              
63             This module holds the "Says" event data from a log line. Normally, you would not use this class directly
64             but via the L<Games::AssaultCube::Log::Line> class.
65              
66             This line is emitted when somebody said something in the game.
67              
68             =head2 Attributes
69              
70             Those attributes hold information about the event. As this class extends the L<Games::AssaultCube::Log::Line::Base>
71             class, you can also use it's attributes too.
72              
73             =head3 nick
74              
75             The nick of the client who said something
76              
77             =head3 text
78              
79             The text of what the client said ( sometimes it's a zero-length string... )
80              
81             =head3 ip
82              
83             The ip of the client
84              
85             =head3 isteam
86              
87             Boolean signifying if the client said it to the team or the public
88              
89             =head3 spam
90              
91             Boolean signifying if the server detected this text as SPAM ( repeated text in N seconds )
92              
93             =head1 AUTHOR
94              
95             Apocalypse E<lt>apocal@cpan.orgE<gt>
96              
97             Props goes to the BS clan for the support!
98              
99             This project is sponsored by L<http://cubestats.net>
100              
101             =head1 COPYRIGHT AND LICENSE
102              
103             Copyright 2009 by Apocalypse
104              
105             This library is free software; you can redistribute it and/or modify
106             it under the same terms as Perl itself.
107              
108             =cut