Catalyst::Request - Catalyst Request Class


    $req = $c->request;

See also Catalyst.


This is the Catalyst Request class, which provides a set of accessors to the request data. The request object is prepared by the specialized Catalyst Engine module thus hiding the details of the particular engine implementation.



Contains the requested action.

    print $c->request->action;

Contains the remote address.

    print $c->request->address

Shortcut for arguments


Returns a reference to an array containing the arguments.

    print $c->request->arguments->[0];

Contains the url base. This will always have a trailing slash.


Contains the message body of the request unless Content-Type is application/x-www-form-urlencoded or multipart/form-data.

    print $c->request->body

Shortcut to $req->headers->content_encoding


Shortcut to $req->headers->content_length


Shortcut to $req->headers->content_type


Returns a reference to a hash containing the cookies.

    print $c->request->cookies->{mycookie}->value;

Shortcut to $req->headers->header


Returns an HTTP::Headers object containing the headers.

    print $c->request->headers->header('X-Catalyst');

Contains the hostname of the remote user.

    print $c->request->hostname

Shortcut for $req->body.


This contains be the matching part of a regexp action. otherwise it returns the same as 'action'.

    print $c->request->match;

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

    print $c->request->method;

Get request parameters with a like param method.

    $value  = $c->request->param('foo');
    @values = $c->request->param('foo');
    @params = $c->request->param;

Shortcut for $req->parameters.


Returns a reference to a hash containing parameters. Values can be either a scalar or a arrayref containing scalars.

    print $c->request->parameters->{field};
    print $c->request->parameters->{field}->[0];

Contains the path.

    print $c->request->path;

Shortcut to $req->headers->referer. Referring page.


Returns a reference to an array containing regex snippets.

    my @snippets = @{ $c->request->snippets };

A convenient method to $req->uploads.

    $upload  = $c->request->upload('field');
    @uploads = $c->request->upload('field');
    @fields  = $c->request->upload;
    for my $upload ( $c->request->upload('field') ) {
        print $upload->filename;

Returns a reference to a hash containing uploads. Values can be either a hashref or a arrayref containing Catalyst::Request::Upload objects.

    my $upload = $c->request->uploads->{field};
    my $upload = $c->request->uploads->{field}->[0];

Shortcut to $req->headers->user_agent. User Agent version string.


Sebastian Riedel, Marcus Ramberg,


This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.