#!/usr/bin/perl
############################################################
# title title_name
# Christopher Boumenot <boumenot@gmail.com>, 2006
############################################################

use strict;
use warnings;

use Net::Amazon;
use Net::Amazon::Request::Title;

#use Log::Log4perl qw(:easy);
#Log::Log4perl->easy_init($DEBUG);

die "usage: $0 title\n(use Dates as an example)\n" unless defined $ARGV[0];

my $ua = Net::Amazon->new(
    token       => $ENV{AMAZON_TOKEN},
);

my $req = Net::Amazon::Request::Title->new(
    title  => $ARGV[0],
);

# Response is of type Net::Amazon::Title::Response
my $resp = $ua->request($req);

if($resp->is_success()) {
    print $resp->as_string, "\n";
} else {
    print $resp->message, "\n";
}
