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 inherits all attributes from MojoX::Controller and implements the following new ones.

tx

my $tx = $c->tx;

The transaction that is currently being processed, defaults to a Mojo::Transaction::HTTP object.

METHODS

MojoX::Session::Cookie::Controller inherits all methods from MojoX::Controller and implements the following ones.

$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 the next 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};
$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.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicious.org.