File Coverage

blib/lib/Games/AssaultCube/Log/Line/Status.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::Status;
3              
4             # import the Moose stuff
5 1     1   2767 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             # TODO improve validation for everything here, ha!
14              
15             has 'datetime' => (
16             isa => 'DateTime',
17             is => 'ro',
18             required => 1,
19             );
20              
21             has 'players' => (
22             isa => 'Int',
23             is => 'ro',
24             required => 1,
25             );
26              
27             has 'sent' => (
28             isa => 'Num',
29             is => 'ro',
30             required => 1,
31             );
32              
33             has 'recv' => (
34             isa => 'Num',
35             is => 'ro',
36             required => 1,
37             );
38              
39             has 'tostr' => (
40             isa => 'Str',
41             is => 'ro',
42             lazy => 1,
43             default => sub {
44             my $self = shift;
45             return "Status: " . $self->players . " players, sent " . $self->sent . " bytes, recv " . $self->recv . " bytes at " . $self->datetime->datetime;
46             },
47             );
48              
49             no Moose;
50             __PACKAGE__->meta->make_immutable;
51              
52             1;
53             __END__
54              
55             =for stopwords datetime kbytes sec
56              
57             =head1 NAME
58              
59             Games::AssaultCube::Log::Line::Status - Describes the Status event in a log line
60              
61             =head1 ABSTRACT
62              
63             Describes the Status event in a log line
64              
65             =head1 DESCRIPTION
66              
67             This module holds the "Status" event data from a log line. Normally, you would not use this class directly
68             but via the L<Games::AssaultCube::Log::Line> class.
69              
70             This line is emitted once in a while as the AC server goes through the game.
71              
72             =head2 Attributes
73              
74             Those attributes hold information about the event. As this class extends the L<Games::AssaultCube::Log::Line::Base>
75             class, you can also use it's attributes too.
76              
77             =head3 datetime
78              
79             The DateTime object representing the time this event was logged
80              
81             =head3 players
82              
83             The number of connected players
84              
85             =head3 sent
86              
87             The number of Kbytes sent per sec ( float )
88              
89             =head3 recv
90              
91             The number of Kbytes sent per sec ( float )
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