cgi.pl-> nph-cgi.pl
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Request.pm
CommitLineData
fc7ec1d9 1package Catalyst::Request;
2
3use strict;
4use 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 = \&parameters;
13
14=head1 NAME
15
16Catalyst::Request - Catalyst Request Class
17
18=head1 SYNOPSIS
19
20See L<Catalyst>.
21
22=head1 DESCRIPTION
23
24The Catalyst Request.
25
26=head2 METHODS
27
28=head3 action
29
30Contains the action.
31
32 print $c->request->action;
33
0556eb49 34=head3 address
35
36Contains the remote address.
37
38 print $c->request->address
39
fc7ec1d9 40=head3 arguments (args)
41
42Returns an arrayref containing the arguments.
43
44 print $c->request->arguments->[0];
45
46=head3 base
47
48Contains the uri base.
49
50=head3 cookies
51
52Returns a hashref containing the cookies.
53
54 print $c->request->cookies->{mycookie}->value;
55
56=head3 headers
57
58Returns a L<HTTP::Headers> object containing the headers.
59
60 print $c->request->headers->header('X-Catalyst');
61
0556eb49 62=head3 hostname
63
64Contains the remote hostname.
65
66 print $c->request->hostname
67
fc7ec1d9 68=head3 match
69
70Contains the match.
71
72 print $c->request->match;
73
74=head3 parameters (params)
75
76Returns a hashref containing the parameters.
77
78 print $c->request->parameters->{foo};
79
80=head3 path
81
82Contains the path.
83
84 print $c->request->path;
85
86=head3 method
87
88Contains the request method.
89
90 print $c->request->method
91
92=head3 snippets
93
94Returns an arrayref containing regex snippets.
95
96 my @snippets = @{ $c->request->snippets };
97
98=head3 uploads
99
100Returns 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
110Sebastian Riedel, C<sri@cpan.org>
111
112=head1 COPYRIGHT
113
114This program is free software, you can redistribute it and/or modify it under
115the same terms as Perl itself.
116
117=cut
118
1191;