NAME

Weather::OpenWeatherMap::Result::Forecast - Weather forecast result

SYNOPSIS

# Normally retrieved via Weather::OpenWeatherMap

DESCRIPTION

This is a subclass of Weather::OpenWeatherMap::Result containing the result of a completed Weather::OpenWeatherMap::Request::Forecast.

These are normally emitted by a Weather::OpenWeatherMap instance.

ATTRIBUTES

hourly

Boolean true if this is an hourly weather report.

count

The number of forecast days returned by the OpenWeatherMap API.

See "list" and "iter".

country

The country string.

id

The OpenWeatherMap city code.

latitude

The station's latitude.

longitude

The station's longitude.

name

The city name.

METHODS

as_array

The full forecast list, as a List::Objects::WithUtils::Array.

See "list".

list

The full forecast list; each item in the list is either a Weather::OpenWeatherMap::Result::Forecast::Day (by default) or a Weather::OpenWeatherMap::Result::Forecast::Hour (if "hourly" is true) instance:

for my $day ($result->list) {
  my $date = $day->dt->mdy;
  my $cloudiness = $day->cloud_coverage;
  # ...
}

See the documentation for Weather::OpenWeatherMap::Result::Forecast::Day & Weather::OpenWeatherMap::Result::Forecast::Hour.

iter

Returns an iterator that, when called, returns the next Weather::OpenWeatherMap::Result::Forecast::Day or Weather::OpenWeatherMap::Result::Forecast::Hour instance (or undef when the list is empty):

my $iter = $result->iter;
while (my $day = $iter->()) {
  my $wind = $day->wind_speed_mph;
  # ...
}

The number of items to return at a time can be provided (as of v0.4.x):

my $iter = $result->iter(3);

See also: "list"

SEE ALSO

Weather::OpenWeatherMap::Result

Weather::OpenWeatherMap::Result::Forecast::Block

Weather::OpenWeatherMap::Result::Forecast::Day

Weather::OpenWeatherMap::Result::Forecast::Hour

Weather::OpenWeatherMap::Result::Current

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>