The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Weather::OpenWeatherMap::Request - Weather lookup request superclass

SYNOPSIS

 # Normally generated via Weather::OpenWeatherMap
 # (when a request is made)

DESCRIPTION

This is the parent class for request objects generated by Weather::OpenWeatherMap.

See also:

Weather::OpenWeatherMap::Request::Current

Weather::OpenWeatherMap::Request::Forecast

ATTRIBUTES

api_key

The OpenWeatherMap API key attached to this request.

location

Required:

The location string, used to (lazily) generate the "http_request" and "url" attributes.

Locations can be specified in various ways.

Strings such as 'City, State' or 'City, Country' will be parsed appropriately.

A numeric location is taken to be an OpenWeatherMap city code.

A string in the form of 'lat X, long Y' or 'latitude X, longitude Y' is also accepted.

tag

An (optional) arbitrary scalar attached to the request object at construction time.

http_request

The (generated) HTTP::Request object used to request the weather data.

ts

The time() the request object was created.

url

The (generated) OpenWeatherMap URL.

METHODS

new_for

Factory method; returns a new object belonging to the appropriate subclass:

  my $request = Weather::OpenWeatherMap::Request->new_for(
    Current =>
      api_key  => $api_key,
      location => $location,
      tag      => $tag,
  );

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>