Games::Lacuna::Task::Role::Stars - Astronomy helper methods
package Games::Lacuna::Task::Action::MyTask; use Moose; extends qw(Games::Lacuna::Task::Action); with qw(Games::Lacuna::Task::Role::Stars);
This role provides astronomy-related helper methods.
$star_data = $self->get_star($star_id);
Fetches star data from the API or local cache for the given star id
$star_data = $self->get_star_by_name($star_name);
Fetches star data from the API or local cache for the given star name
$star_data = $self->get_star_by_name($x,$y);
Fetches star data from the API or local cache for the given star coordinates
$self->fetch_all_stars();
Populates the star cache. Usually takes several minutes to complete and thus should not be called regularly.
$body_data = $self->get_body_by_id($body_id);
Fetches body data from the local cache for the given body id
$body_data = $self->get_body_by_name($body_name);
Fetches body data from the local cache for the given body name Ignores case and accents so that eg. 'Hà Nôi' equals 'HA NOI'.
$body_data = $self->get_body_by_name($x,$y);
Fetches body data from the local cache for the given body coordinates
$self->set_body_excavated($body_id,$is_excavated);
Mark body as excavated
$self->set_star_cache($api_star_data);
Create star cache for given api response data
$self->search_stars_callback( sub { my $star_data = shift; ... }, %search_params );
Searches all stars acording to the given search parameters and executes the callback for every matching star.
Valid search options are
is_probed (0 = unprobed, 1 = probed)
is_known (0 = body data not available, 1 = body data available)
max_distance
min_distance
distance (1 = ascending, 0 = descending)
zone
x,y (refernce coordinates for distance calculations)
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.