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