WebService::ForecastIO - Perl client for api.forecast.io
version 0.02
use 5.014; my $forecast = WebService::ForecastIO->new( api_key => 'secret', units => 'si', # metric units exclude => 'hourly,minutely,currently,flags', # get 7 day forecast only ); # latitude longitude my $json = $forecast->request(29.7492738082192, -95.4709680410959); # Human readable summary of daily data say $json->{daily}->{summary};
This is a Perl client for forecast.io API. Forecast.io applies "big data" analysis techniques to publicly available weather data including radar image analysis. One of the things it attempts to predict is when certain weather events like rain will start, and the duration of those events.
This library requires an API key which can be obtained for free from the developer web site. The first 1,000 calls per day are allowed without charge. (More calls can be made if payment arrangements are made.)
See the API docs for full details about what data is provided and what granularity data sets are offered.
NOTE: Errors are fatal. Please use something like Try::Tiny if you want to handle errors some other way.
This attribute overrides the default units of us. Available units are:
us
si
Metric units (windspeed in meters/second)
ca
Metric units, except windspeed in km/h
uk
Metric units, except windspeed in mi/h
auto
Unit selection based on request IP geolocation
A comma delimited list of data sets to exclude. Choices are:
minutely, currently, hourly, daily, alerts, flags
minutely
currently
hourly
daily
alerts
flags
See the API docs for information about what these data blocks represent.
Spaces should be omitted between exclusions.
Holds the API key for the forecast.io service.
This method takes two or three parameters.
The first two parameters are latitude and longitude expressed as floats. The optional third parameter is a time value. The time value can be expressed as either epoch seconds or as an iso8601 format time.
latitude
longitude
time
Data sets up to 60 years old are available. (Such times should be expressed as iso8601 format times since epoch seconds start at midnight, January 1, 1970.)
A convenience method that takes epoch seconds and returns a new Time::Piece object. You can stringify this object to iso8601 format by calling the datetime() method on it.
datetime()
A convenience method that takes an iso8601 formatted string and returns a new Time::Piece object. This object can output epoch seconds by calling the epoch() method on it.
epoch()
WebService::ForecastIO::Request
API docs
Mark Allen <mrallen1@yahoo.com>
This software is copyright (c) 2013 by Mark Allen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WebService::ForecastIO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::ForecastIO
CPAN shell
perl -MCPAN -e shell install WebService::ForecastIO
For more information on module installation, please visit the detailed CPAN module installation guide.