Games::AssaultCube::ServerQuery::Response - Holds the various data from a ServerQuery response
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"; }
This module holds the various data from a ServerQuery response.
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.
You can get the various data by fetching the attribute. Valid attributes are:
The server hostname/ip
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 :)
The AssaultCube-specific pingtime counter
The AssaultCube-specific query number we used to PING the server
The AssaultCube server protocol version
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
The gamemode name ( CTF, TDM, etc )
The full gamemode name ( "capture the flag", "team one shot one kill", etc )
The number of players currently on the server
The number of minutes left on the server
The map that's running on the server
The description of the server
The description of the server, with any AssaultCube-specific colors removed
The maximum number of players this server can accept
The AssaultCube-specific pongflags number
P.S. It's better to use the pong_name accessor
The AssaultCube-specific pongflag name
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.
Returns a boolean value whether the server is full or not
The actual packet we received from the server
A convenience accessor returning "vital" data in a hashref for easy usage
The UNIX timestamp when this response object was generated
Apocalypse <apocal@cpan.org>
Props goes to Getty and the BS clan for the support!
This project is sponsored by http://cubestats.net
Copyright 2009 by Apocalypse
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Games::AssaultCube, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::AssaultCube
CPAN shell
perl -MCPAN -e shell install Games::AssaultCube
For more information on module installation, please visit the detailed CPAN module installation guide.