The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Weather::YR::Textforecast - Used to fetch text based forecast from YR

SYNOPSIS

  use Weather::YR::Textforecast;

  my $text  = Weather::YR::Textforecast->new(
    {
        'language'  => 'nb',
        'forecast'  => 'land',
    }
  );

  $text_forecast    = $text->forecast;  

  print $text_forecast->{'title'};

DESCRIPTION

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/textforecast/1.2/?forecast=land;language=nb

CONFIGURATION

url

The URL to the web service for getting the textforecasts. Defaults to version 2 of the API: http://api.yr.no/weatherapi/textforecast/1.2/.

forecast

The type of forecast to get. Defaults to land.

language

The language of the forecast. Defaults to norwegian bokmål, nb.

METHODS

forecast

Retrieves the forecast in a data structure representing the XML document.

parse_forecast_land

This method parses the response from YR and returns a structure of objects.

parse_forecast_time(\%time)

This method parses the time period of the forecast and the forecasts.

It returns a HASHREF of to, from and forecasts.

parse_forecast(\%forecast)

This method parses a forecast with many locations and areas.

The class of an area does not exist yet, but we just needed a name for the collection (Weather::YR::Textforecast::Area).

It returns an instance of Weather::YR::Textforecast::Forecast.

parse_forecast_locations(\%forecast)

This method parses a list of forecast locations. The forecasts are expected to be found in the HASH key of location.

It returns a list of Weather::YR::Textforecast::Location (unfortunately this class does not exist, but we just needed a name on it).

parse_forecast_product

This method parses and creates a product object to store the description about the product.

get_url

Assembles the complete URL for the textforecast service with the forecast type and language.

SEE ALSO

Weather::YR, Weather::YR::Base

AUTHOR

Knut-Olav, <knut-olav@hoven.ws>

COPYRIGHT AND LICENSE

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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 54:

Non-ASCII character seen before =encoding in 'bokmål,'. Assuming UTF-8