1 package Catalyst::Response;
4 use base 'Class::Accessor::Fast';
6 __PACKAGE__->mk_accessors(qw/cookies headers output redirect status/);
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(@_) }
15 Catalyst::Response - Catalyst Response Class
20 $resp->content_encoding;
21 $resp->content_length;
30 See also L<Catalyst::Application>.
34 This is the Catalyst Response class, which provides a set of accessors
41 =item $resp->content_encoding
43 Shortcut to $resp->headers->content_encoding
45 =item $resp->content_length
47 Shortcut to $resp->headers->content_length
49 =item $resp->content_type
51 Shortcut to $resp->headers->content_type
55 Returns a reference to a hash containing the cookies to be set.
57 $c->response->cookies->{foo} = { value => '123' };
61 Shortcut to $resp->headers->header
65 Returns a L<HTTP::Headers> object containing the headers.
67 $c->response->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
69 =item $resp->output($text)
71 Contains the final output.
73 $c->response->output('Catalyst rocks!');
75 =item $resp->redirect($url)
77 Contains a location to redirect to.
79 $c->response->redirect('http://slashdot.org');
83 Contains the HTTP status.
85 $c->response->status(404);
91 Sebastian Riedel, C<sri@cpan.org>
92 Marcus Ramberg, C<mramberg@cpan.org>
96 This program is free software, you can redistribute it and/or modify
97 it under the same terms as Perl itself.