weather script

David J Patrick davidjpatrick-rieW9WUcm8FFJ04o6PK0Fg at public.gmane.org
Thu Sep 16 23:05:26 UTC 2004


On Thu, 2004-09-16 at 19:26, John Macdonald wrote:
> On Thu, Sep 16, 2004 at 06:31:04PM -0400, David J Patrick wrote:
> > On Thu, 2004-09-16 at 14:52, Lennart Sorensen wrote:
> > > Here is one from 'man Weather::Underground'
> > > 
> > > use Weather::Underground;
> > 
> > so I cut from here ->
> 
> You started cutting one line too late, you need to include
> the use Weather::Underground; line above too.
> 
> By not including the use line, you don't have the function
> defined.

Ahh ! Thanks !
but now it says;
[djp at sympatico djp]$ ~/bin/weather.pl
/home/djp/bin/weather.pl: line 1: use: command not found
/home/djp/bin/weather.pl: line 2: syntax error near unexpected token `('
/home/djp/bin/weather.pl: line 2: `$weather =
Weather::Underground->new('
===
to clarify, the script is
===
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";
     }
 }

right ?
djp


--
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