#! perl -slw
use strict;
use LWP::Simple;
use XML::Simple;
use Data::Dump qw[ pp ];
use constant ACCESS_ID => 'XXXXXXXX'; ## Your access key here.
my $isbn = $ARGV[ 0 ] or die 'Need an ISBN number';
die "'$isbn' doesn't look like a valid ISBN"
unless $isbn =~ m[^\d{10}$];
my $uri = sprintf
"http://isbndb.com/api/books.xml?access_key=%s&index1=isbn&value1=%s",
ACCESS_ID, $isbn;
my $xml = get $uri or die "Request failed";
my $info = XMLin $xml;
pp $info;
####
C:\test>isbndb 0131101633
{
BookList => {
BookData => {
AuthorsText => "Brian W. Kernighan, Dennis M. Ritchie",
PublisherText => {
content => "Englewood Cliffs, N.J. : Prentice-Hall, c1978.",
publisher_id => "prentice_hall_a01",
},
Title => "The C programming language",
TitleLong => {},
book_id => "the_c_programming_language",
isbn => "0131101633",
},
page_number => 1,
page_size => 10,
shown_results => 1,
total_results => 1,
},
server_time => "2008-04-22T03:13:35Z",
}
####
use ISBNDB::Simple ACCESSID => 'XXXXXXXX';
my $isbn = ...;
my $href = Book( $isbn );