Perl300 has asked for the wisdom of the Perl Monks concerning the following question:
I was trying to use WWW::Scraper::ISBN to pull details like author and title of a book using it's ISBN.
The code example from modules documentation is throwing error on perl 5.28.1
#!~/perl5/perlbrew/perls/perl-5.28.1/bin/perl use Modern::Perl '2019'; use WWW::Scraper::ISBN; # instantiate the object my $scraper = WWW::Scraper::ISBN->new(); # load the drivers. requires that # WWW::Scraper::ISBN::LOC_Driver and # WWW::Scraper::ISBN::ISBNnu_Driver # be installed $scraper->drivers("LOC", "ISBNnu"); my @isbns = [ "9780134511184" ]; foreach my $num (@isbns) { $scraper->isbn($num); $scraper->search($scraper->isbn); if ($scraper->found) { my $b = $scraper->book; print "Title: ".$b->{'title'}."\n"; print "Author: ".$b->{'author'}."\n\n"; } else { print "Book: ".$scraper->isbn." not found.\n\n"; } }
The above code gives error:
Can't locate object method "isbn" via package "WWW::Scraper::ISBN" at isbn_lookup.pl line 18.I though this might be because "isbn" method was not present in "WWW::Scraper::ISBN" module (perl module documentation on Meta CPAN). I found that method in Business::ISBN module.
Also there was mention of "Business::ISBN" module in "WWW::Scraper::ISBN" module's documentation. So I added
use Business::ISBN and changed $scraper->isbn($num); to $scraper->Business::ISBN::isbn($num);But it still throws same error.
What am I missing here? Is there any other/better way to get book details like Title/Author using ISBN?
|
|---|