Provided by: libdancer2-perl_0.11+dfsg-1_all
NAME
Dancer2::Core::Context - handles everything proper to a request's context.
VERSION
version 0.11
ATTRIBUTES
app Reference to the Dancer2::Core::App object for the current application. env Read-only accessor to a PSGI environment hash. request A Dancer2::Core::Request object, built from the PSGI environment variable for this request. response A Dancer2::Core::Response object, used to set content, headers and HTTP status codes. session Handle for the current session object, if any destroyed_session We cache a destroyed session here; once this is set we must not attempt to retrieve the session from the cookie in the request. If no new session is created, this is set (with expiration) as a cookie to force the browser to expire the cookie. with_return Used to cache the coderef from Return::MultiLevel within the dispatcher.
METHODS
vars Returns a hashref of all per-request variables stored in this object. var By-name interface to variables stored in this context object. my $stored = $context->var('some_variable'); returns the value of 'some_variable', while $context->var('some_variable' => 'value'); will set it. cookies Shortcut that dispatches to Dancer2::Core::Request's cookies method. cookie Get a cookie from the request object, or set one in the response object. redirect($destination, $status) Sets a redirect in the response object. If $destination is not an absolute URI, then it will be made into an absolute URI, relative to the URI in the request. halt Flag the response object as 'halted'. If called during request dispatch, immediatly returns the response to the dispatcher and after hooks will not be run. has_session Returns true if session engine has been defined and if either a session object has been instantiated in the context or if a session cookie was found and not subsequently invalidated. destroy_session Destroys the current session and ensures any subsequent session is created from scratch and not from the request session cookie
AUTHOR
Dancer Core Developers
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Alexis Sukrieh. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.