weather script

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Fri Sep 17 01:10:36 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:
> > On Thu, Sep 16, 2004 at 02:31:05PM -0400, David J Patrick wrote:
> > > 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. :)
> See! You'e missing more than lively penguin chatter !
> >   Something about heading
> > downtown and such.
> You GOTTA get out more !
> > 
> > Here is one from 'man Weather::Underground'
> > 

This line is rather important to perl ---v
> > use Weather::Underground;
> 
> so I cut from here ->
> > 
> > $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('
> 
> hmm ?
> I must learn some perl basics (if you'll pardon the mixed reference)
> before 
> 
> > 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.
> 
> I'll keep trying stuff, 
> this is a non-interactive script, right ?

Sticking a #!/usr/bin/perl as the first line would help too actually. :)

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