Commit | Line | Data |
fc7ec1d9 |
1 | package Catalyst::Request; |
2 | |
3 | use strict; |
4 | use base 'Class::Accessor::Fast'; |
5 | |
6 | __PACKAGE__->mk_accessors( |
7 | qw/action arguments base cookies headers match method parameters path |
5ddd05a0 |
8 | snippets uploads/ |
fc7ec1d9 |
9 | ); |
10 | |
11 | *args = \&arguments; |
12 | *params = \¶meters; |
13 | |
14 | =head1 NAME |
15 | |
16 | Catalyst::Request - Catalyst Request Class |
17 | |
18 | =head1 SYNOPSIS |
19 | |
20 | See L<Catalyst>. |
21 | |
22 | =head1 DESCRIPTION |
23 | |
24 | The Catalyst Request. |
25 | |
26 | =head2 METHODS |
27 | |
28 | =head3 action |
29 | |
30 | Contains the action. |
31 | |
32 | print $c->request->action; |
33 | |
34 | =head3 arguments (args) |
35 | |
36 | Returns an arrayref containing the arguments. |
37 | |
38 | print $c->request->arguments->[0]; |
39 | |
40 | =head3 base |
41 | |
42 | Contains the uri base. |
43 | |
44 | =head3 cookies |
45 | |
46 | Returns a hashref containing the cookies. |
47 | |
48 | print $c->request->cookies->{mycookie}->value; |
49 | |
50 | =head3 headers |
51 | |
52 | Returns a L<HTTP::Headers> object containing the headers. |
53 | |
54 | print $c->request->headers->header('X-Catalyst'); |
55 | |
56 | =head3 match |
57 | |
58 | Contains the match. |
59 | |
60 | print $c->request->match; |
61 | |
62 | =head3 parameters (params) |
63 | |
64 | Returns a hashref containing the parameters. |
65 | |
66 | print $c->request->parameters->{foo}; |
67 | |
68 | =head3 path |
69 | |
70 | Contains the path. |
71 | |
72 | print $c->request->path; |
73 | |
74 | =head3 method |
75 | |
76 | Contains the request method. |
77 | |
78 | print $c->request->method |
79 | |
80 | =head3 snippets |
81 | |
82 | Returns an arrayref containing regex snippets. |
83 | |
84 | my @snippets = @{ $c->request->snippets }; |
85 | |
86 | =head3 uploads |
87 | |
88 | Returns a hashref containing the uploads. |
89 | |
7833fdfc |
90 | my $filename = $c->req->parameters->{foo}; |
91 | print $c->request->uploads->{$filename}->type; |
92 | print $c->request->uploads->{$filename}->size; |
93 | my $fh = $c->request->uploads->{$filename}->fh; |
94 | my $content = do { local $/; <$fh> }; |
fc7ec1d9 |
95 | |
96 | =head1 AUTHOR |
97 | |
98 | Sebastian Riedel, C<sri@cpan.org> |
99 | |
100 | =head1 COPYRIGHT |
101 | |
102 | This program is free software, you can redistribute it and/or modify it under |
103 | the same terms as Perl itself. |
104 | |
105 | =cut |
106 | |
107 | 1; |