Amazon-S3-Thin
view release on metacpan or search on metacpan
It does not require any XML::\* modules, so installation is easy;
- Low Learning Cost
The interfaces are designed to follow S3 official REST APIs.
So it is easy to learn.
## Comparison to precedent modules
There are already some useful modules like [Amazon::S3](https://metacpan.org/pod/Amazon%3A%3AS3), [Net::Amazon::S3](https://metacpan.org/pod/Net%3A%3AAmazon%3A%3AS3)
on CPAN. They provide a "Perlish" interface, which looks pretty
for Perl programmers, but they also hide low-level behaviors.
For example, the "get\_key" method translate HTTP status 404 into `undef` and
HTTP 5xx status into exception.
In some situations, it is very important to see the raw HTTP communications.
That's why I made this module.
# CONSTRUCTOR
## new( \\%params )
lib/Amazon/S3/Thin.pm view on Meta::CPAN
sub copy_object {
my ($self, $src_bucket, $src_key, $dst_bucket, $dst_key, $headers) = @_;
$headers ||= {};
$headers->{'x-amz-copy-source'} = $src_bucket . "/" . $src_key;
my $request = $self->_compose_request('PUT', $self->_resource($dst_bucket, $dst_key), $headers);
my $res = $self->_send($request);
# XXX: Since the COPY request might return error response in 200 OK, we'll rewrite the status code to 500 for convenience
# ref http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html
# ref https://github.com/boto/botocore/blob/4e9b4419ec018716ab1a3fe1587fbdc3cfef200e/botocore/handlers.py#L77-L120
if ($self->_looks_like_special_case_error($res)) {
$res->code(500);
}
return $res;
}
sub _looks_like_special_case_error {
my ($self, $res) = @_;
return $res->code == 200 && (length $res->content == 0 || $res->content =~ /<Error>/);
}
sub put_object {
my ($self, $bucket, $key, $content, $headers) = @_;
croak 'must specify key' unless $key && length $key;
if ($headers->{acl_short}) {
$self->_validate_acl_short($headers->{acl_short});
lib/Amazon/S3/Thin.pm view on Meta::CPAN
=item Low Learning Cost
The interfaces are designed to follow S3 official REST APIs.
So it is easy to learn.
=back
=head2 Comparison to precedent modules
There are already some useful modules like L<Amazon::S3>, L<Net::Amazon::S3>
on CPAN. They provide a "Perlish" interface, which looks pretty
for Perl programmers, but they also hide low-level behaviors.
For example, the "get_key" method translate HTTP status 404 into C<undef> and
HTTP 5xx status into exception.
In some situations, it is very important to see the raw HTTP communications.
That's why I made this module.
=head1 CONSTRUCTOR
=head2 new( \%params )
( run in 0.525 second using v1.01-cache-2.11-cpan-64827b87656 )