HTTP::Engine::Request - Portable HTTP request object
# normally a request object is passed into your handler sub handle_request { my $req = shift; };
HTTP::Engine::Request provides a consistent API for request objects across web server enviroments.
HTTP::Engine::Request->new( request_builder => $BUILDER, _connection => { env => \%ENV, input_handle => \*STDIN, output_handle => \*STDOUT, }, %args );
Normally, new() is not called directly, but a pre-built HTTP::Engine::Request object is passed for you into your request handler. You may build your own, following the example above. The $BUILDER may be one of HTTP::Engine::RequestBuilder::CGI or HTTP::Engine::RequestBuilder::NoEnv.
$BUILDER
Returns the IP address of the client.
Returns a reference to a hash containing the cookies
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.
Returns the request uri (like $ENV{REQUEST_URI})
Returns a reference to a hash containing query string (GET) parameters. Values can be either a scalar or an arrayref containing scalars.
Returns true or false, indicating whether the connection is secure (https).
Returns undef or uri, if it is proxy request, uri of a connection place is returned.
Returns a URI object for the current request. Stringifies to the URI text.
Returns REMOTE_USER.
Returns string containing body(POST).
Returns an HTTP::Headers object containing the headers for the current request.
Contains the URI base. This will always have a trailing slash.
Returns the hostname of the client.
Returns an HTTP::Body object.
Returns a reference to a hash containing GET and POST parameters. Values can be either a scalar or an arrayref containing scalars.
Returns a reference to a hash containing uploads. Values can be either a HTTP::Engine::Request::Upload object, or an arrayref of HTTP::Engine::Request::Upload objects.
Shortcut to $req->headers->content_encoding.
Shortcut to $req->headers->content_length.
Shortcut to $req->headers->content_type.
Shortcut to $req->headers->header.
Shortcut to $req->headers->referer.
Shortcut to $req->headers->user_agent.
A convenient method to access $req->cookies.
$cookie = $req->cookie('name'); @cookies = $req->cookie;
Returns GET and POST parameters with a CGI.pm-compatible param method. This is an alternative method for accessing parameters in $req->parameters.
$value = $req->param( 'foo' ); @values = $req->param( 'foo' ); @params = $req->param;
Like CGI, and unlike earlier versions of Catalyst, passing multiple arguments to this method, like this:
$req->param( 'foo', 'bar', 'gorch', 'quxx' );
will set the parameter foo to the multiple values bar, gorch and quxx. Previously this would have added bar as another value to foo (creating it if it didn't exist before), and quxx as another value for gorch.
foo
bar
gorch
quxx
Returns the path, i.e. the part of the URI after $req->base, for the current request.
A convenient method to access $req->uploads.
$upload = $req->upload('field'); @uploads = $req->upload('field'); @fields = $req->upload; for my $upload ( $req->upload('field') ) { print $upload->filename; }
Returns a rewritten URI object for the current request. Key/value pairs passed in will override existing parameters. Unmodified pairs will be preserved.
convert HTTP::Engine::Request to HTTP::Request.
convert $location to absolute uri.
Kazuhiro Osawa and HTTP::Engine Authors.
Catalyst::Request
HTTP::Request, Catalyst::Request
To install HTTP::Engine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::Engine
CPAN shell
perl -MCPAN -e shell install HTTP::Engine
For more information on module installation, please visit the detailed CPAN module installation guide.