NAME
MojoX::Controller - Controller Base Class
SYNOPSIS
use base 'MojoX::Controller';
DESCRIPTION
MojoX::Controller is an abstract controllers base class.
ATTRIBUTES
MojoX::Controller implements the following attributes.
app
my $app = $c->app;
$c = $c->app(MojoSubclass->new);
A reference back to the application that dispatched to this controller.
tx
my $tx = $c->tx;
The transaction that is currently being processed.
METHODS
MojoX::Controller inherits all methods from Mojo::Base and implements the following new ones.
req
my $req = $c->req;
Alias for $c-
tx->req>. Usually refers to a Mojo::Message::Request object.
res
my $res = $c->res;
Alias for $c-
tx->res>. Usually refers to a Mojo::Message::Response object.
stash
my $stash = $c->stash;
my $foo = $c->stash('foo');
$c = $c->stash({foo => 'bar'});
$c = $c->stash(foo => 'bar');
Non persistent data storage and exchange.
$c->stash->{foo} = 'bar';
my $foo = $c->stash->{foo};
delete $c->stash->{foo};