NAME

Weather::OpenWeatherMap::Result::Find - Location search 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::Find.

These are normally returned by a Weather::OpenWeatherMap instance (or emitted by POEx::Weather::OpenWeatherMap.

ATTRIBUTES

message

The message from the OpenWeatherMap backend indicating the type of search completed (accurate or like).

METHODS

as_array

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

See "list".

count

Returns the number of items available in the current result "list".

list

The full result list; each item in the list is a Weather::OpenWeatherMap::Result::Current instance:

for my $place ($result->list) {
  my $region = $place->country;
  my $tempf  = $place->temp_f;
  # ...
}

See Weather::OpenWeatherMap::Result::Current.

The current weather returned by a Find is not quite as complete as that returned by an actual Weather::OpenWeatherMap::Request::Current. In particular:

  • The country attribute is likely to be a two-letter region identifier, not a full country name.

  • The sunrise and sunset attributes are unavailable.

  • Wind gust speed may be unavailable.

  • The station name is unavailable.

iter

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

my $iter = $result->iter;
while (my $place = $iter->()) {
  my $region = $place->country;
  # ...
}

The number of items to return at a time can be specified:

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

search_type

An alias for "message".

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>