Name
Weather::Underground::Forecast - Simple API to Weather Underground Forecast Data
Synopsis
Get the weather forecast:
my $forecast = Weather::Underground::Forecast->new(
location => $location,
temperature_units => 'fahrenheit', # or 'celsius'
);
Where the $location can be:
* 'city,state' Example: location => 'Bloomington,IN'
* zip_code Example: location => 47401
* 'latitude,longitude' Example: location => '46,-113'
my ($highs, $lows) = $forecast->temperatures;
NOTE: location is the only required parameter to new()
Methods
temperatures
Get the high and low temperatures for the number of days specified.
Returns: Array of two ArrayRefs being the high and low temperatures
Example: my ($highs, $lows) = $wunder->temperaures;
highs
Get an ArrayRef[Int] of the forecasted high temperatures.
lows
Get an ArrayRef[Int] of the forecasted low temperatures.
precipitation
Get an ArrayRef[Int] of the forecasted chance of precipitation.
Example: my $chance_of_precip = $wunder->precipitation;
_get_forecast_data_by_one_key
Get the values for a single forecast metric that is only one key deep. An examples is: 'pop' (prob. of precip.)
NOTE: One can dump the data attribute to see the exact data structure and keys available.
_get_forecast_data_by_two_keys
Like the one_key method above but for values that are two keys deep in the data structure.
Limitations
It is possible that location could have more than one forecast. The behavior of that possibility has not been tested.
Authors
Mateu Hunter hunter@missoula.org
Copyright
Copyright 2010, Mateu Hunter
License
You may distribute this code under the same terms as Perl itself.