The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Prancer::Request

SYNOPSIS

    sub handler {
        my ($self, $env, $request, $response, $session) = @_;

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

            ...

            return $response->finalize(200);
        }
    }

METHODS

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.

headers

Returns an HTTP::Headers::Fast 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 in a list.

params

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

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 in a list.

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 ]);