John Lifsey > WWW-Wunderground-API-0.04 > WWW::Wunderground::API

Download:
WWW-Wunderground-API-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.04   Source  

NAME ^

WWW::Wunderground::API - Use Weather Underground's XML or JSON interface

VERSION ^

Version 0.04

SYNOPSIS ^

Connects to the Weather Underground JSON/XML service and parses the data into something usable. The entire response is available in Hash::AsObject form, so any data that comes from the server is accessible. Print a Data::Dumper of ->data to see all of the tasty data bits.

    use WWW::Wunderground::API;

    #location
    my $wun = new WWW::Wunderground::API('Fairfax, VA');

    #or zipcode
    my $wun = new WWW::Wunderground::API('22030');

    #or airport identifier
    my $wun = new WWW::Wunderground::API('KIAD');

    #using the json API.
    my $wun = new WWW::Wunderground::API(location=>'KIAD', api_key=>'your wunderground API key');

    print 'The temperature is: '.$wun->data->temp_f."\n";
    print 'The rest of the world calls that: '.$wun->temp_c."\n"; #Keys are AUTOLOADed to $wun->data->$key for lazy typers.
    print 'XML source:'.$wun->xml if $wun->api_type eq 'xml';
    print 'JSON source:'.$wun->json if $wun->api_type eq 'json';

update()

Refetch data from the server. This is called automatically every time location is set, but you may want to put it in a timer.

location()

Change the location. For example:

    my $wun = new WWW::Wunderground::API('22030');
    my $ffx_temp = $wun->data->temp_f;

    $wun->location('KJFK');
    my $ny_temp = $wun->data->temp_f;

    $wun->location('San Diego, CA');
    my $socal_temp = $wun->data->temp_f;

xml()

Returns raw xml result from wunderground server where applicable

json()

Returns raw json result from wunderground server where applicable

data()

Contains all weather data from server parsed into convenient Hash::AsObject form;

api_key()

Required for JSON api access.

api_type()

Defaults to xml. If an api_key is specified, this will be set to json.

AUTHOR ^

John Lifsey, <nebulous at crashed.net>

BUGS ^

Please report any bugs or feature requests to bug-www-wunderground-api at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Wunderground-API. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc WWW::Wunderground::API

You can also look for information at:

LICENSE AND COPYRIGHT ^

Copyright 2011 John Lifsey.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: