Prancer::Request
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); } }
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.
SCRIPT_NAME
PATH_INFO
QUERY_STRING
HTTP_HOST
SERVER_NAME
SERVER_PORT
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.
uri
Contains the request method (GET, POST, HEAD, etc).
GET
POST
HEAD
Returns the protocol (HTTP/1.0 or HTTP/1.1) used for the current request.
HTTP/1.0
HTTP/1.1
Returns the scheme (http or https) of the request.
http
https
Returns true or false, indicating whether the connection is secure (https).
Returns PATH_INFO in the environment but returns / in case it is empty.
Returns a handle to the input stream.
Returns the IP address of the client (REMOTE_ADDR).
REMOTE_ADDR
Returns REMOTE_USER if it's set.
REMOTE_USER
Returns an HTTP::Headers::Fast object containing the headers for the current request.
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.
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.
Returns an Hash::MultiValue containing all cookies.
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.
Returns an Hash::MultiValue containing all uploads.
Generates a URL to a new location in an easy to use manner. For example:
my $link = $request->uri_for("/logout", [ signoff => 1 ]);
To install Prancer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Prancer
CPAN shell
perl -MCPAN -e shell install Prancer
For more information on module installation, please visit the detailed CPAN module installation guide.