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
21 $resp->content_encoding;
22 $resp->content_length;
31 See also L<Catalyst::Application>.
35 This is the Catalyst Response class, which provides a set of accessors
44 Shortcut for $resp->output.
46 =item $resp->content_encoding
48 Shortcut to $resp->headers->content_encoding
50 =item $resp->content_length
52 Shortcut to $resp->headers->content_length
54 =item $resp->content_type
56 Shortcut to $resp->headers->content_type
60 Returns a reference to a hash containing the cookies to be set.
62 $c->response->cookies->{foo} = { value => '123' };
66 Shortcut to $resp->headers->header
70 Returns a L<HTTP::Headers> object containing the headers.
72 $c->response->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
74 =item $resp->output($text)
76 Contains the final output.
78 $c->response->output('Catalyst rocks!');
80 =item $resp->redirect($url)
82 Contains a location to redirect to.
84 $c->response->redirect('http://slashdot.org');
88 Contains the HTTP status.
90 $c->response->status(404);
96 Sebastian Riedel, C<sri@cpan.org>
97 Marcus Ramberg, C<mramberg@cpan.org>
101 This program is free software, you can redistribute it and/or modify
102 it under the same terms as Perl itself.