Prancer::Request(3)

NAME
Prancer::Request

SYNOPSIS
    sub handle {
        my $self = shift;

        my $request = context->request();
        my $path = $request->path();
        my $cookie = $request->cookie("foo");
        my $param = $request->param("bar");
        my $cookie_names = $request->cookie();
        my $user_agent = $request->header("user-agent");

        ...
    }

ATTRIBUTES

uri Returns an URI object for the current request. The URI is constructed using various environment values such as "SCRIPT_NAME", "PATH_INFO", "QUERY_STRING", "HTTP_HOST", "SERVER_NAME" and "SERVER_PORT".

base
    Returns a URI object for the base path of current request. This is like "uri" but only contains up to "SCRIPT_NAME" where your application is hosted at.

method
    Contains the request method ("GET", "POST", "HEAD", etc).

protocol
    Returns the protocol ("HTTP/1.0" or "HTTP/1.1") used for the current request.

scheme
    Returns the scheme ("http" or "https") of the request.

secure
    Returns true or false, indicating whether the connection is secure ("https").

path
    Returns PATH_INFO in the environment but returns / in case it is empty.

body
    Returns a handle to the input stream.

address
    Returns the IP address of the client ("REMOTE_ADDR").

user
    Returns "REMOTE_USER" if it's set.

header
    When called with no arguments this will return a list of all header names. When called in scalar context this will return the last value for the given key. When called in list context this will return all values for the given key.

headers
    Returns an HTTP::Headers object containing the headers for the current request.

param
    When called with no arguments this will return a list of all parameter names. When called in scalar context this will return the last value for the given key. When called in list context this will return all values for the given key.

params
    Returns a Hash::MultiValue hash reference containing the merged GET and POST parameters.

cookie
    When called with no arguments this will return a list of all cookie names. When called in scalar context this will return the last cookie for the given key. When called in list context this will return all cookies for the given key. A cookie should look like this:

        {
            'name' => 'foo',
            'value' => 'bar',
        }

cookies
    Returns an Hash::MultiValue containing all cookies.

upload
    When called with no arguments this will return a list of all upload names. When called in scalar context this will return the last Prancer::Request::Upload object for the given key. When called in list context this will return all Prancer::Request::Upload objects for the given key.

uploads
    Returns an Hash::MultiValue containing all uploads.

uri_for
    Generates a URL to a new location in an easy to use manner. For example:

        my $link = $request->uri_for('/logout', [ signoff => 1 ]);