App::Request - the request
# ... official way to get a Request object ... use App; $context = App->context(); $request = $context->request(); # get the request # ... alternative way (used internally) ... use App::Request; $request = App::Request->new();
A Request class ...
The following classes might be a part of the Request Class Group.
Class: App::Request
Class: App::Request::CGI
The App::Request->new() method is rarely called directly. That is because the current request is usually accessed through the $context object.
* Signature: $request = App::Request->new($context, $named); * Return: $request App::Request * Throws: App::Exception * Since: 0.01 Sample Usage: $request = App::Request->new();
The following methods are intended to be called by subclasses of the current class (or environmental, "main" code).
The _init() method is called from within the standard Request constructor. The _init() method in this class does nothing. It allows subclasses of the Request to customize the behavior of the constructor by overriding the _init() method.
* Signature: $request->_init() * Param: void * Return: void * Throws: App::Exception * Since: 0.01 Sample Usage: $request->_init();
The user() method returns the username of the authenticated user. The special name, "guest", refers to the unauthenticated (anonymous) user.
* Signature: $username = $request->user(); * Param: void * Return: string * Throws: <none> * Since: 0.01 Sample Usage: $username = $request->user();
Returns the HTTP method used in this request (i.e. "GET" or "POST").
* Signature: $http_method = $request->http_method(); * Param: void * Return: string * Throws: <none> * Since: 0.01 Sample Usage: $http_method = $request->http_method();
Returns the content_type of data submitted in a POST, generally "multipart/form-data" or "application/x-www-form-urlencoded".
* Signature: $content_type = $request->content_type(); * Param: void * Return: string * Throws: <none> * Since: 0.01 Sample Usage: $content_type = $request->content_type();
The get_session_id() method returns the session_id in the request.
* Signature: $session_id = $request->get_session_id(); * Param: void * Return: $session_id string * Throws: <none> * Since: 0.01 Sample Usage: $session_id = $request->get_session_id();
To install App::Context, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Context
CPAN shell
perl -MCPAN -e shell install App::Context
For more information on module installation, please visit the detailed CPAN module installation guide.