WWW::GameMonitor - Fetch information about game servers from Game-Monitor.com
# example 1 use WWW::GameMonitor; my $gm1 = WWW::GameMonitor->new; my $serv1 = $gm1->getServerInfo( Host => '216.237.126.132', Port => '16567' ); # ACE Battlefield2 Server print qq(On $serv1->{name}, $serv1->{count}->{current} players ($serv1->{count}->{max} limit) are playing $serv1->{game}->{longname}, map $serv1->{map}.\n); # example 2 use WWW::GameMonitor; my $gm2 = WWW::GameMonitor->new( Host => '216.237.126.132', Port => '16567' ); # default to a certain server my $serv2 = $gm2->getServerInfo; # uses the defaults specified in the constructor
This module will help you get information about various official and clan game servers (Battlefield 2, Quake 4, and many more). The server that is being queried must be listed as a "premium" server. This means someone (you, the server owner, or someone else) must have an active subscription with Game-Monitor.com for that server to be accessible in this way. You, yourself, do not have to have an account with them, but someone out there on the Internet must have listed that specific server in their paid account. For example, at the time of writing, the ACE Battlefield 2 server <http://www.armchairextremist.com/> is listed under such an account. This means that you could, without needing to contact or pay anyone, use this module to ask for information about the ACE Battlefield 2 server. If you run your own clan game server or you want to monitor someone else's game server (and Game-Monitor.com supports your game), it might be worth it to you to pay them the ~USD$3-7/month for this ability. They take PayPal.
my $gm = WWW::GameMonitor->new; # no options or defaults specified my $gm = WWW::GameMonitor->new( Host => '216.237.126.132', Port => '16567' ); # default to a certain server
You can specify several options in the constructor.
my $gm = WWW::GameMonitor->new( Expires => 300, Host => '216.237.126.132', Port => '16567', CacheFile => 'my_gm_cache.xml', DebugLog => 'my_debug_log.txt', DebugLevel => 3, UID => 12345, List => 0, );
Sets the data cache freshness in seconds. If the cache has data older than this number of seconds, it is no longer valid. It's best that you set this value to something higher than 1 minute and would be even better if you were satisfied with setting it around 5 minutes. If the cache is fresh enough, it won't even ask the Game-Monitor.com server for any information. Keep in mind that Game-Monitor doesn't update their information more than once every several minutes. It won't be useful for you to set the Expires value too low.
Sets the default host to ask about. If you don't specify a host when asking for data, it will use this value instead.
Sets the default port to ask about. If you don't specify a port when asking for data, it will use this value instead.
Sets the path and filename for the data cache. This is "gameServerInfoCache.xml" by default.
Sets the path and filename for the debug log. This is "gmDebug.log" by default. To enable logging, you'll have to choose a DebugLevel greater than zero (zero is default).
Sets the level of debugging. The larger the number, the more verbose the logging. This is zero by default, which means no logging at all.
Sets the default UID used for fetching buddy lists.
Sets the default buddy list used for fetching buddy lists.
my $serv = $gm->getServerInfo; # uses the defaults specified in the constructor print qq(On $serv1->{name}, $serv1->{count}->{current} players ($serv1->{count}->{max} limit) are playing $serv1->{game}->{longname}, map $serv1->{map}.\n); my $serv = $gm->getServerInfo( Host => '216.237.126.132', Port => '16567' ); # ask about a certain server print qq(On $serv1->{name}, $serv1->{count}->{current} players ($serv1->{count}->{max} limit) are playing $serv1->{game}->{longname}, map $serv1->{map}.\n);
Asks about the specified host. If this was specified in the constructor, this value is optional.
Asks about the specified port. If this was specified in the constructor, this value is optional.
$list = $gm->getBuddyList; # uses defaults set in the constructor $list = $gm->getBuddyList( List => 1 ); # sets a different list than the default $list = $gm->getBuddyList( UID => 12345, List => 2 ); # also sets a different UID along with a different list
Sets the UID used for fetching buddy lists. If this was specified in the constructor, this value is optional.
Sets the buddy list used for fetching buddy lists. If this was specified in the constructor, this value is optional.
Dusty Wilson, <www-gamemonitor-module@dusty.hey.nu>
Copyright (C) 2006 by Dusty Wilson <http://dusty.hey.nu/>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
4 POD Errors
The following errors were encountered while parsing the POD:
=cut found outside a pod block. Skipping to next block.
To install WWW::GameMonitor, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::GameMonitor
CPAN shell
perl -MCPAN -e shell install WWW::GameMonitor
For more information on module installation, please visit the detailed CPAN module installation guide.