GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mojo::Asset(3) User Contributed Perl Documentation Mojo::Asset(3)
 

Mojo::Asset - HTTP content storage base class

  package 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   {...}

Mojo::Asset is an abstract base class for HTTP content storage backends, like Mojo::Asset::File and Mojo::Asset::Memory.

Mojo::Asset inherits all events from Mojo::EventEmitter.

Mojo::Asset implements the following attributes.

  my $end = $asset->end_range;
  $asset  = $asset->end_range(8);
Pretend file ends earlier.

  my $start = $asset->start_range;
  $asset    = $asset->start_range(3);
Pretend file starts later.

Mojo::Asset inherits all methods from Mojo::EventEmitter and implements the following new ones.

  $asset = $asset->add_chunk('foo bar baz');
Add chunk of data to asset. Meant to be overloaded in a subclass.

  my $position = $asset->contains('bar');
Check if asset contains a specific string. Meant to be overloaded in a subclass.

  my $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.

  my $bool = $asset->is_file;
False, this is not a Mojo::Asset::File object.

  my $bool = $asset->is_range;
Check if asset has a "start_range" or "end_range".

  $asset = $asset->move_to('/home/sri/foo.txt');
Move asset data into a specific file. Meant to be overloaded in a subclass.

  my $mtime = $asset->mtime;
Modification time of asset. Meant to be overloaded in a subclass.

  my $size = $asset->size;
Size of asset data in bytes. Meant to be overloaded in a subclass.

  my $bytes = $asset->slurp;
Read all asset data at once. Meant to be overloaded in a subclass.

  my $file = $asset->to_file;
Convert asset to Mojo::Asset::File object. Meant to be overloaded in a subclass.

Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
2018-11-22 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.