1package Net::Amazon::S3::Client::Object::Range; 2# ABSTRACT: Object extension allowing to fetch part of an object 3$Net::Amazon::S3::Client::Object::Range::VERSION = '0.99'; 4use Moose 0.85; 5use MooseX::StrictConstructor 0.16; 6 7has 'object' 8 => is => 'ro' 9 => isa => 'Net::Amazon::S3::Client::Object' 10 => required => 1 11 ; 12 13has 'range' 14 => is => 'ro' 15 => isa => 'Str' 16 => required => 1 17 ; 18 19sub _get { 20 my ($self, %args) = shift; 21 22 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 return $response; 32} 33 34sub get { 35 my $self = shift; 36 return $self->_get->content; 37} 38 39sub get_decoded { 40 my $self = shift; 41 return $self->_get->decoded_content(@_); 42} 43 44sub get_callback { 45 my ($self, $callback) = @_; 46 47 return $self->_get (filename => $callback)->http_response; 48} 49 50sub get_filename { 51 my ($self, $filename) = @_; 52 53 return $self->_get (filename => $filename)->http_response; 54} 55 56 571; 58 59__END__ 60 61=pod 62 63=encoding UTF-8 64 65=head1 NAME 66 67Net::Amazon::S3::Client::Object::Range - Object extension allowing to fetch part of an object 68 69=head1 VERSION 70 71version 0.99 72 73=head1 SYNOPSIS 74 75 my $value = $object->range ("bytes=1024-10240")->get; 76 77=head1 DESCRIPTION 78 79Simple 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 83Provides 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 99L<Net::Amazon::S3::Client::Object> 100 101=head1 AUTHOR 102 103Branislav Zahradník <barney@cpan.org> - since v0.99 104 105=head1 COPYRIGHT AND LICENSE 106 107This module is a part of L<Net::Amazon::S3> distribution. 108 109=head1 AUTHOR 110 111Branislav Zahradník <barney@cpan.org> 112 113=head1 COPYRIGHT AND LICENSE 114 115This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník. 116 117This is free software; you can redistribute it and/or modify it under 118the same terms as the Perl 5 programming language system itself. 119 120=cut 121