DarkSky::API - Provides Perl API to DarkSky
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);
This module is a wrapper around the DarkSky API.
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 (c) 2017 "Martin-Louis Bright"
This library is free software and may be distributed under the same terms as perl itself. See http://dev.perl.org/licenses/.
To install DarkSky::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DarkSky::API
CPAN shell
perl -MCPAN -e shell install DarkSky::API
For more information on module installation, please visit the detailed CPAN module installation guide.