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?


In reply to How to pull author, title using ISBN (WWW::Scraper::ISBN)? by Perl300

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.