I got this from a Perl list at Builder.com, I thought it would be interesting to 
share, something folks may want to include it on their web sites:

Retrieve weather data with Geo::WeatherNOAA 

Perl's WeatherNOAA module gives you easy access to current weather information and 
short-term forecasts provided by the National Oceanographic and Atmospheric 
Administration (NOAA). 
The module exports a handful of functions to retrieve and process weather data. The 
simplest interface uses the print_forecast( ) and print_current( ) functions. These 
functions have default values for all parameters except the city and state, which 
makes them very easy to use. 
Here's a simple script that will print the forecast and current conditions for a 
selected city and state (with a default of Louisville, KY). 
use Geo::WeatherNOAA;

$city = shift || 'Louisville';
$state = shift || 'KY';

print "Reading weather data for $city, $state ... \n";

print "Forecast: " . print_forecast($city, $state);
print "\nCurrent: " . print_current($city, $state); 
If you know the city and state that you want weather information for, you can print 
the forecast right from the command line as follows: 
perl -MGeo::WeatherNOAA -e "print print_forecast('Louisville', 'KY'); 
The WeatherNOAA module makes it extremely easy to get current weather conditions and 
forecast data for display on a Web page, a mobile device, or simply for viewing at the 
console. 

Reply via email to