Sebastian Riedel > Mojo > MojoX::Context

Download:
Mojo-0.9002.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source  

NAME ^

MojoX::Context - Context

SYNOPSIS ^

    use MojoX::Context;

    my $c = MojoX::Context->new;

DESCRIPTION ^

MojoX::Context is a context container.

ATTRIBUTES ^

MojoX::Context implements the following attributes.

app

    my $app = $c->app;
    $c      = $c->app(MojoSubclass->new);

Returns the application instance when called without arguments. Returns the invocant if called with arguments.

req

    my $req = $c->req;

res

    my $res = $c->res;

stash

    my $stash = $c->stash;
    my $foo   = $c->stash('foo');
    $c        = $c->stash({foo => 'bar'});
    $c        = $c->stash(foo => 'bar');

Returns a hash reference if called without arguments. Returns a value if called with a single argument. Returns the invocant if called with a hashref or multiple arguments.

    $c->stash->{foo} = 'bar';
    my $foo = $c->stash->{foo};
    delete $c->stash->{foo};

tx

    my $tx = $c->tx;

METHODS ^

MojoX::Context inherits all methods from Mojo::Base.