Mojolicious - Web Framework
use base 'Mojolicious'; sub startup { my $self = shift; my $r = $self->routes; $r->route('/:controller/:action') ->to(controller => 'foo', action => 'bar'); }
Mojolicous is a web framework built upon Mojo.
See Mojo::Manual::Mojolicious for user friendly documentation.
Mojolicious inherits all attributes from Mojo and implements the following new ones.
mode
my $mode = $mojo->mode; $mojo = $mojo->mode('production');
Returns the current mode if called without arguments. Returns the invocant if called with arguments. Defaults to $ENV{MOJO_MODE} or development.
$ENV{MOJO_MODE}
development
my $mode = $mojo->mode; if ($mode =~ m/^dev/) { do_debug_output(); }
renderer
my $renderer = $mojo->renderer; $mojo = $mojo->renderer(Mojolicious::Renderer->new);
routes
my $routes = $mojo->routes; $mojo = $mojo->routes(Mojolicious::Dispatcher->new);
static
my $static = $mojo->static; $mojo = $mojo->static(MojoX::Dispatcher::Static->new);
types
my $types = $mojo->types; $mojo = $mojo->types(MojoX::Types->new)
Mojolicious inherits all methods from Mojo and implements the following new ones.
new
my $mojo = Mojolicious->new;
Returns a new Mojolicious object. This method will call the method ${mode}_mode if it exists. ($mode being the value of the attribute mode). For example in production mode, production_mode will be called.
${mode}_mode
$mode
production_mode
build_ctx
my $c = $mojo->build_ctx($tx);
dispatch
$mojo->dispatch($c);
handler
$tx = $mojo->handler($tx);
startup
$mojo->startup($tx);
To install Mojo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo
CPAN shell
perl -MCPAN -e shell install Mojo
For more information on module installation, please visit the detailed CPAN module installation guide.