++ed by:
DRAEGTUN RSCHABER HRUPP MPGUTTA ALEXBIO

116 PAUSE user(s)
144 non-PAUSE user(s).

Sebastian Riedel

NAME

Mojolicious::Static - Serve static files

SYNOPSIS

  use Mojolicious::Static;

  my $static = Mojolicious::Static->new;

DESCRIPTION

Mojolicious::Static is a dispatcher for static files with Range and If-Modified-Since support.

ATTRIBUTES

Mojolicious::Static implements the following attributes.

classes

  my $classes = $static->classes;
  $static     = $static->classes(['main']);

Classes to use for finding files in DATA section, first one has the highest precedence, defaults to main.

  # Add another class with static files in DATA section
  push @{$static->classes}, 'Mojolicious::Plugin::Fun';

paths

  my $paths = $static->paths;
  $static   = $static->paths(['/foo/bar/public']);

Directories to serve static files from, first one has the highest precedence.

  # Add another "public" directory
  push @{$static->paths}, '/foo/bar/public';

METHODS

Mojolicious::Static inherits all methods from Mojo::Base and implements the following ones.

dispatch

  my $success = $static->dispatch(Mojolicious::Controller->new);

Dispatch a Mojolicious::Controller object.

serve

  my $success = $static->serve(Mojolicious::Controller->new, 'foo/bar.html');

Serve a specific file, relative to paths or from classes.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicio.us.