1Mojo::Asset::Memory(3)User Contributed Perl DocumentationMojo::Asset::Memory(3)
2
3
4
6 Mojo::Asset::Memory - In-Memory Asset
7
9 use Mojo::Asset::Memory;
10
11 my $asset = Mojo::Asset::Memory->new;
12 $asset->add_chunk('foo bar baz');
13 print $asset->slurp;
14
16 Mojo::Asset::Memory is a container for in-memory assets.
17
19 Mojo::Asset::Memory inherits all methods from Mojo::Asset and
20 implements the following new ones.
21
22 "new"
23 my $asset = Mojo::Asset::Memory->new;
24
25 Construct a new Mojo::Asset::Memory object.
26
27 "add_chunk"
28 $asset = $asset->add_chunk('foo bar baz');
29
30 Add chunk of data to asset.
31
32 "contains"
33 my $position = $asset->contains('bar');
34
35 Check if asset contains a specific string.
36
37 "get_chunk"
38 my $chunk = $asset->get_chunk($offset);
39
40 Get chunk of data starting from a specific position.
41
42 "move_to"
43 $asset = $asset->move_to('/foo/bar/baz.txt');
44
45 Move asset data into a specific file.
46
47 "size"
48 my $size = $asset->size;
49
50 Size of asset data in bytes.
51
52 "slurp"
53 my $string = $file->slurp;
54
55 Read all asset data at once.
56
58 Mojolicious, Mojolicious::Guides, <http://mojolicious.org>.
59
60
61
62perl v5.12.3 2010-08-12 Mojo::Asset::Memory(3)