weather script
John Macdonald
john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org
Fri Sep 17 00:59:40 UTC 2004
On Thu, Sep 16, 2004 at 07:05:26PM -0400, David J Patrick wrote:
> 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('
> ===
You have to let the system know that the script must be
run by perl. Either use the command:
perl ~/bin/weather.pl
or prepend a new line 1 that looks like
#!perl
(instead of #!perl you might prefer to put the full pathname
where perl is installed, perhaps that will make the line look
like:
#!/usr/bin/perl
> 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
--
--
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