1 package Catalyst::Response;
4 use base 'Class::Accessor::Fast';
6 __PACKAGE__->mk_accessors(qw/cookies body headers location status/);
10 sub content_encoding { shift->headers->content_encoding(@_) }
11 sub content_length { shift->headers->content_length(@_) }
12 sub content_type { shift->headers->content_type(@_) }
13 sub header { shift->headers->header(@_) }
17 Catalyst::Response - Catalyst Response Class
23 $resp->content_encoding;
24 $resp->content_length;
33 See also L<Catalyst::Application>.
37 This is the Catalyst Response class, which provides a set of accessors
44 =item $resp->body($text)
46 $c->response->body('Catalyst rocks!');
48 Contains the final output.
50 =item $resp->content_encoding
52 Shortcut to $resp->headers->content_encoding
54 =item $resp->content_length
56 Shortcut to $resp->headers->content_length
58 =item $resp->content_type
60 Shortcut to $resp->headers->content_type
64 Returns a reference to a hash containing the cookies to be set.
66 $c->response->cookies->{foo} = { value => '123' };
70 Shortcut to $resp->headers->header
74 Returns a L<HTTP::Headers> object containing the headers.
76 $c->response->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
80 Shortcut to $resp->body
82 =item $resp->redirect( $url, $status )
84 Contains a location to redirect to.
86 $c->response->redirect( 'http://slashdot.org' );
87 $c->response->redirect( 'http://slashdot.org', 307 );
96 my $status = shift || 302;
98 $self->location($location);
99 $self->status($status);
102 return $self->location;
107 Contains the HTTP status.
109 $c->response->status(404);
115 Sebastian Riedel, C<sri@cpan.org>
116 Marcus Ramberg, C<mramberg@cpan.org>
120 This program is free software, you can redistribute it and/or modify
121 it under the same terms as Perl itself.