MojoX::Controller - Controller Base Class
use base 'MojoX::Controller';
MojoX::Controller is an abstract controllers base class.
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.
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.
$c-
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};
Mojolicious, Mojolicious::Book, http://mojolicious.org.
To install Mojolicious, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious
CPAN shell
perl -MCPAN -e shell install Mojolicious
For more information on module installation, please visit the detailed CPAN module installation guide.