Mojolicious::Controller - Controller Base Class
use base 'Mojolicious::Controller';
Mojolicous::Controller is a controller base class.
Mojolicious::Controller inherits all attributes from MojoX::Dispatcher::Routes::Controller.
Mojolicious::Controller inherits all methods from MojoX::Dispatcher::Routes::Controller and implements the following new ones.
client
my $client = $c->client;
param
my $param = $c->param('foo'); my @params = $c->param('foo');
pause
$c->pause;
redirect_to
$c = $c->redirect_to('named'); $c = $c->redirect_to('/path'); $c = $c->redirect_to('http://127.0.0.1/foo/bar');
render
$c->render; $c->render(controller => 'foo', action => 'bar'); $c->render({controller => 'foo', action => 'bar'}); $c->render(text => 'Hello!'); $c->render(template => 'index'); $c->render(template => 'foo/index'); $c->render(template => 'index', format => 'html', handler => 'epl'); $c->render(handler => 'something'); $c->render('foo/bar'); $c->render('foo/bar', format => 'html'); $c->render('foo/bar', {format => 'html'});
render_inner
my $output = $c->render_inner;
render_json
$c->render_json({foo => 'bar'}); $c->render_json([1, 2, -3]);
render_partial
my $output = $c->render_partial; my $output = $c->render_partial(action => 'foo');
render_text
$c->render_text('Hello World!'); $c->render_text('Hello World', layout => 'green');
resume
$c->resume;
url_for
my $url = $c->url_for; my $url = $c->url_for(controller => 'bar', action => 'baz'); my $url = $c->url_for('named', controller => 'bar', action => 'baz');
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.