Amazon-MWS
view release on metacpan or search on metacpan
lib/Amazon/MWS/Enumeration.pm view on Meta::CPAN
sub define {
my $class = shift;
no strict 'refs';
*{"${class}::import"} = *Exporter::import;
foreach my $const (@_) {
my $string = $const;
my $ref = \$string;
bless $ref, $class;
*{"${class}::$const"} = sub { $ref };
push @{"${class}::EXPORT_OK"}, $const;
push @{ ${"${class}::EXPORT_TAGS"}{'all'} }, $const;
}
}
1;
__END__
lib/Amazon/MWS/Enumeration.pm view on Meta::CPAN
use Amazon::MWS::Enumeration::FeedType qw(:all);
_POST_PRODUCT_DATA_ # no warnings or strict violations, checked for typos!
=head1 METHODS
=head2 define ( @constants )
For each string passed, installs a class method / exportable sub into the
calling subclass by that name. The value returned by that sub will be an
object blessed into the calling package which stringifies into the constant
itself, e.g. $class->CONSTANT eq 'CONSTANT';
=head2 as_string ()
The stringifier for these enums - simply dereferences the blessed scalar.
=head1 AUTHOR
Paul Driver C<< frodwith@cpan.org >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2009, Plain Black Corporation L<http://plainblack.com>.
All rights reserved
lib/Amazon/MWS/Routines.pm view on Meta::CPAN
print LOG "\nNew instance created. \n";
print LOG Dumper(\%opts);
close LOG;
}
# https://github.com/interchange/Amazon-MWS/issues/9
$opts{endpoint} ||= 'https://mws.amazonaws.com';
# strip the trailing slashes
$opts{endpoint} =~ s/\/+\z//;
bless {
package => "$pkg",
agent => LWP::UserAgent->new(agent => $agent_string),
endpoint => $opts{endpoint},
access_key_id => $opts{access_key_id},
secret_key => $opts{secret_key},
merchant_id => $opts{merchant_id},
marketplace_id => $opts{marketplace_id},
debug => $opts{debug},
logfile => $opts{logfile},
}, $pkg;
lib/Amazon/MWS/Uploader.pm view on Meta::CPAN
use Amazon::MWS::XML::Order;
use Amazon::MWS::Client;
use Amazon::MWS::XML::Response::FeedSubmissionResult;
use Amazon::MWS::XML::Response::OrderReport;
use Data::Dumper;
use File::Spec;
use DateTime;
use SQL::Abstract;
use Try::Tiny;
use Path::Tiny;
use Scalar::Util qw/blessed/;
use XML::Compile::Schema;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
use namespace::clean;
our $VERSION = '0.18';
use constant {
AMW_ORDER_WILDCARD_ERROR => 999999,
lib/Amazon/MWS/Uploader.pm view on Meta::CPAN
my $get_orderline = sub {
# begin of the closure
my $orderline;
my @items;
try {
$orderline = $self->client->ListOrderItems(AmazonOrderId => $amws_id);
push @items, @{ $orderline->{OrderItems}->{OrderItem} };
}
catch {
my $err = $_;
if (blessed($err) && $err->isa('Amazon::MWS::Exception::Throttled')) {
die "Request is throttled. Consider to adjust order_days_range as documented at https://metacpan.org/pod/Amazon::MWS::Uploader#ACCESSORS";
}
else {
die Dumper($err);
}
};
while (my $next = $orderline->{NextToken}) {
try {
$orderline =
$self->client->ListOrderItemsByNextToken(NextToken => $next);
lib/Amazon/MWS/Uploader.pm view on Meta::CPAN
Acknowledged => $flag);
} catch {
_handle_exception($_);
};
}
return;
}
sub _handle_exception {
my ($err) = @_;
if (blessed $err) {
my $msg;
if ( $err->isa('Amazon::MWS::Exception::Throttled') ) {
$msg = $err->xml;
}
elsif ( $err->isa('Amazon::MWS::Exception')) {
if (my $string = $err->error) {
$msg = $string;
}
else {
$msg = Dumper($err);
( run in 1.104 second using v1.01-cache-2.11-cpan-b32c08c6d1a )