Busy making things: github, links, photos, @mc.

Geo::Weather

Posted: January 17th, 2003 | Author: | Filed under: Perl | Comments Off

Geo::Weather is a cool little perl module that scrapes weather.com and produces your local weather in html.  I installed it on my box at home (perl -MCPAN -e shell as root and then install Geo::Weather) and have been playing with it for a few minutes.  Here are a few lines of code adapted from the man page:

use Geo::Weather;

my $weather = new Geo::Weather;
$weather->get_weather('Kensington','MD');
print $weather->report();

That’s really all it took.  Here’s the output from that (as viewed in Lynx):

Kensington, MD

[29.gif] Partly Cloudy
Temperature: 28° F/-2° C (Feels Like: 18° F/-8° C)
Wind: From the Northwest at 12 mph
Dew Point: 14° F/-10° C
Rel. Humidity: 48 %
Visibility: Unlimited
Barometer: 30.03 inches and rising
UV Index: 0 Minimal

Pretty darn cool.  Of course you can access specific bits of weather information if you want.  Of course if you want to get down and dirty, you can use Geo::METAR, which was written by our very own Jeremy Zawodny.  It’s a damn small world.


Comments are closed.