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