1 package Catalyst::Request;
4 use base 'Class::Accessor::Fast';
6 __PACKAGE__->mk_accessors(
7 qw/action address arguments base cookies headers hostname match method
8 parameters path snippets uploads/
12 *params = \¶meters;
16 Catalyst::Request - Catalyst Request Class
42 This is the Catalyst Request class, which provides a set of accessors to the
43 request data. The request object is prepared by the specialized Catalyst
44 Engine module thus hiding the details of the particular engine implementation.
55 print $c->request->action;
59 Contains the remote address.
61 print $c->request->address
67 Returns a reference to an array containing the arguments.
69 print $c->request->arguments->[0];
73 Contains the uri base.
77 Returns a reference to a hash containing the cookies.
79 print $c->request->cookies->{mycookie}->value;
83 Returns an L<HTTP::Headers> object containing the headers.
85 print $c->request->headers->header('X-Catalyst');
89 Contains the remote hostname.
91 print $c->request->hostname
97 print $c->request->match;
99 =item $req->parameters
103 Returns a reference to a hash containing the parameters.
105 print $c->request->parameters->{foo};
111 print $c->request->path;
115 Contains the request method (C<GET>, C<POST>, C<HEAD>, etc).
117 print $c->request->method
121 Returns a reference to an array containing regex snippets.
123 my @snippets = @{ $c->request->snippets };
127 Returns a reference to a hash containing the uploads.
129 my $filename = $c->req->parameters->{foo};
130 print $c->request->uploads->{$filename}->{type};
131 print $c->request->uploads->{$filename}->{size};
132 my $fh = $c->request->uploads->{$filename}->{fh};
133 my $content = do { local $/; <$fh> };
139 Sebastian Riedel, C<sri@cpan.org>
143 This program is free software, you can redistribute it and/or modify it under
144 the same terms as Perl itself.