Amazon-S3-Thin
view release on metacpan or search on metacpan
lib/Amazon/S3/Thin.pm view on Meta::CPAN
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});
$headers->{'x-amz-acl'} = $headers->{acl_short};
delete $headers->{acl_short};
}
if (ref($content) eq 'SCALAR') {
$headers->{'Content-Length'} ||= -s $$content;
$content = _content_sub($$content);
}
else {
$headers->{'Content-Length'} ||= length $content;
lib/Amazon/S3/Thin.pm view on Meta::CPAN
} else {
croak 'generate_presigned_post is only supported on signature v4';
}
}
sub _resource {
my ($self, $bucket, $key, $query_string) = @_;
return Amazon::S3::Thin::Resource->new($bucket, $key, $query_string);
}
sub _validate_acl_short {
my ($self, $policy_name) = @_;
if (!grep({$policy_name eq $_}
qw(private public-read public-read-write authenticated-read)))
{
croak "$policy_name is not a supported canned access policy";
}
}
# make the HTTP::Request object
( run in 0.461 second using v1.01-cache-2.11-cpan-a5abf4f5562 )