Amazon-S3-Thin
view release on metacpan or search on metacpan
- 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 )
**Receives:** hashref with options.
lib/Amazon/S3/Thin.pm view on Meta::CPAN
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 )
B<Receives:> hashref with options.
xt/90_functional.t view on Meta::CPAN
$req = $res->request;
is $res->code, 204;
is $req->method, "DELETE";
is $req->content, '';
is $req->uri, "$protocol://$host/$bucket/dir/s3test.txt";
diag "HEAD request on non-existing object";
$res = $client->head_object($bucket, $key);
$req = $res->request;
ok !$res->is_success, "is not success";
is $res->code, 404;
is $req->method, "HEAD";
is $req->uri, "$protocol://$host/$bucket/dir/s3test.txt";
diag "GET request";
$res = $client->get_object($bucket, $key);
$req = $res->request;
ok !$res->is_success, "is not success";
is $res->code, 404;
is $req->method, "GET";
is $req->uri, "$protocol://$host/$bucket/dir/s3test.txt";
diag "PUT request";
$res = $client->put_object($bucket, $key, $body);
ok $res->is_success, "is_success";
$req = $res->request;
is $req->method, "PUT";
is $req->content, $body;
is $req->uri, "$protocol://$host/$bucket/dir/s3test.txt";
xt/94_virtual_host.t view on Meta::CPAN
$req = $res->request;
is $res->code, 204;
is $req->method, "DELETE";
is $req->content, '';
is $req->uri, "$protocol://$host/dir/s3test.txt";
diag "HEAD request on non-existing object";
$res = $client->head_object($bucket, $key);
$req = $res->request;
ok !$res->is_success, "is not success";
is $res->code, 404;
is $req->method, "HEAD";
is $req->uri, "$protocol://$host/dir/s3test.txt";
diag "GET request";
$res = $client->get_object($bucket, $key);
$req = $res->request;
ok !$res->is_success, "is not success";
is $res->code, 404;
is $req->method, "GET";
is $req->uri, "$protocol://$host/dir/s3test.txt";
diag "PUT request";
$res = $client->put_object($bucket, $key, $body);
ok $res->is_success, "is_success";
$req = $res->request;
is $req->method, "PUT";
is $req->content, $body;
is $req->uri, "$protocol://$host/dir/s3test.txt";
( run in 1.893 second using v1.01-cache-2.11-cpan-39bf76dae61 )