<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Mojolicious;
use Mojo::Base -base;

# "Fry: Shut up and take my money!"
use Carp ();
use Mojo::Exception;
use Mojo::Home;
use Mojo::Log;
use Mojo::Util;
use Mojo::UserAgent;
use Mojolicious::Commands;
use Mojolicious::Controller;
use Mojolicious::Plugins;
use Mojolicious::Renderer;
use Mojolicious::Routes;
use Mojolicious::Sessions;
use Mojolicious::Static;
use Mojolicious::Types;
use Mojolicious::Validator;
use Scalar::Util ();

has commands =&gt; sub {
  my $commands = Mojolicious::Commands-&gt;new(app =&gt; shift);
  Scalar::Util::weaken $commands-&gt;{app};
  return $commands;
};
has controller_class =&gt; 'Mojolicious::Controller';
has home             =&gt; sub { Mojo::Home-&gt;new-&gt;detect(ref shift) };
has log              =&gt; sub {
  my $self = shift;

  # Check if we have a log directory that is writable
  my $log  = Mojo::Log-&gt;new;
  my $home = $self-&gt;home;
  my $mode = $self-&gt;mode;
  $log-&gt;path($home-&gt;child('log', "$mode.log"))
    if -d $home-&gt;child('log') &amp;&amp; -w _;

  # Reduced log output outside of development mode
  return $mode eq 'development' ? $log : $log-&gt;level('info');
};
has 'max_request_size';
has mode     =&gt; sub { $ENV{MOJO_MODE} || $ENV{PLACK_ENV} || 'development' };
has moniker  =&gt; sub { Mojo::Util::decamelize ref shift };
has plugins  =&gt; sub { Mojolicious::Plugins-&gt;new };
has renderer =&gt; sub { Mojolicious::Renderer-&gt;new };
has routes   =&gt; sub { Mojolicious::Routes-&gt;new };
has secrets  =&gt; sub {
  my $self = shift;

  # Warn developers about insecure default
  $self-&gt;log-&gt;debug('Your secret passphrase needs to be changed');

  # Default to moniker
  return [$self-&gt;moniker];
};
has sessions =&gt; sub { Mojolicious::Sessions-&gt;new };
has static   =&gt; sub { Mojolicious::Static-&gt;new };
has types    =&gt; sub { Mojolicious::Types-&gt;new };
has ua       =&gt; sub {
  my $ua = Mojo::UserAgent-&gt;new;
  Scalar::Util::weaken $ua-&gt;server-&gt;app(shift)-&gt;{app};
  return $ua;
};
has validator =&gt; sub { Mojolicious::Validator-&gt;new };

our $CODENAME = 'Doughnut';
our $VERSION  = '7.84';

sub AUTOLOAD {
  my $self = shift;

  my ($package, $method) = our $AUTOLOAD =~ /^(.+)::(.+)$/;
  Carp::croak "Undefined subroutine &amp;${package}::$method called"
    unless Scalar::Util::blessed $self &amp;&amp; $self-&gt;isa(__PACKAGE__);

  # Call helper with fresh controller
  Carp::croak qq{Can't locate object method "$method" via package "$package"}
    unless my $helper = $self-&gt;renderer-&gt;get_helper($method);
  return $self-&gt;build_controller-&gt;$helper(@_);
}

sub build_controller {
  my ($self, $tx) = @_;
  $tx ||= $self-&gt;build_tx;

  # Embedded application
  my $stash = {};
  if (my $sub = $tx-&gt;can('stash')) { ($stash, $tx) = ($tx-&gt;$sub, $tx-&gt;tx) }

  # Build default controller
  my $defaults = $self-&gt;defaults;
  @$stash{keys %$defaults} = values %$defaults;
  my $c
    = $self-&gt;controller_class-&gt;new(app =&gt; $self, stash =&gt; $stash, tx =&gt; $tx);
  Scalar::Util::weaken $c-&gt;{app};

  return $c;
}

sub build_tx {
  my $self = shift;

  my $tx  = Mojo::Transaction::HTTP-&gt;new;
  my $max = $self-&gt;max_request_size;
  $tx-&gt;req-&gt;max_message_size($max) if defined $max;
  $self-&gt;plugins-&gt;emit_hook(after_build_tx =&gt; $tx, $self);

  return $tx;
}

sub config   { Mojo::Util::_stash(config   =&gt; @_) }
sub defaults { Mojo::Util::_stash(defaults =&gt; @_) }

sub dispatch {
  my ($self, $c) = @_;

  my $plugins = $self-&gt;plugins-&gt;emit_hook(before_dispatch =&gt; $c);

  # Try to find a static file
  my $tx = $c-&gt;tx;
  $self-&gt;static-&gt;dispatch($c) and $plugins-&gt;emit_hook(after_static =&gt; $c)
    unless $tx-&gt;res-&gt;code;

  # Start timer (ignore static files)
  my $stash = $c-&gt;stash;
  unless ($stash-&gt;{'mojo.static'} || $stash-&gt;{'mojo.started'}) {
    my $req    = $c-&gt;req;
    my $method = $req-&gt;method;
    my $path   = $req-&gt;url-&gt;path-&gt;to_abs_string;
    my $id     = $req-&gt;request_id;
    $self-&gt;log-&gt;debug(qq{$method "$path" ($id)});
    $c-&gt;helpers-&gt;timing-&gt;begin('mojo.timer');
  }

  # Routes
  $plugins-&gt;emit_hook(before_routes =&gt; $c);
  $c-&gt;helpers-&gt;reply-&gt;not_found
    unless $tx-&gt;res-&gt;code || $self-&gt;routes-&gt;dispatch($c) || $tx-&gt;res-&gt;code;
}

sub handler {
  my $self = shift;

  # Dispatcher has to be last in the chain
  ++$self-&gt;{dispatch}
    and $self-&gt;hook(around_action   =&gt; sub { $_[2]($_[1]) })
    and $self-&gt;hook(around_dispatch =&gt; sub { $_[1]-&gt;app-&gt;dispatch($_[1]) })
    unless $self-&gt;{dispatch};

  # Process with chain
  my $c = $self-&gt;build_controller(@_);
  Scalar::Util::weaken $c-&gt;{tx};
  $self-&gt;plugins-&gt;emit_chain(around_dispatch =&gt; $c);

  # Delayed response
  $self-&gt;log-&gt;debug('Nothing has been rendered, expecting delayed response')
    unless $c-&gt;stash-&gt;{'mojo.rendered'};
}

sub helper { shift-&gt;renderer-&gt;add_helper(@_) }

sub hook { shift-&gt;plugins-&gt;on(@_) }

sub new {
  my $self = shift-&gt;SUPER::new(@_);

  my $home = $self-&gt;home;
  push @{$self-&gt;renderer-&gt;paths}, $home-&gt;child('templates')-&gt;to_string;
  push @{$self-&gt;static-&gt;paths},   $home-&gt;child('public')-&gt;to_string;

  # Default to controller and application namespace
  my $r = $self-&gt;routes-&gt;namespaces(["@{[ref $self]}::Controller", ref $self]);

  # Hide controller attributes/methods
  $r-&gt;hide(qw(app continue cookie every_cookie every_param));
  $r-&gt;hide(qw(every_signed_cookie finish flash helpers match on param));
  $r-&gt;hide(qw(redirect_to render render_later render_maybe render_to_string));
  $r-&gt;hide(qw(rendered req res respond_to send session signed_cookie stash));
  $r-&gt;hide(qw(tx url_for validation write write_chunk));

  $self-&gt;plugin($_)
    for qw(HeaderCondition DefaultHelpers TagHelpers EPLRenderer EPRenderer);

  # Exception handling should be first in chain
  $self-&gt;hook(around_dispatch =&gt; \&amp;_exception);

  $self-&gt;startup;

  return $self;
}

sub plugin {
  my $self = shift;
  $self-&gt;plugins-&gt;register_plugin(shift, $self, @_);
}

sub server { $_[0]-&gt;plugins-&gt;emit_hook(before_server_start =&gt; @_[1, 0]) }

sub start {
  my $self = shift;
  $_-&gt;warmup for $self-&gt;static, $self-&gt;renderer;
  return $self-&gt;commands-&gt;run(@_ ? @_ : @ARGV);
}

sub startup { }

sub _exception {
  my ($next, $c) = @_;
  local $SIG{__DIE__}
    = sub { ref $_[0] ? CORE::die $_[0] : Mojo::Exception-&gt;throw(shift) };
  $c-&gt;helpers-&gt;reply-&gt;exception($@) unless eval { $next-&gt;(); 1 };
}

1;

=encoding utf8

=head1 NAME

Mojolicious - Real-time web framework

=head1 SYNOPSIS

  # Application
  package MyApp;
  use Mojo::Base 'Mojolicious';

  # Route
  sub startup {
    my $self = shift;
    $self-&gt;routes-&gt;get('/hello')-&gt;to('foo#hello');
  }

  # Controller
  package MyApp::Controller::Foo;
  use Mojo::Base 'Mojolicious::Controller';

  # Action
  sub hello {
    my $self = shift;
    $self-&gt;render(text =&gt; 'Hello World!');
  }

=head1 DESCRIPTION

An amazing real-time web framework built on top of the powerful L&lt;Mojo&gt; web
development toolkit. With support for RESTful routes, plugins, commands,
Perl-ish templates, content negotiation, session management, form validation,
testing framework, static file server, C&lt;CGI&gt;/C&lt;PSGI&gt; detection, first class
Unicode support and much more for you to discover.

Take a look at our excellent documentation in L&lt;Mojolicious::Guides&gt;!

=head1 HOOKS

L&lt;Mojolicious&gt; will emit the following hooks in the listed order.

=head2 before_server_start

Emitted right before the application server is started, for web servers that
support it, which includes all the built-in ones (except for
L&lt;Mojo::Server::CGI&gt;). Note that this hook is EXPERIMENTAL and might change
without warning!

  $app-&gt;hook(before_server_start =&gt; sub {
    my ($server, $app) = @_;
    ...
  });

Useful for reconfiguring application servers dynamically or collecting server
diagnostics information. (Passed the server and application objects)

=head2 after_build_tx

Emitted right after the transaction is built and before the HTTP request gets
parsed.

  $app-&gt;hook(after_build_tx =&gt; sub {
    my ($tx, $app) = @_;
    ...
  });

This is a very powerful hook and should not be used lightly, it makes some
rather advanced features such as upload progress bars possible. Note that this
hook will not work for embedded applications, because only the host application
gets to build transactions. (Passed the transaction and application objects)

=head2 around_dispatch

Emitted right after a new request has been received and wraps around the whole
dispatch process, so you have to manually forward to the next hook if you want
to continue the chain. Default exception handling with
L&lt;Mojolicious::Plugin::DefaultHelpers/"reply-E&lt;gt&gt;exception"&gt; is the first hook
in the chain and a call to L&lt;/"dispatch"&gt; the last, yours will be in between.

  $app-&gt;hook(around_dispatch =&gt; sub {
    my ($next, $c) = @_;
    ...
    $next-&gt;();
    ...
  });

This is a very powerful hook and should not be used lightly, it allows you to,
for example, customize application-wide exception handling, consider it the
sledgehammer in your toolbox. (Passed a callback leading to the next hook and
the default controller object)

=head2 before_dispatch

Emitted right before the static file server and router start their work.

  $app-&gt;hook(before_dispatch =&gt; sub {
    my $c = shift;
    ...
  });

Very useful for rewriting incoming requests and other preprocessing tasks.
(Passed the default controller object)

=head2 after_static

Emitted after a static file response has been generated by the static file
server.

  $app-&gt;hook(after_static =&gt; sub {
    my $c = shift;
    ...
  });

Mostly used for post-processing static file responses. (Passed the default
controller object)

=head2 before_routes

Emitted after the static file server determined if a static file should be
served and before the router starts its work.

  $app-&gt;hook(before_routes =&gt; sub {
    my $c = shift;
    ...
  });

Mostly used for custom dispatchers and collecting metrics. (Passed the default
controller object)

=head2 around_action

Emitted right before an action gets executed and wraps around it, so you have to
manually forward to the next hook if you want to continue the chain. Default
action dispatching is the last hook in the chain, yours will run before it.

  $app-&gt;hook(around_action =&gt; sub {
    my ($next, $c, $action, $last) = @_;
    ...
    return $next-&gt;();
  });

This is a very powerful hook and should not be used lightly, it allows you for
example to pass additional arguments to actions or handle return values
differently. Note that this hook can trigger more than once for the same
request if there are nested routes. (Passed a callback leading to the next hook,
the current controller object, the action callback and a flag indicating if this
action is an endpoint)

=head2 before_render

Emitted before content is generated by the renderer. Note that this hook can
trigger out of order due to its dynamic nature, and with embedded applications
will only work for the application that is rendering.

  $app-&gt;hook(before_render =&gt; sub {
    my ($c, $args) = @_;
    ...
  });

Mostly used for pre-processing arguments passed to the renderer. (Passed the
current controller object and the render arguments)

=head2 after_render

Emitted after content has been generated by the renderer that will be assigned
to the response. Note that this hook can trigger out of order due to its
dynamic nature, and with embedded applications will only work for the
application that is rendering.

  $app-&gt;hook(after_render =&gt; sub {
    my ($c, $output, $format) = @_;
    ...
  });

Mostly used for post-processing dynamically generated content. (Passed the
current controller object, a reference to the content and the format)

=head2 after_dispatch

Emitted in reverse order after a response has been generated. Note that this
hook can trigger out of order due to its dynamic nature, and with embedded
applications will only work for the application that is generating the response.

  $app-&gt;hook(after_dispatch =&gt; sub {
    my $c = shift;
    ...
  });

Useful for rewriting outgoing responses and other post-processing tasks.
(Passed the current controller object)

=head1 ATTRIBUTES

L&lt;Mojolicious&gt; implements the following attributes.

=head2 commands

  my $commands = $app-&gt;commands;
  $app         = $app-&gt;commands(Mojolicious::Commands-&gt;new);

Command line interface for your application, defaults to a
L&lt;Mojolicious::Commands&gt; object.

  # Add another namespace to load commands from
  push @{$app-&gt;commands-&gt;namespaces}, 'MyApp::Command';

=head2 controller_class

  my $class = $app-&gt;controller_class;
  $app      = $app-&gt;controller_class('Mojolicious::Controller');

Class to be used for the default controller, defaults to
L&lt;Mojolicious::Controller&gt;. Note that this class needs to have already been
loaded before the first request arrives.

=head2 home

  my $home = $app-&gt;home;
  $app     = $app-&gt;home(Mojo::Home-&gt;new);

The home directory of your application, defaults to a L&lt;Mojo::Home&gt; object
which stringifies to the actual path.

  # Portably generate path relative to home directory
  my $path = $app-&gt;home-&gt;child('data', 'important.txt');

=head2 log

  my $log = $app-&gt;log;
  $app    = $app-&gt;log(Mojo::Log-&gt;new);

The logging layer of your application, defaults to a L&lt;Mojo::Log&gt; object. The
level will default to C&lt;debug&gt; if the L&lt;/mode&gt; is C&lt;development&gt;, or C&lt;info&gt;
otherwise. All messages will be written to C&lt;STDERR&gt;, or a C&lt;log/$mode.log&gt; file
if a C&lt;log&gt; directory exists.

  # Log debug message
  $app-&gt;log-&gt;debug('It works');

=head2 max_request_size

  my $max = $app-&gt;max_request_size;
  $app    = $app-&gt;max_request_size(16777216);

Maximum request size in bytes, defaults to the value of
L&lt;Mojo::Message/"max_message_size"&gt;. Setting the value to C&lt;0&gt; will allow
requests of indefinite size. Note that increasing this value can also
drastically increase memory usage, should you for example attempt to parse an
excessively large request body with the methods L&lt;Mojo::Message/"dom"&gt; or
L&lt;Mojo::Message/"json"&gt;.

=head2 mode

  my $mode = $app-&gt;mode;
  $app     = $app-&gt;mode('production');

The operating mode for your application, defaults to a value from the
C&lt;MOJO_MODE&gt; and C&lt;PLACK_ENV&gt; environment variables or C&lt;development&gt;.

=head2 moniker

  my $moniker = $app-&gt;moniker;
  $app        = $app-&gt;moniker('foo_bar');

Moniker of this application, often used as default filename for configuration
files and the like, defaults to decamelizing the application class with
L&lt;Mojo::Util/"decamelize"&gt;.

=head2 plugins

  my $plugins = $app-&gt;plugins;
  $app        = $app-&gt;plugins(Mojolicious::Plugins-&gt;new);

The plugin manager, defaults to a L&lt;Mojolicious::Plugins&gt; object. See the
L&lt;/"plugin"&gt; method below if you want to load a plugin.

  # Add another namespace to load plugins from
  push @{$app-&gt;plugins-&gt;namespaces}, 'MyApp::Plugin';

=head2 renderer

  my $renderer = $app-&gt;renderer;
  $app         = $app-&gt;renderer(Mojolicious::Renderer-&gt;new);

Used to render content, defaults to a L&lt;Mojolicious::Renderer&gt; object. For more
information about how to generate content see
L&lt;Mojolicious::Guides::Rendering&gt;.

  # Add another "templates" directory
  push @{$app-&gt;renderer-&gt;paths}, '/home/sri/templates';

  # Add another "templates" directory with higher precedence
  unshift @{$app-&gt;renderer-&gt;paths}, '/home/sri/themes/blue/templates';

  # Add another class with templates in DATA section
  push @{$app-&gt;renderer-&gt;classes}, 'Mojolicious::Plugin::Fun';

=head2 routes

  my $routes = $app-&gt;routes;
  $app       = $app-&gt;routes(Mojolicious::Routes-&gt;new);

The router, defaults to a L&lt;Mojolicious::Routes&gt; object. You use this in your
startup method to define the url endpoints for your application.

  # Add routes
  my $r = $app-&gt;routes;
  $r-&gt;get('/foo/bar')-&gt;to('test#foo', title =&gt; 'Hello Mojo!');
  $r-&gt;post('/baz')-&gt;to('test#baz');

  # Add another namespace to load controllers from
  push @{$app-&gt;routes-&gt;namespaces}, 'MyApp::MyController';

=head2 secrets

  my $secrets = $app-&gt;secrets;
  $app        = $app-&gt;secrets([$bytes]);

Secret passphrases used for signed cookies and the like, defaults to the
L&lt;/"moniker"&gt; of this application, which is not very secure, so you should
change it!!! As long as you are using the insecure default there will be debug
messages in the log file reminding you to change your passphrase. Only the
first passphrase is used to create new signatures, but all of them for
verification. So you can increase security without invalidating all your
existing signed cookies by rotating passphrases, just add new ones to the front
and remove old ones from the back.

  # Rotate passphrases
  $app-&gt;secrets(['new_passw0rd', 'old_passw0rd', 'very_old_passw0rd']);

=head2 sessions

  my $sessions = $app-&gt;sessions;
  $app         = $app-&gt;sessions(Mojolicious::Sessions-&gt;new);

Signed cookie based session manager, defaults to a L&lt;Mojolicious::Sessions&gt;
object. You can usually leave this alone, see
L&lt;Mojolicious::Controller/"session"&gt; for more information about working with
session data.

  # Change name of cookie used for all sessions
  $app-&gt;sessions-&gt;cookie_name('mysession');

=head2 static

  my $static = $app-&gt;static;
  $app       = $app-&gt;static(Mojolicious::Static-&gt;new);

For serving static files from your C&lt;public&gt; directories, defaults to a
L&lt;Mojolicious::Static&gt; object.

  # Add another "public" directory
  push @{$app-&gt;static-&gt;paths}, '/home/sri/public';

  # Add another "public" directory with higher precedence
  unshift @{$app-&gt;static-&gt;paths}, '/home/sri/themes/blue/public';

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

  # Remove built-in favicon
  delete $app-&gt;static-&gt;extra-&gt;{'favicon.ico'};

=head2 types

  my $types = $app-&gt;types;
  $app      = $app-&gt;types(Mojolicious::Types-&gt;new);

Responsible for connecting file extensions with MIME types, defaults to a
L&lt;Mojolicious::Types&gt; object.

  # Add custom MIME type
  $app-&gt;types-&gt;type(twt =&gt; 'text/tweet');

=head2 ua

  my $ua = $app-&gt;ua;
  $app   = $app-&gt;ua(Mojo::UserAgent-&gt;new);

A full featured HTTP user agent for use in your applications, defaults to a
L&lt;Mojo::UserAgent&gt; object.

  # Perform blocking request
  say $app-&gt;ua-&gt;get('example.com')-&gt;result-&gt;body;

=head2 validator

  my $validator = $app-&gt;validator;
  $app          = $app-&gt;validator(Mojolicious::Validator-&gt;new);

Validate values, defaults to a L&lt;Mojolicious::Validator&gt; object.

  # Add validation check
  $app-&gt;validator-&gt;add_check(foo =&gt; sub {
    my ($v, $name, $value) = @_;
    return $value ne 'foo';
  });

  # Add validation filter
  $app-&gt;validator-&gt;add_filter(quotemeta =&gt; sub {
    my ($v, $name, $value) = @_;
    return quotemeta $value;
  });

=head1 METHODS

L&lt;Mojolicious&gt; inherits all methods from L&lt;Mojo::Base&gt; and implements the
following new ones.

=head2 build_controller

  my $c = $app-&gt;build_controller;
  my $c = $app-&gt;build_controller(Mojo::Transaction::HTTP-&gt;new);
  my $c = $app-&gt;build_controller(Mojolicious::Controller-&gt;new);

Build default controller object with L&lt;/"controller_class"&gt;.

  # Render template from application
  my $foo = $app-&gt;build_controller-&gt;render_to_string(template =&gt; 'foo');

=head2 build_tx

  my $tx = $app-&gt;build_tx;

Build L&lt;Mojo::Transaction::HTTP&gt; object and emit L&lt;/"after_build_tx"&gt; hook.

=head2 config

  my $hash = $app-&gt;config;
  my $foo  = $app-&gt;config('foo');
  $app     = $app-&gt;config({foo =&gt; 'bar', baz =&gt; 23});
  $app     = $app-&gt;config(foo =&gt; 'bar', baz =&gt; 23);

Application configuration.

  # Remove value
  my $foo = delete $app-&gt;config-&gt;{foo};

  # Assign multiple values at once
  $app-&gt;config(foo =&gt; 'test', bar =&gt; 23);

=head2 defaults

  my $hash = $app-&gt;defaults;
  my $foo  = $app-&gt;defaults('foo');
  $app     = $app-&gt;defaults({foo =&gt; 'bar', baz =&gt; 23});
  $app     = $app-&gt;defaults(foo =&gt; 'bar', baz =&gt; 23);

Default values for L&lt;Mojolicious::Controller/"stash"&gt;, assigned for every new
request.

  # Remove value
  my $foo = delete $app-&gt;defaults-&gt;{foo};

  # Assign multiple values at once
  $app-&gt;defaults(foo =&gt; 'test', bar =&gt; 23);

=head2 dispatch

  $app-&gt;dispatch(Mojolicious::Controller-&gt;new);

The heart of every L&lt;Mojolicious&gt; application, calls the L&lt;/"static"&gt; and
L&lt;/"routes"&gt; dispatchers for every request and passes them a
L&lt;Mojolicious::Controller&gt; object.

=head2 handler

  $app-&gt;handler(Mojo::Transaction::HTTP-&gt;new);
  $app-&gt;handler(Mojolicious::Controller-&gt;new);

Sets up the default controller and emits the L&lt;/"around_dispatch"&gt; hook for
every request.

=head2 helper

  $app-&gt;helper(foo =&gt; sub {...});

Add or replace a helper that will be available as a method of the controller
object and the application object, as well as a function in C&lt;ep&gt; templates. For
a full list of helpers that are available by default see
L&lt;Mojolicious::Plugin::DefaultHelpers&gt; and L&lt;Mojolicious::Plugin::TagHelpers&gt;.

  # Helper
  $app-&gt;helper(cache =&gt; sub { state $cache = {} });

  # Application
  $app-&gt;cache-&gt;{foo} = 'bar';
  my $result = $app-&gt;cache-&gt;{foo};

  # Controller
  $c-&gt;cache-&gt;{foo} = 'bar';
  my $result = $c-&gt;cache-&gt;{foo};

  # Template
  % cache-&gt;{foo} = 'bar';
  %= cache-&gt;{foo}

=head2 hook

  $app-&gt;hook(after_dispatch =&gt; sub {...});

Extend L&lt;Mojolicious&gt; with hooks, which allow code to be shared with all
requests indiscriminately, for a full list of available hooks see L&lt;/"HOOKS"&gt;.

  # Dispatchers will not run if there's already a response code defined
  $app-&gt;hook(before_dispatch =&gt; sub {
    my $c = shift;
    $c-&gt;render(text =&gt; 'Skipped static file server and router!')
      if $c-&gt;req-&gt;url-&gt;path-&gt;to_route =~ /do_not_dispatch/;
  });

=head2 new

  my $app = Mojolicious-&gt;new;
  my $app = Mojolicious-&gt;new(moniker =&gt; 'foo_bar');
  my $app = Mojolicious-&gt;new({moniker =&gt; 'foo_bar'});

Construct a new L&lt;Mojolicious&gt; application and call L&lt;/"startup"&gt;. Will
automatically detect your home directory. Also sets up the renderer, static file
server, a default set of plugins and an L&lt;/"around_dispatch"&gt; hook with the
default exception handling.

=head2 plugin

  $app-&gt;plugin('some_thing');
  $app-&gt;plugin('some_thing', foo =&gt; 23);
  $app-&gt;plugin('some_thing', {foo =&gt; 23});
  $app-&gt;plugin('SomeThing');
  $app-&gt;plugin('SomeThing', foo =&gt; 23);
  $app-&gt;plugin('SomeThing', {foo =&gt; 23});
  $app-&gt;plugin('MyApp::Plugin::SomeThing');
  $app-&gt;plugin('MyApp::Plugin::SomeThing', foo =&gt; 23);
  $app-&gt;plugin('MyApp::Plugin::SomeThing', {foo =&gt; 23});

Load a plugin, for a full list of example plugins included in the
L&lt;Mojolicious&gt; distribution see L&lt;Mojolicious::Plugins/"PLUGINS"&gt;.

=head2 server

  $app-&gt;server(Mojo::Server-&gt;new);

Emits the L&lt;/"before_server_start"&gt; hook. Note that this method is EXPERIMENTAL
and might change without warning!

=head2 start

  $app-&gt;start;
  $app-&gt;start(@ARGV);

Start the command line interface for your application. For a full list of
commands that are available by default see L&lt;Mojolicious::Commands/"COMMANDS"&gt;.
Note that the options C&lt;-h&gt;/C&lt;--help&gt;, C&lt;--home&gt; and C&lt;-m&gt;/C&lt;--mode&gt;, which are
shared by all commands, will be parsed from C&lt;@ARGV&gt; during compile time.

  # Always start daemon
  $app-&gt;start('daemon', '-l', 'http://*:8080');

=head2 startup

  $app-&gt;startup;

This is your main hook into the application, it will be called at application
startup. Meant to be overloaded in a subclass.

  sub startup {
    my $self = shift;
    ...
  }

=head1 AUTOLOAD

In addition to the L&lt;/"ATTRIBUTES"&gt; and L&lt;/"METHODS"&gt; above you can also call
helpers on L&lt;Mojolicious&gt; objects. This includes all helpers from
L&lt;Mojolicious::Plugin::DefaultHelpers&gt; and L&lt;Mojolicious::Plugin::TagHelpers&gt;.
Note that application helpers are always called with a new default controller
object, so they can't depend on or change controller state, which includes
request, response and stash.

  # Call helper
  say $app-&gt;dumper({foo =&gt; 'bar'});

  # Longer version
  say $app-&gt;build_controller-&gt;helpers-&gt;dumper({foo =&gt; 'bar'});

=head1 BUNDLED FILES

The L&lt;Mojolicious&gt; distribution includes a few files with different licenses
that have been bundled for internal use.

=head2 Mojolicious Artwork

  Copyright (C) 2010-2018, Sebastian Riedel.

Licensed under the CC-SA License, Version 4.0
L&lt;http://creativecommons.org/licenses/by-sa/4.0&gt;.

=head2 jQuery

  Copyright (C) jQuery Foundation.

Licensed under the MIT License, L&lt;http://creativecommons.org/licenses/MIT&gt;.

=head2 prettify.js

  Copyright (C) 2006, 2013 Google Inc..

Licensed under the Apache License, Version 2.0
L&lt;http://www.apache.org/licenses/LICENSE-2.0&gt;.

=head1 CODE NAMES

Every major release of L&lt;Mojolicious&gt; has a code name, these are the ones that
have been used in the past.

7.0, C&lt;Doughnut&gt; (U+1F369)

6.0, C&lt;Clinking Beer Mugs&gt; (U+1F37B)

5.0, C&lt;Tiger Face&gt; (U+1F42F)

4.0, C&lt;Top Hat&gt; (U+1F3A9)

3.0, C&lt;Rainbow&gt; (U+1F308)

2.0, C&lt;Leaf Fluttering In Wind&gt; (U+1F343)

1.0, C&lt;Snowflake&gt; (U+2744)

=head1 SPONSORS

Some of the work on this distribution has been sponsored by
L&lt;The Perl Foundation|http://www.perlfoundation.org&gt;, thank you!

=head1 PROJECT FOUNDER

Sebastian Riedel, C&lt;kraih@mojolicious.org&gt;

=head1 CORE DEVELOPERS

Current members of the core team in alphabetical order:

=over 2

Jan Henning Thorsen, C&lt;batman@mojolicious.org&gt;

Joel Berger, C&lt;jberger@mojolicious.org&gt;

Marcus Ramberg, C&lt;marcus@mojolicious.org&gt;

=back

The following members of the core team are currently on hiatus:

=over 2

Abhijit Menon-Sen, C&lt;ams@cpan.org&gt;

Glen Hinkle, C&lt;tempire@cpan.org&gt;

=back

=head1 CREDITS

In alphabetical order:

=over 2

Adam Kennedy

Adriano Ferreira

Al Newkirk

Alex Efros

Alex Salimon

Alexey Likhatskiy

Anatoly Sharifulin

Andre Parker

Andre Vieth

Andreas Jaekel

Andreas Koenig

Andrew Fresh

Andrew Nugged

Andrey Khozov

Andrey Kuzmin

Andy Grundman

Aristotle Pagaltzis

Ashley Dev

Ask Bjoern Hansen

Audrey Tang

Ben Tyler

Ben van Staveren

Benjamin Erhart

Bernhard Graf

Breno G. de Oliveira

Brian Duggan

Brian Medley

Burak Gursoy

Ch Lamprecht

Charlie Brady

Chas. J. Owens IV

Chase Whitener

Christian Hansen

chromatic

Curt Tilmes

Dan Book

Daniel Kimsey

Daniel Mantovani

Danijel Tasov

Danny Thomas

David Davis

David Webb

Diego Kuperman

Dmitriy Shalashov

Dmitry Konstantinov

Dominik Jarmulowicz

Dominique Dumont

Dotan Dimet

Douglas Christopher Wilson

Ettore Di Giacinto

Eugen Konkov

Eugene Toropov

Flavio Poletti

Gisle Aas

Graham Barr

Graham Knop

Henry Tang

Hideki Yamamura

Hiroki Toyokawa

Ian Goodacre

Ilya Chesnokov

James Duncan

Jan Jona Javorsek

Jan Schmidt

Jaroslav Muhin

Jesse Vincent

Johannes Plunien

John Kingsley

Jonathan Yu

Josh Leder

Kazuhiro Shibuya

Kevin Old

Kitamura Akatsuki

Klaus S. Madsen

Knut Arne Bjorndal

Lars Balker Rasmussen

Lee Johnson

Leon Brocard

Magnus Holm

Maik Fischer

Mark Fowler

Mark Grimes

Mark Stosberg

Marty Tennison

Matt S Trout

Matthew Lineen

Maksym Komar

Maxim Vuets

Michael Gregorowicz

Michael Harris

Mike Magowan

Mirko Westermeier

Mons Anderson

Moritz Lenz

Neil Watkiss

Nic Sandfield

Nils Diewald

Oleg Zhelo

Olivier Mengue

Pascal Gaudette

Paul Evans

Paul Robins

Paul Tomlin

Pavel Shaydo

Pedro Melo

Peter Edwards

Pierre-Yves Ritschard

Piotr Roszatycki

Quentin Carbonneaux

Rafal Pocztarski

Randal Schwartz

Richard Elberger

Rick Delaney

Robert Hicks

Robin Lee

Roland Lammel

Roy Storey

Ryan Jendoubi

Salvador Fandino

Santiago Zarate

Sascha Kiefer

Scott Wiersdorf

Sergey Zasenko

Simon Bertrang

Simone Tampieri

Shu Cho

Skye Shaw

Stanis Trendelenburg

Steffen Ullrich

Stephan Kulow

Stephane Este-Gracias

Stevan Little

Steve Atkins

Tatsuhiko Miyagawa

Terrence Brannon

Tianon Gravi

Tomas Znamenacek

Tudor Constantin

Ulrich Habel

Ulrich Kautz

Uwe Voelker

Viacheslav Tykhanovskyi

Victor Engmark

Viliam Pucik

Wes Cravens

William Lindley

Yaroslav Korshak

Yuki Kimoto

Zak B. Elep

Zoffix Znet

=back

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008-2018, Sebastian Riedel and others.

This program is free software, you can redistribute it and/or modify it under
the terms of the Artistic License version 2.0.

=head1 SEE ALSO

L&lt;https://github.com/kraih/mojo&gt;, L&lt;Mojolicious::Guides&gt;,
L&lt;https://mojolicious.org&gt;.

=cut
</pre></body></html>