| Mojolicious documentation | view source | Contained in the Mojolicious distribution. |
Mojo::Asset::Memory - In-Memory Asset
use Mojo::Asset::Memory;
my $asset = Mojo::Asset::Memory->new;
$asset->add_chunk('foo bar baz');
print $asset->slurp;
Mojo::Asset::Memory is a container for in-memory assets.
Mojo::Asset::Memory inherits all methods from Mojo::Asset and implements the following new ones.
newmy $asset = Mojo::Asset::Memory->new;
Construct a new Mojo::Asset::Memory object.
add_chunk $asset = $asset->add_chunk('foo bar baz');
Add chunk of data to asset.
contains my $position = $asset->contains('bar');
Check if asset contains a specific string.
get_chunkmy $chunk = $asset->get_chunk($offset);
Get chunk of data starting from a specific position.
move_to $asset = $asset->move_to('/foo/bar/baz.txt');
Move asset data into a specific file.
sizemy $size = $asset->size;
Size of asset data in bytes.
slurpmy $string = $file->slurp;
Read all asset data at once.
Mojolicious, Mojolicious::Guides, http://mojolicio.us.
| Mojolicious documentation | view source | Contained in the Mojolicious distribution. |