X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FResponse.pm;h=ff463981af53cba375725b0124f541d6ff004763;hp=18930dac4798d7ed09991a2697df49f72588c62a;hb=b5ecfcf07b8ffe7e9984f0279c8781ce51c6ac6a;hpb=4f5ebacdba8bc446f80d0e8999d117d80f9d2c98 diff --git a/lib/Catalyst/Response.pm b/lib/Catalyst/Response.pm index 18930da..ff46398 100644 --- a/lib/Catalyst/Response.pm +++ b/lib/Catalyst/Response.pm @@ -14,7 +14,7 @@ sub header { shift->headers->header(@_) } =head1 NAME -Catalyst::Response - Catalyst Response Class +Catalyst::Response - stores output responding to the current client request =head1 SYNOPSIS @@ -31,58 +31,70 @@ Catalyst::Response - Catalyst Response Class $res->status; $res->write; -See also L. - =head1 DESCRIPTION -This is the Catalyst Response class, which provides a set of accessors -to response data. +This is the Catalyst Response class, which provides methods for responding to +the current client request. =head1 METHODS -=over 4 - -=item $res->body($text) +=head2 $res->body($text) $c->response->body('Catalyst rocks!'); -Contains the final output. +Sets or returns the output (text or binary data). -=item $res->content_encoding +=head2 $res->content_encoding -Shortcut to $res->headers->content_encoding +Shortcut for $res->headers->content_encoding. -=item $res->content_length +=head2 $res->content_length -Shortcut to $res->headers->content_length +Shortcut for $res->headers->content_length. -=item $res->content_type +=head2 $res->content_type -Shortcut to $res->headers->content_type +Shortcut for $res->headers->content_type. -=item $res->cookies +=head2 $res->cookies -Returns a reference to a hash containing the cookies to be set. +Returns a reference to a hash containing cookies to be set. The keys of the +hash are the cookies' names, and their corresponding values are hash +references used to construct a L object. $c->response->cookies->{foo} = { value => '123' }; -=item $res->header +The keys of the hash reference on the right correspond to the L +parameters of the same name, except they are used without a leading dash. +Possible parameters are: + +=head2 value + +=head2 expires + +=head2 domain -Shortcut to $res->headers->header +=head2 path -=item $res->headers +=head2 secure -Returns a L object containing the headers. +=head2 $res->header + +Shortcut for $res->headers->header. + +=head2 $res->headers + +Returns an L object, which can be used to set headers. $c->response->headers->header( 'X-Catalyst' => $Catalyst::VERSION ); -=item $res->output +=head2 $res->output -Shortcut to $res->body +Alias for $res->body. -=item $res->redirect( $url, $status ) +=head2 $res->redirect( $url, $status ) -Contains a location to redirect to. +Causes the response to redirect to the specified URL. $c->response->redirect( 'http://slashdot.org' ); $c->response->redirect( 'http://slashdot.org', 307 ); @@ -103,13 +115,13 @@ sub redirect { return $self->location; } -=item $res->status +=head2 $res->status -Contains the HTTP status. +Sets or returns the HTTP status. $c->response->status(404); -=item $res->write( $data ) +=head2 $res->write( $data ) Writes $data to the output stream. @@ -117,11 +129,10 @@ Writes $data to the output stream. sub write { shift->{_context}->write(@_); } -=back - -=head1 AUTHOR +=head1 AUTHORS Sebastian Riedel, C + Marcus Ramberg, C =head1 COPYRIGHT