NAME
Mojo::Asset - HTTP content storage base class
SYNOPSIS
package Mojo::Asset::MyAsset;
use Mojo::Base 'Mojo::Asset';
sub add_chunk {...}
sub contains {...}
sub get_chunk {...}
sub move_to {...}
sub size {...}
sub slurp {...}
DESCRIPTION
Mojo::Asset is an abstract base class for HTTP content storage.
ATTRIBUTES
Mojo::Asset implements the following attributes.
end_range
my $end = $asset->end_range;
$asset = $asset->end_range(8);
Pretend file ends earlier.
start_range
my $start = $asset->start_range;
$asset = $asset->start_range(0);
Pretend file starts later.
METHODS
Mojo::Asset inherits all methods from Mojo::EventEmitter and implements the following new ones.
add_chunk
$asset = $asset->add_chunk('foo bar baz');
Add chunk of data to asset. Meant to be overloaded in a subclass.
contains
my $position = $asset->contains('bar');
Check if asset contains a specific string. Meant to be overloaded in a subclass.
get_chunk
my $chunk = $asset->get_chunk($offset);
Get chunk of data starting from a specific position. Meant to be overloaded in a subclass.
is_file
my $false = $asset->is_file;
False.
move_to
$asset = $asset->move_to('/home/sri/foo.txt');
Move asset data into a specific file. Meant to be overloaded in a subclass.
size
my $size = $asset->size;
Size of asset data in bytes. Meant to be overloaded in a subclass.
slurp
my $string = $asset->slurp;
Read all asset data at once. Meant to be overloaded in a subclass.