| 1 | package Net::Amazon::S3::Client::Object::Range; | ||
| 2 | # ABSTRACT: Object extension allowing to fetch part of an object | ||
| 3 | 99 | $Net::Amazon::S3::Client::Object::Range::VERSION = '0.991'; | |
| 4 | 99 | ▶ | use Moose 0.85; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 99 | ▶ | use MooseX::StrictConstructor 0.16; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 99 | has 'object' | |
| 8 | => is => 'ro' | ||
| 9 | => isa => 'Net::Amazon::S3::Client::Object' | ||
| 10 | => required => 1 | ||
| 11 | ; | ||
| 12 | |||
| 13 | 99 | has 'range' | |
| 14 | => is => 'ro' | ||
| 15 | => isa => 'Str' | ||
| 16 | => required => 1 | ||
| 17 | ; | ||
| 18 | |||
| 19 | sub _get { | ||
| 20 | 1 | ▶ | my ($self, %args) = shift; |
|
Subroutine
_get: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | 1 | my $response = $self->object->_perform_operation ( | |
| 23 | 'Net::Amazon::S3::Operation::Object::Fetch', | ||
| 24 | |||
| 25 | %args, | ||
| 26 | |||
| 27 | method => 'GET', | ||
| 28 | range => $self->range, | ||
| 29 | ); | ||
| 30 | |||
| 31 | 1 | return $response; | |
| 32 | } | ||
| 33 | |||
| 34 | sub get { | ||
| 35 | 1 | ▶ | my $self = shift; |
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||
| 36 | 1 | return $self->_get->content; | |
| 37 | } | ||
| 38 | |||
| 39 | sub get_decoded { | ||
| 40 | 0 | ▶ | my $self = shift; |
|
Subroutine
get_decoded: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 41 | 0 | return $self->_get->decoded_content(@_); | |
| 42 | } | ||
| 43 | |||
| 44 | sub get_callback { | ||
| 45 | 0 | ▶ | my ($self, $callback) = @_; |
|
Subroutine
get_callback: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | |||
| 47 | 0 | return $self->_get (filename => $callback)->http_response; | |
| 48 | } | ||
| 49 | |||
| 50 | sub get_filename { | ||
| 51 | 0 | ▶ | my ($self, $filename) = @_; |
|
Subroutine
get_filename: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 52 | |||
| 53 | 0 | return $self->_get (filename => $filename)->http_response; | |
| 54 | } | ||
| 55 | |||
| 56 | |||
| 57 | 99 | 1; | |
| 58 | |||
| 59 | __END__ | ||
| 60 | |||
| 61 | =pod | ||
| 62 | |||
| 63 | =encoding UTF-8 | ||
| 64 | |||
| 65 | =head1 NAME | ||
| 66 | |||
| 67 | Net::Amazon::S3::Client::Object::Range - Object extension allowing to fetch part of an object | ||
| 68 | |||
| 69 | =head1 VERSION | ||
| 70 | |||
| 71 | version 0.991 | ||
| 72 | |||
| 73 | =head1 SYNOPSIS | ||
| 74 | |||
| 75 | my $value = $object->range ("bytes=1024-10240")->get; | ||
| 76 | |||
| 77 | =head1 DESCRIPTION | ||
| 78 | |||
| 79 | Simple implementation dowloads, see L<use-byte-range-fetches|https://docs.aws.amazon.com/whitepapers/latest/s3-optimizing-performance-best-practices/use-byte-range-fetches.html>. | ||
| 80 | |||
| 81 | =head1 METHODS | ||
| 82 | |||
| 83 | Provides same get methods as L<Net::Amazon::S3::Client::Object> | ||
| 84 | |||
| 85 | =over | ||
| 86 | |||
| 87 | =item get | ||
| 88 | |||
| 89 | =item get_decoded | ||
| 90 | |||
| 91 | =item get_callback | ||
| 92 | |||
| 93 | =item get_filename | ||
| 94 | |||
| 95 | =back | ||
| 96 | |||
| 97 | =head1 SEE ALSO | ||
| 98 | |||
| 99 | L<Net::Amazon::S3::Client::Object> | ||
| 100 | |||
| 101 | =head1 AUTHOR | ||
| 102 | |||
| 103 | Branislav Zahradník <barney@cpan.org> - since v0.99 | ||
| 104 | |||
| 105 | =head1 COPYRIGHT AND LICENSE | ||
| 106 | |||
| 107 | This module is a part of L<Net::Amazon::S3> distribution. | ||
| 108 | |||
| 109 | =head1 AUTHOR | ||
| 110 | |||
| 111 | Branislav Zahradník <barney@cpan.org> | ||
| 112 | |||
| 113 | =head1 COPYRIGHT AND LICENSE | ||
| 114 | |||
| 115 | This software is copyright (c) 2022 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník. | ||
| 116 | |||
| 117 | This is free software; you can redistribute it and/or modify it under | ||
| 118 | the same terms as the Perl 5 programming language system itself. | ||
| 119 | |||
| 120 | =cut | ||