1Mojo::Asset(3) User Contributed Perl Documentation Mojo::Asset(3)
2
3
4
6 Mojo::Asset - Asset Base Class
7
9 use base 'Mojo::Asset';
10
12 Mojo::Asset is an abstract base class for assets.
13
15 Mojo::Asset implements the following attributes.
16
17 "end_range"
18 my $end = $asset->end_range;
19 $asset = $asset->end_range(8);
20
21 Pretend file ends earlier.
22
23 "start_range"
24 my $start = $asset->start_range;
25 $asset = $asset->start_range(0);
26
27 Pretend file starts later.
28
30 Mojo::Asset inherits all methods from Mojo::Base and implements the
31 following new ones.
32
33 "add_chunk"
34 $asset = $asset->add_chunk('foo bar baz');
35
36 Add chunk of data to asset.
37
38 "contains"
39 my $position = $asset->contains('bar');
40
41 Check if asset contains a specific string.
42
43 "get_chunk"
44 my $chunk = $asset->get_chunk($offset);
45
46 Get chunk of data starting from a specific position.
47
48 "move_to"
49 $asset = $asset->move_to('/foo/bar/baz.txt');
50
51 Move asset data into a specific file.
52
53 "size"
54 my $size = $asset->size;
55
56 Size of asset data in bytes.
57
58 "slurp"
59 my $string = $file->slurp;
60
61 Read all asset data at once.
62
64 Mojolicious, Mojolicious::Guides, <http://mojolicious.org>.
65
66
67
68perl v5.12.3 2010-08-12 Mojo::Asset(3)