File Coverage

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