Weather::YR::Locationforecast - Used to fetch forecast from a geo position from YR
use Weather::YR::Locationforecast my $loc = Weather::YR::Locationforecast->new( { 'latitude' => '59.6327', 'longitude' => '10.2468', } ); my $loc_forecast = $loc->forecast; print $loc_forecast->[0]->{'temperature'}->{'value'} . " degrees celcius";
This module returns textforecasts from YR according to specified parameters.
This module uses the data from URLs such as these: http://api.yr.no/weatherapi/locationforecast/1.5/?lat=60.10;lon=9.58
This modules implements a full forecast for one location, that is, a forecast with five parameters for a seven-day period.
The five parameters are temperature, wind speed, wind direction, pressure and precipitation.
For the first 48 hours, the datapoints are spaces one hour apart, and for the remaining five 24-hour periods, they are spaces three hours apart.
The URL to the web service for getting the textforecasts. Defaults to version 1.5 of the API: http://api.yr.no/weatherapi/locationforecast/1.5/.
The latitude of the location. No default, must be applied in constructor.
The longitude of the location. No default, must be applied in constructor.
\%args
Constructor that validates the incoming parameters. We request these parameters to be set: latitude longitude
Retrieves the forecast in a data structure representing the XML document.
$xml
This method parses the response from YR and returns a structure of objects.
$time_ref
This method parses each time element in the forecast XML document.
$location
This method parses full/complete forecasts which contains different types of data.
This method parses forecasts that contains symbol data.
This method parses forecasts that contains precipitation data.
Assembles the complete URL for the textforecast service with the forecast type and language.
Weather::YR, Weather::YR::Base
Knut-Olav, <knut-olav@hoven.ws>
Copyright (C) 2008 by Knut-Olav Hoven
This library is free software; you can redireibute it and/or modify it under the terms as GNU GPL version 2.
To install Weather::YR, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Weather::YR
CPAN shell
perl -MCPAN -e shell install Weather::YR
For more information on module installation, please visit the detailed CPAN module installation guide.