The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Controller - Controller Base Class

SYNOPSIS

    use base 'Mojolicious::Controller';

DESCRIPTION

Mojolicous::Controller is a controller base class.

ATTRIBUTES

Mojolicious::Controller inherits all attributes from MojoX::Dispatcher::Routes::Controller.

METHODS

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');