minor bugfixes
[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;
20 $resp->cookies;
21 $resp->headers;
22 $resp->output;
23 $resp->redirect;
24 $resp->status;
25
26See also L<Catalyst::Application>.
fc7ec1d9 27
28=head1 DESCRIPTION
29
b22c6668 30This is the Catalyst Response class, which provides a set of accessors to
31response data.
32
33=head1 METHODS
fc7ec1d9 34
b22c6668 35=over 4
fc7ec1d9 36
b22c6668 37=item $resp->cookies
fc7ec1d9 38
b22c6668 39Returns 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
45Returns 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
51Contains the final output.
52
53 $c->response->output('Catalyst rockz!');
54
b22c6668 55=item $resp->redirect($url)
fc7ec1d9 56
57Contains a location to redirect to.
58
59 $c->response->redirect('http://slashdot.org');
60
b22c6668 61=item status
fc7ec1d9 62
63Contains the HTTP status.
64
65 $c->response->status(404);
66
b22c6668 67=back
68
fc7ec1d9 69=head1 AUTHOR
70
71Sebastian Riedel, C<sri@cpan.org>
72
73=head1 COPYRIGHT
74
75This program is free software, you can redistribute it and/or modify it under
76the same terms as Perl itself.
77
78=cut
79
801;