Games::Lacuna::Task::Client - Client class
Implements basic caching and the connection to the lacuna API.
Games::Lacuna::Client object
Games::Lacuna::Task config directory
Access to the caching database via Games::Lacuna::Storage
Current config hash as read from the config file in configdir
Simple Stash for storing various temporary values.
my $config = $client->task_config($task_name);
Calculates the config for a given task
Returns the current empire name
my $value = $self->get_cache('key1');
Fetches a value from the cache. Returns undef if cache is not available or if it has expired.
$self->clear_cache('key1');
Remove an entry from the cache.
$self->set_cache( max_age => $valid_seconds, # optional valid_until => $timestamp, # optional, either max_age or valid_until key => 'key1', # required value => $some_data # required );
Stores an arbitrary data structure (no objects) in a persistent cache
Runs a request, caches the response and returns the response.
my $response = $self->request( object => Games::Lacuna::Client::* object, method => Method name, params => [ Params ], );
Fetches all response elements from a paged method
my $response = $self->paged_request( object => Games::Lacuna::Client::* object, method => Method name, params => [ Params ], total => 'field storing the total number of items', data => 'field storing the items', );
my $glc_object = $self->build_object('/university', id => $building_id); OR my $glc_object = $self->build_object($building_status_response); OR my $glc_object = $self->build_object('Spaceport', id => $building_id); OR my $glc_object = $self->build_object('Map');
Builds an <Games::Lacuna::Client::*> object
$self->storage_do('UPDATE .... WHERE id = ?',$id);
Runs a command in the cache database
my $sth = $self->storage_prepare('SELECT .... WHERE id = ?');
Prepares a SQL-query for the cache database and retuns the statement handle.
To install Games::Lacuna::Task, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Lacuna::Task
CPAN shell
perl -MCPAN -e shell install Games::Lacuna::Task
For more information on module installation, please visit the detailed CPAN module installation guide.