NAME
MojoX::Session::Cookie::Controller - Controller Base Class
SYNOPSIS
use base 'MojoX::Session::Cookie::Controller';
DESCRIPTION
MojoX::Session::Cookie::Controller is a controller base class.
ATTRIBUTES
MojoX::Session::Cookie::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::Session::Cookie::Controller inherits all methods from MojoX::Controller and implements the following ones.
cookie
$c = $c->cookie(foo => 'bar');
$c = $c->cookie(foo => 'bar', {path => '/'});
my $value = $c->cookie('foo');
my @values = $c->cookie('foo');
Access request cookie values and create new response cookies.
flash
my $flash = $c->flash;
my $foo = $c->flash('foo');
$c = $c->flash({foo => 'bar'});
$c = $c->flash(foo => 'bar');
Data storage persistent for a single request, stored in the session.
$c->flash->{foo} = 'bar';
my $foo = $c->flash->{foo};
delete $c->flash->{foo};
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.
session
my $session = $c->session;
my $foo = $c->session('foo');
$c = $c->session({foo => 'bar'});
$c = $c->session(foo => 'bar');
Persistent data storage, by default stored in a signed cookie. Note that cookies are generally limited to 4096 bytes of data.
$c->session->{foo} = 'bar';
my $foo = $c->session->{foo};
delete $c->session->{foo};
signed_cookie
$c = $c->signed_cookie(foo => 'bar');
$c = $c->signed_cookie(foo => 'bar', {path => '/'});
my $value = $c->signed_cookie('foo');
my @values = $c->signed_cookie('foo');
Access signed request cookie values and create new signed response cookies. Cookies failing signature verification will be automatically discarded.