Thank you for pointing that out hippo and NetWallah. I did make use of the synopsis and it gives new error now.
Code:
#!~/perl5/perlbrew/perls/perl-5.28.1/bin/perl
use Modern::Perl;
use WWW::Scraper::ISBN;
my $scraper = WWW::Scraper::ISBN->new();
$scraper->drivers("LOC", "ISBNnu");
my $isbn = "9780134511184";
my $record = $scraper->search($isbn);
if($record->found)
{
print "Book ".$record->isbn." found by driver ".$record->found_in.
+"\n";
my $book = $record->book;
print $book->{'title'};
print $book->{'author'};
}
else
{
print $record->error;
}
Error:
Cannot start LOC query session.
isbn.nu website appears to be unavailable.
I checked and found that https://www.isbn.nu is working and I can search same ISBN there without any issue. I found the error is coming from ~/perlbrew/perls/perl-5.28.1/lib/site_perl/5.28.1/WWW/Scraper/ISBN/ISBNnu_Driver.pm So I am checking that code to see if I can change something there to make it working.
Here is the code that's generating this error:
sub search {
my ($self,$isbn) = @_;
my %data;
$self->found(0);
$self->book(undef);
my $post_url = "https://isbn.nu/".$isbn;
my $mech = WWW::Mechanize->new();
$mech->agent_alias( 'Linux Mozilla' );
$mech->add_header( 'Accept-Encoding' => undef );
eval { $mech->get( $post_url ) };
return $self->handler("isbn.nu website appears to be unavailable."
+)
if($@ || !$mech->success() || !$mech->content());
Seems one of the three conditions in if are returning true and so the error. I am testing by inserting some prints. Will share here what I find.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.