Subject: | TVDB API Constructor Bug in .33 |
Date: | Sat, 5 Jun 2010 18:43:34 -0700 |
To: | bug-TVDB-API [...] rt.cpan.org |
From: | Daniel Osborne <daniel [...] osborne.net.in> |
Hi, I'd like to report a bug in the api module.
When following the example listed at:
http://search.cpan.org/~behanw/TVDB-API-0.33/lib/TVDB/API.pm
I constructed the following code:
use warnings;
use strict;
use TVDB::API;
my $tvdb_api = TVDB::API::new( { apikey => '...key here...', lang => 'en'}
);
During runtime I get the following error:
Can't use an undefined value as an ARRAY reference at
/usr/lib64/perl5/site_perl/5.10.1/TVDB/API.pm line 84.
I noticed it's trying to dereference an array for the list of mirrors
provided, but that reference is undef (because I didn't supply a list if
mirrors in the constructor).
The line:
if (@{$args->{mirrors}}) {
Should be changed to:
if (exists $args->{mirrors} && @{$args->{mirrors}}) {
I'm using Gentoo, with Perl 5.10.1
I also noticed that the documentation says that apikey is optional, however
leaving it off causes the script to 'die':
You need to get an apikey from http://thetvdb.com/?tab=apiregister at
/usr/lib64/perl5/site_perl/5.10.1/TVDB/API.pm line 71.
So it seems confusing as to which is correct.
Thank you for your time!
Daniel