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