Commit | Line | Data |
fc7ec1d9 |
1 | package Catalyst::Response; |
2 | |
3 | use strict; |
4 | use base 'Class::Accessor::Fast'; |
5 | |
6 | __PACKAGE__->mk_accessors(qw/cookies headers output redirect status/); |
7 | |
8 | =head1 NAME |
9 | |
10 | Catalyst::Response - Catalyst Response Class |
11 | |
12 | =head1 SYNOPSIS |
13 | |
b22c6668 |
14 | $resp = $c->response; |
15 | $resp->cookies; |
16 | $resp->headers; |
17 | $resp->output; |
18 | $resp->redirect; |
19 | $resp->status; |
20 | |
21 | See also L<Catalyst::Application>. |
fc7ec1d9 |
22 | |
23 | =head1 DESCRIPTION |
24 | |
b22c6668 |
25 | This is the Catalyst Response class, which provides a set of accessors to |
26 | response data. |
27 | |
28 | =head1 METHODS |
fc7ec1d9 |
29 | |
b22c6668 |
30 | =over 4 |
fc7ec1d9 |
31 | |
b22c6668 |
32 | =item $resp->cookies |
fc7ec1d9 |
33 | |
b22c6668 |
34 | Returns a reference to a hash containing the cookies. |
fc7ec1d9 |
35 | |
36 | $c->response->cookies->{foo} = { value => '123' }; |
37 | |
b22c6668 |
38 | =item $resp->headers |
fc7ec1d9 |
39 | |
40 | Returns a L<HTTP::Headers> object containing the headers. |
41 | |
42 | $c->response->headers->header( 'X-Catalyst' => $Catalyst::VERSION ); |
43 | |
b22c6668 |
44 | =item $resp->output($text) |
fc7ec1d9 |
45 | |
46 | Contains the final output. |
47 | |
48 | $c->response->output('Catalyst rockz!'); |
49 | |
b22c6668 |
50 | =item $resp->redirect($url) |
fc7ec1d9 |
51 | |
52 | Contains a location to redirect to. |
53 | |
54 | $c->response->redirect('http://slashdot.org'); |
55 | |
b22c6668 |
56 | =item status |
fc7ec1d9 |
57 | |
58 | Contains the HTTP status. |
59 | |
60 | $c->response->status(404); |
61 | |
b22c6668 |
62 | =back |
63 | |
fc7ec1d9 |
64 | =head1 AUTHOR |
65 | |
66 | Sebastian Riedel, C<sri@cpan.org> |
67 | |
68 | =head1 COPYRIGHT |
69 | |
70 | This program is free software, you can redistribute it and/or modify it under |
71 | the same terms as Perl itself. |
72 | |
73 | =cut |
74 | |
75 | 1; |