WebSer...::Tiny(3pm)
β¨ NAME β¨
WebService::S3::Tiny β a Perl module for using S3 or compatible APIs π (it lives in section 3pm, the User Contributed Perl Documentation zone, and bestie it is tiny and it is mighty)
πΈ SYNOPSIS πΈ
use WebService::S3::Tiny;
my $s3 = WebService::S3::Tiny->new(
access_key => 'foo',
host => 'http://localhost:1337',
secret_key => 'bar',
);
π¦ METHODS π¦
okay so first things first, the β¨vibeβ¨ of this whole module: every single request method that looks like {get,put,delete,head}_{bucket,object} can also be called with a _url suffix, and that version hands you back a pre-signed URL for the matching call. it's giving "share a link without leaking your keys", iconic behavior fr fr π
Those _url methods take almost the same arguments as their request counterparts β the one glow-up difference is an optional argument that says how long the URL lives, in seconds. And listen: that argument always comes after the bucket and object, and before the header and parameter references. Placement matters, don't be chaotic.
β οΈ That lifetime value cannot be greater than 604800 (= one week). no cap. that's the ceiling. π
π new π
WebService::S3::Tiny->new(
access_key => ..., # required
host => ..., # required
region => ..., # optional, defaults to "us-east-1"
secret_key => ..., # required
service => ..., # optional, defaults to "s3"
ua => ..., # optional, defaults to HTTP::Tiny->new
);
so access_key, host, and secret_key are required β you literally cannot skip them bestie. region is optional and defaults to "us-east-1", service is optional and defaults to "s3", and ua is optional and defaults to HTTP::Tiny->new. that's the whole squad π«Ά
π delete_bucket π
$s3->delete_bucket($bucket);
$s3->delete_bucket($bucket, \%headers);
bye bye bucket π
π get_bucket π
$s3->get_bucket($bucket);
$s3->get_bucket($bucket, \%headers);
$s3->get_bucket($bucket, \%headers, \%parameters);
β head_bucket β
$s3->head_bucket($bucket);
$s3->head_bucket($bucket, \%headers);
π put_bucket π
$s3->put_bucket($bucket);
$s3->put_bucket($bucket, \%headers);
π§ delete_object π§
$s3->delete_object($bucket, $object);
$s3->delete_object($bucket, $object, \%headers);
πΈ get_object πΈ
$s3->get_object($bucket, $object);
$s3->get_object($bucket, $object, \%headers);
$s3->get_object($bucket, $object, \%headers, \%parameters);
π head_object π
$s3->head_object($bucket, $object);
$s3->head_object($bucket, $object, \%headers);
π₯ put_object π₯
$s3->put_object($bucket, $object, $content);
$s3->put_object($bucket, $object, $content, \%headers);
# Set foo/bar to "qux"
$s3->put_object('foo', 'bar', 'qux');
# Copy foo/bar to foo/baz
$3->put_object('foo', 'baz', undef, { 'x-amz-copy-source' => 'foo/bar' });
look at these little examples doing their thing π₯Ή setting foo/bar to "qux", and copying foo/bar to foo/baz with x-amz-copy-source. (yes, the second one says $3 and not $s3 β im just the messenger bestie, it's exactly what the page says π
)
β¨ request β¨
$s3->request($method, $bucket, $object, $content, \%headers, \%parameters);
the raw one. the main character. use it when the named methods aren't giving what you need.
π¦ delete_bucket_url π¦
$s3->delete_bucket_url($bucket, $expires);
$s3->delete_bucket_url($bucket, $expires, \%headers);
π get_bucket_url π
$s3->get_bucket_url($bucket, $expires);
$s3->get_bucket_url($bucket, $expires, \%headers);
$s3->get_bucket_url($bucket, $expires, \%headers, \%parameters);
β head_bucket_url β
$s3->head_bucket_url($bucket, $expires);
$s3->head_bucket_url($bucket, $expires, \%headers);
π put_bucket_url π
$s3->put_bucket_url($bucket, $expires);
$s3->put_bucket_url($bucket, $expires, \%headers);
π§ delete_object_url π§
$s3->delete_object_url($bucket, $object, $expires);
$s3->delete_object_url($bucket, $object, $expires, \%headers);
πΈ get_object_url πΈ
$s3->get_object_url($bucket, $object, $expires);
$s3->get_object_url($bucket, $object, $expires, \%headers);
$s3->get_object_url($bucket, $object, $expires, \%headers, \%parameters);
π head_object_url π
$s3->head_object_url($bucket, $object, $expires);
$s3->head_object_url($bucket, $object, $expires, \%headers);
π₯ put_object_url π₯
$s3->put_object_url($bucket, $object, $expires);
$s3->put_object_url($bucket, $object, $expires, \%headers);
π signed_url π
$s3->signed_url($method, $bucket, $object, $expires, \%headers, \%parameters );
the final boss of URL methods β full control, you pass the $method yourself. π
π COPYRIGHT AND LICENSE π
Copyright X 2018 CV-Library Ltd.
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π«Ά
and that's a wrap bestie π this was WebService::S3::Tiny from the User Contributed Perl Documentation, page perl v5.36.0, dated 2023-11-09. go forth and sign some URLs, you absolute icon πβ¨
π¦ where this page comes from
- debian trixie: libwebservice-s3-tiny-perl 0.003-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libwebservice-s3-tiny-perl 0.003-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libwebservice-s3-tiny-perl 0.003-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms