|
NAMEMojo::Asset - HTTP content storage base classSYNOPSISpackage Mojo::Asset::MyAsset; use Mojo::Base 'Mojo::Asset'; sub add_chunk {...} sub contains {...} sub get_chunk {...} sub move_to {...} sub mtime {...} sub size {...} sub slurp {...} sub to_file {...} DESCRIPTIONMojo::Asset is an abstract base class for HTTP content storage backends, like Mojo::Asset::File and Mojo::Asset::Memory.EVENTSMojo::Asset inherits all events from Mojo::EventEmitter.ATTRIBUTESMojo::Asset implements the following attributes.end_rangemy $end = $asset->end_range; $asset = $asset->end_range(8); Pretend file ends earlier. start_rangemy $start = $asset->start_range; $asset = $asset->start_range(3); Pretend file starts later. METHODSMojo::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. containsmy $position = $asset->contains('bar'); Check if asset contains a specific string. Meant to be overloaded in a subclass. get_chunkmy $bytes = $asset->get_chunk($offset); my $bytes = $asset->get_chunk($offset, $max); Get chunk of data starting from a specific position, defaults to a maximum chunk size of 131072 bytes (128KiB). Meant to be overloaded in a subclass. is_filemy $bool = $asset->is_file; False, this is not a Mojo::Asset::File object. is_rangemy $bool = $asset->is_range; Check if asset has a "start_range" or "end_range". move_to$asset = $asset->move_to('/home/sri/foo.txt'); Move asset data into a specific file. Meant to be overloaded in a subclass. mtimemy $mtime = $asset->mtime; Modification time of asset. Meant to be overloaded in a subclass. sizemy $size = $asset->size; Size of asset data in bytes. Meant to be overloaded in a subclass. slurpmy $bytes = $asset->slurp; Read all asset data at once. Meant to be overloaded in a subclass. to_filemy $file = $asset->to_file; Convert asset to Mojo::Asset::File object. Meant to be overloaded in a subclass. SEE ALSOMojolicious, Mojolicious::Guides, <https://mojolicious.org>.
Visit the GSP FreeBSD Man Page Interface. |