NAME

DarkSky::API - Provides Perl API to DarkSky

SYNOPSIS

use DarkSky::API;
use JSON::XS;
use feature 'say';

my $lat  = 43.6667;
my $long = -79.4167;
my $time = "1475363709"; # example epoch time (optional)
my $key = "c9ce1c59d139c3dc62961cbd63097d13"; # example DarkSky API key

my $forecast = DarkSky::API->new(
    key       => $key,
    longitude => $long,
    latitude  => $lat,
    time      => $time
);

say "current temperature: " . $forecast->{currently}->{temperature};

my $json = JSON::XS->new->canonical->pretty;

# Allow blessed objects to be serialized
# See http://search.cpan.org/~mlehmann/JSON-XS-3.02/XS.pm#OBJECT_SERIALISATION
$json->convert_blessed([1]);

say $json->encode($forecast);

DESCRIPTION

This module is a wrapper around the DarkSky API.

REFERENCES

Git repository: https://github.com/mlbright/DarkSky-API

DarkSky API docs: https://darksky.net/dev/

Another Perl API to DarkSky: http://search.cpan.org/~mallen/WebService-ForecastIO-0.01

COPYRIGHT

Copyright (c) 2017 "Martin-Louis Bright"

LICENSE

This library is free software and may be distributed under the same terms as perl itself. See http://dev.perl.org/licenses/.