File Coverage

blib/lib/Games/AssaultCube/Log/Line/DemoStop.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::DemoStop;
3              
4             # import the Moose stuff
5 1     1   2511 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::GameMode';
14              
15             # TODO improve validation for everything here, ha!
16              
17             has 'datetime' => (
18             isa => 'DateTime',
19             is => 'ro',
20             required => 1,
21             );
22              
23             has 'map' => (
24             isa => 'Str',
25             is => 'ro',
26             required => 1,
27             );
28              
29             has 'size' => (
30             isa => 'Int',
31             is => 'ro',
32             required => 1,
33             );
34              
35             has 'tostr' => (
36             isa => 'Str',
37             is => 'ro',
38             lazy => 1,
39             default => sub {
40             my $self = shift;
41             return "Stopped recording demo: " . $self->size . " bytes, map " . $self->map . ", gamemode " . $self->gamemode_fullname . " at " . $self->datetime->datetime;
42             },
43             );
44              
45             no Moose;
46             __PACKAGE__->meta->make_immutable;
47              
48             1;
49             __END__
50              
51             =for stopwords CTF TDM gamemode datetime
52              
53             =head1 NAME
54              
55             Games::AssaultCube::Log::Line::DemoStop - Describes the DemoStop event in a log line
56              
57             =head1 ABSTRACT
58              
59             Describes the DemoStop event in a log line
60              
61             =head1 DESCRIPTION
62              
63             This module holds the "DemoStop" 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 the AC server stops recording a demo.
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 datetime
74              
75             The DateTime object representing the time when the server stopped recording the demo
76              
77             =head3 gamemode
78              
79             The numeric AssaultCube gamemode ( look at L<Games::AssaultCube::Utils> for more info )
80              
81             P.S. It's better to use the gamemode_fullname or gamemode_name accessors
82              
83             =head3 gamemode_name
84              
85             The gamemode name ( CTF, TDM, etc )
86              
87             =head3 gamemode_fullname
88              
89             The full gamemode name ( "capture the flag", "team one shot one kill", etc )
90              
91             =head3 map
92              
93             The map name
94              
95             =head3 size
96              
97             The size of the demo ( in bytes )
98              
99             =head1 AUTHOR
100              
101             Apocalypse E<lt>apocal@cpan.orgE<gt>
102              
103             Props goes to the BS clan for the support!
104              
105             This project is sponsored by L<http://cubestats.net>
106              
107             =head1 COPYRIGHT AND LICENSE
108              
109             Copyright 2009 by Apocalypse
110              
111             This library is free software; you can redistribute it and/or modify
112             it under the same terms as Perl itself.
113              
114             =cut