weather script

John Macdonald john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org
Thu Sep 16 23:26:31 UTC 2004


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.

> > 
> > $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";
> >     }
> > }
> > 
> <- to here. save as "weather.whatever.pl", give execute permissions and
> run ?
> the result ?
> [djp at sympatico djp]$ ~/bin/weather.pl
> /home/djp/bin/weather.pl: line 1: syntax error near unexpected token `('
> /home/djp/bin/weather.pl: line 1: `$weather =
> Weather::Underground->new('

By not including the use line, you don't have the function
defined.

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