NAME
Games::AssaultCube::ServerQuery::Response - Holds the various data from a ServerQuery response
SYNOPSIS
use Games::AssaultCube::ServerQuery;
my $query = Games::AssaultCube::ServerQuery->new( 'my.server.com' );
#my $query = Games::AssaultCube::ServerQuery->new( 'my.server.com', 12345 );
#my $query = Games::AssaultCube::ServerQuery->new({ server => 'foo.com', port => 12345, timeout => 5 });
my $response = $query->run;
if ( defined $response ) {
print "Server is running with " . $response->players . " players\n";
} else {
print "Server is not responding!\n";
}
ABSTRACT
This module holds the various data from a ServerQuery response.
DESCRIPTION
This module holds the response data from an AssaultCube ServerQuery. Normally you will not use this class directly, but via the Games::AssaultCube::ServerQuery class.
Attributes
You can get the various data by fetching the attribute. Valid attributes are:
server
The server hostname/ip
port
The server port
WARNING: AssaultCube uses $port+1 for the query port. Please do not do pass $port+1 to the constructor, we do it internally. Maybe in the future AC will use $port+2 or another system, so let us deal with it :)
pingtime
The AssaultCube-specific pingtime counter
query
The AssaultCube-specific query number we used to PING the server
protocol
The AssaultCube server protocol version
gamemode
The numeric AssaultCube gamemode ( look at Games::AssaultCube::Utils for more info )
P.S. It's better to use the gamemode_fullname or gamemode_name accessors
gamemode_name
The gamemode name ( CTF, TDM, etc )
gamemode_fullname
The full gamemode name ( "capture the flag", "team one shot one kill", etc )
players
The number of players currently on the server
minutes_left
The number of minutes left on the server
map
The map that's running on the server
desc
The description of the server
desc_nocolor
The description of the server, with any AssaultCube-specific colors removed
max_players
The maximum number of players this server can accept
pong
The AssaultCube-specific pongflags number
P.S. It's better to use the pong_name accessor
pong_name
The AssaultCube-specific pongflag name
player_list
An arrayref of players on the server
P.S. Don't forget to enable get_players in the constructor to Games::AssaultCube::ServerQuery, it defaults to an empty arrayref.
is_full
Returns a boolean value whether the server is full or not
datagram
The actual packet we received from the server
tohash
A convenience accessor returning "vital" data in a hashref for easy usage
timestamp
The UNIX timestamp when this response object was generated
AUTHOR
Apocalypse <apocal@cpan.org>
Props goes to Getty and the BS clan for the support!
This project is sponsored by http://cubestats.net
COPYRIGHT AND LICENSE
Copyright 2009 by Apocalypse
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.