#!/usr/bin/perl -w
use strict;
use warnings;
use Net::Amazon;

# Grab a list of all the DVDs listed in the given wishlist
# and display the title. Net::Amazon::Property and 
# Net::Amazon::Property::DVD contain other useful methods
# Version: 0.1 (20050728) 
# License: GPL
# Author: Dean Wilson 

my $ua = Net::Amazon->new(
                          token => 'AMAZON_TOKEN_HERE',
                          locale => 'uk',
);

# Get a request object. This is my testing wishlist
my $response = $ua->search(wishlist => "1CEE4OB54LX8T");

unless($response->is_success()) {
  die "Failed to get the DVDs from Wishlist!\n",
      "Error: ", $response->message(), "\n";
  exit 2;
}

for my $item ($response->properties()) {
  # we only care about DVDs. This should be enough
  next unless lc($item->Media) eq 'dvd';

  print "Title: ", $item->title, "\n";
}
