Commit | Line | Data |
fc7ec1d9 |
1 | package Catalyst::Request; |
2 | |
3 | use strict; |
4 | use base 'Class::Accessor::Fast'; |
5 | |
6 | __PACKAGE__->mk_accessors( |
0556eb49 |
7 | qw/action address arguments base cookies headers hostname match method |
8 | parameters path 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 | |
0556eb49 |
34 | =head3 address |
35 | |
36 | Contains the remote address. |
37 | |
38 | print $c->request->address |
39 | |
fc7ec1d9 |
40 | =head3 arguments (args) |
41 | |
42 | Returns an arrayref containing the arguments. |
43 | |
44 | print $c->request->arguments->[0]; |
45 | |
46 | =head3 base |
47 | |
48 | Contains the uri base. |
49 | |
50 | =head3 cookies |
51 | |
52 | Returns a hashref containing the cookies. |
53 | |
54 | print $c->request->cookies->{mycookie}->value; |
55 | |
56 | =head3 headers |
57 | |
58 | Returns a L<HTTP::Headers> object containing the headers. |
59 | |
60 | print $c->request->headers->header('X-Catalyst'); |
61 | |
0556eb49 |
62 | =head3 hostname |
63 | |
64 | Contains the remote hostname. |
65 | |
66 | print $c->request->hostname |
67 | |
fc7ec1d9 |
68 | =head3 match |
69 | |
70 | Contains the match. |
71 | |
72 | print $c->request->match; |
73 | |
74 | =head3 parameters (params) |
75 | |
76 | Returns a hashref containing the parameters. |
77 | |
78 | print $c->request->parameters->{foo}; |
79 | |
80 | =head3 path |
81 | |
82 | Contains the path. |
83 | |
84 | print $c->request->path; |
85 | |
86 | =head3 method |
87 | |
88 | Contains the request method. |
89 | |
90 | print $c->request->method |
91 | |
92 | =head3 snippets |
93 | |
94 | Returns an arrayref containing regex snippets. |
95 | |
96 | my @snippets = @{ $c->request->snippets }; |
97 | |
98 | =head3 uploads |
99 | |
100 | Returns a hashref containing the uploads. |
101 | |
7833fdfc |
102 | my $filename = $c->req->parameters->{foo}; |
0ea0c2c3 |
103 | print $c->request->uploads->{$filename}->{type}; |
104 | print $c->request->uploads->{$filename}->{size}; |
105 | my $fh = $c->request->uploads->{$filename}->{fh}; |
7833fdfc |
106 | my $content = do { local $/; <$fh> }; |
fc7ec1d9 |
107 | |
108 | =head1 AUTHOR |
109 | |
110 | Sebastian Riedel, C<sri@cpan.org> |
111 | |
112 | =head1 COPYRIGHT |
113 | |
114 | This program is free software, you can redistribute it and/or modify it under |
115 | the same terms as Perl itself. |
116 | |
117 | =cut |
118 | |
119 | 1; |