The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Amazon::Sites - A class to represent Amazon sites


  use Amazon::Sites;

  my $sites = Amazon::Sites->new;
  my @sites = $sites->sites;
  my %sites = $sites->sites_hash;
  my @codes = $sites->codes;

  my $site  = $sites->site('UK');
  say $site->currency; # GBP
  say $site->tldr;     #
  # etc

  my %urls = $sites->asin_urls('XXXXXXX');
  say $urls{UK}; #
  # etc


A simple class that encapsulates information about Amazon sites.



Creates a new Amazon::Sites object.

    my $sites = Amazon::Sites->new;

You can also specify a list of sites to include or exclude:

    # Only include the US site
    my $sites = Amazon::Sites->new(include => [ 'US' ]);
    # Exclude the US site
    my $sites = Amazon::Sites->new(exclude => [ 'US' ]);

At most one of `include` or `exclude` can be specified.

You can also specify a hash of associate codes:

    my $sites = Amazon::Sites->new(assoc_codes => {
      UK => 'My Associate Code',


Returns a hash where the keys are the two-letter country codes and the values are Amazon::Site objects.


Given a two-letter country code, returns the corresponding Amazon::Site object.


Returns a list of Amazon::Site objects, sorted by the sort order.


Returns a list of the two-letter country codes, sorted by the sort order.


Given an ASIN, returns a hash where the keys are the two-letter country codes and the values are the corresponding ASIN URLs.


Copyright 2024, Dave Cross. All rights reserved.


This program is free software; you can redistribute it and/or modify it under the terms of either:

  • the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or

  • the Artistic License version 2.0.