in reply to Amazon API wrappers

I'm not sure if the age of the module might be a problem?

Amazon versions its APIs, so that changes to the API are only effective if you specify a new API version in the request.

So new features in the API will not be available, but neither will anything break until amazon decides to deprecate the API version supported by Net::Amazon.

. But I'm getting the price back with a currency symbol that should have been a £ (I use the 'UK' locale for the Net::Amazon request) - instead I'm getting something like "�5.99". What am I doing wrong or what do I need to do to convert that correctly?

Net::Amazon returns decoded strings, so you need to encode them (in the encoding that your console expects) before printing. This can either be done with Encode (core module) or something like:

binmode STDOUT, ':encoding(UTF-8)';

(Assuming that UTF-8 is what your terminal supports).

See also: Unicode and Encodings with Perl.

Replies are listed 'Best First'.
Re^2: Amazon API wrappers
by tospo (Hermit) on May 30, 2011 at 11:41 UTC

    Thanks mortiz. Yes I noticed that Net::Amazon is sending requests against the 2009 version of the Amazon API but I'm wondering how much of a problem that might be? Yes, it's working but am I missing out on some must-have features or will I get slower responses as a result? I was just wondering what others use because I'm just starting with this and, to my surprise, I couldn't find anything more recent at all. I might be missing something obvious and I'm imagining that many others are using this API on a daily basis. Is it considered better to just parse the XML response 'manually' instead of relying on a wrapper module that might not be maintained anymore?
    Thanks for your hints about the Unicode issues.

      Yes, it's working but am I missing out on some must-have features or will I get slower responses as a result?

      "Must-have" is relative. Net::Amazon contains all the features that were "must-have" back in 2009. Only if the scope of "must-have" has changed (and that depends on your use case) there is a need for improvement.

      was just wondering what others use because I'm just starting with this and, to my surprise, I couldn't find anything more recent at all.

      I found Net::Amazon and XML::Amazon quite convenient, and only implemented my own becase eventually I want to use non-blocking requests with Mojo::UserAgent for nice integration into the Mojo runloop.

      That said it was a lot of work, and I wouldn't recommend it - for most use cases it's much easier to extend the existing modules (submit patches to the module author) than to roll your own.

        thanks, I guess I'll just go with Net::Amazon then. Seems that XML::Amazon's last release is also from 2009. I wonder if that's coincidence or is there anything in the newer Amazon APIs that has made it impossible to maintain these modules? Anyway, as long as it works...