WWW::Wunderground::API - Use Weather Underground's XML or JSON interface
Version 0.04
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';
Refetch data from the server. This is called automatically every time location is set, but you may want to put it in a timer.
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;
Returns raw xml result from wunderground server where applicable
Returns raw json result from wunderground server where applicable
Contains all weather data from server parsed into convenient Hash::AsObject form;
Required for JSON api access.
Defaults to xml. If an api_key is specified, this will be set to json.
John Lifsey, <nebulous at crashed.net>
<nebulous at crashed.net>
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.
bug-www-wunderground-api at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::Wunderground::API
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Wunderground-API
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-Wunderground-API
CPAN Ratings
http://cpanratings.perl.org/d/WWW-Wunderground-API
Search CPAN
http://search.cpan.org/dist/WWW-Wunderground-API/
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.
To install WWW::Wunderground::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Wunderground::API
CPAN shell
perl -MCPAN -e shell install WWW::Wunderground::API
For more information on module installation, please visit the detailed CPAN module installation guide.