HTTP::Promise::Headers::Range - Range Header Field
use HTTP::Promise::Headers::Range; my $range = HTTP::Promise::Headers::Range->new || die( HTTP::Promise::Headers::Range->error, "\n" ); $range->unit( 'bytes' ): $range->ranges->push( $range->new_range( 200, 1000 ) ); my $start = $range->ranges->first->start; # 200 my $end = $range->ranges->first->end; # 1000 $range->ranges->push( $range->new_range( 1001, 2000 ) ); say $range->as_string; # or say "$range"; # bytes=200-1000, 1001-2000
v0.1.0
The following is an extract from Mozilla documentation.
The Range HTTP request header indicates the part of a document that the server should return.
Example:
# Getting multiple ranges Range: bytes=200-1000, 2000-6576, 19000- # The last 500 bytes Range: bytes=0-499, -500 Range: bytes=200- Range: bytes=200-1000 Range: bytes=200-1000, 1001-2000 Range: bytes=200-1000, 1001-2000, 2001-3000 Range: bytes=-4321
Returns a string representation of the Range object.
Range
Provided with a start and and offset, and this will return a new HTTP::Promise::Headers::Range::StartEnd object.
HTTP::Promise::Headers::Range::StartEnd
This object has two methods: start and end each capable of setting or returning its value, which may be undef
start
end
undef
Sets or gets the array object that contains all the HTTP::Promise::Headers::Range::StartEnd objects (see below for a descriptions). Thus you can use all the methods from Module::Generic::Array to manipulate the range objects.
The unit in which ranges are specified. This is usually bytes.
bytes
Sets or gets the end of the range as a number object
Sets or gets the start of the range as a number object
Jacques Deguest <jack@deguest.jp>
See also rfc7233, section 3.1 and Mozilla documentation
HTTP::Promise, HTTP::Promise::Request, HTTP::Promise::Response, HTTP::Promise::Message, HTTP::Promise::Entity, HTTP::Promise::Headers, HTTP::Promise::Body, HTTP::Promise::Body::Form, HTTP::Promise::Body::Form::Data, HTTP::Promise::Body::Form::Field, HTTP::Promise::Status, HTTP::Promise::MIME, HTTP::Promise::Parser, HTTP::Promise::IO, HTTP::Promise::Stream, HTTP::Promise::Exception
Copyright(c) 2022 DEGUEST Pte. Ltd.
All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTTP::Promise, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::Promise
CPAN shell
perl -MCPAN -e shell install HTTP::Promise
For more information on module installation, please visit the detailed CPAN module installation guide.