weather script

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Thu Sep 16 18:52:27 UTC 2004


On Thu, Sep 16, 2004 at 02:31:05PM -0400, David J Patrick wrote:
> That's the idea. Can you dig up an example ? I'm not exactly a
> proficient perl mongerer.
> thanks, you are truly a trouble shootin' champion, Lennart !
> One of these TLUG meetings, we should carry you around on our shoulders,
> for a bit !

I would have to make it to one first. :)  I have only been to one
NewTLUG meeting, and no TLUG meetings.  Something about heading
downtown and such.

Here is one from 'man Weather::Underground'

use Weather::Underground;

$weather = Weather::Underground->new(
    place => "Toronto, Ontario",
    debug => 0,
    )
    || die "Error, could not create new weather object: $@\n"
;

$arrayref = $weather->get_weather()
    || die "Error, calling get_weather() failed: $@\n";

foreach (@$arrayref) {
    print "MATCH:\n";
    while (($key, $value) = each %{$_}) {
        print "\t$key = $value\n";
    }
}

The less specific the place name, the more matches you get.  So a search
for just Toronto gets you Toronto Ontario, Toronto South Dakota, etc.
Pretty neat that way really.  If you give it something that it can't
match, well then you get a blank result (no errors).

Maybe this is a start at least.

Lennart Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list