I would like to use module WWWW::Wunderground::API to download data with weather using JSON.
Here is my PERL script:
use WWW::Wunderground::API;
my $wun = new WWW::Wunderground::API(location=>'KIAD', api_key=>'my key');
print 'JSON source:'.$wun->json if $wun->api_type eq 'json';
It gives me an error:
Can’t bless non-reference value at
/usr/local/share/perl5/Hash/AsObject.pm line 82.
I cannot fix it up. I have been trying to update cpan and other modules but it gives no results.
Could you tell me how can I repair it?
Thank you in advance
with Carp::Always:
Can’t bless non-reference value at
/usr/local/share/perl5/Hash/AsObject.pm line 82
Hash::AsObject::AUTOLOAD(‘Hash::AsObject’, undef) called at
/usr/local/share/perl5/WWW/Wunderground/API.pm line 37
WWW::Wunderground::API::update(‘WWW::Wunderground::API=HASH(0x1e5b178)’,
‘KIAD’) called at /home/xyz/workspace/WeatherTest/scr.pl line 4
eval {…} called at /home/xyz/workspace/WeatherTest/scr.pl line
4
It comes from a lack of error checking. The following unexpectedly returns
undef:You might want to have a look at what’s getting fetched by using the following:
Perhaps there’s an error message in the response you can address. For example, a bad API key would result in the following response: