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