.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Catalyst::Response 3pm" .TH Catalyst::Response 3pm "2012-06-30" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Catalyst::Response \- stores output responding to the current client request .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 10 \& $res = $c\->response; \& $res\->body; \& $res\->code; \& $res\->content_encoding; \& $res\->content_length; \& $res\->content_type; \& $res\->cookies; \& $res\->header; \& $res\->headers; \& $res\->output; \& $res\->redirect; \& $res\->status; \& $res\->write; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is the Catalyst Response class, which provides methods for responding to the current client request. The appropriate Catalyst::Engine for your environment will turn the Catalyst::Response into a \s-1HTTP\s0 Response and return it to the client. .SH "METHODS" .IX Header "METHODS" .ie n .SS "$res\->body( $text | $fh | $iohandle_object )" .el .SS "\f(CW$res\fP\->body( \f(CW$text\fP | \f(CW$fh\fP | \f(CW$iohandle_object\fP )" .IX Subsection "$res->body( $text | $fh | $iohandle_object )" .Vb 1 \& $c\->response\->body(\*(AqCatalyst rocks!\*(Aq); .Ve .PP Sets or returns the output (text or binary data). If you are returning a large body, you might want to use a IO::Handle type of object (Something that implements the read method in the same fashion), or a filehandle \s-1GLOB\s0. Catalyst will write it piece by piece into the response. .ie n .SS "$res\->has_body" .el .SS "\f(CW$res\fP\->has_body" .IX Subsection "$res->has_body" Predicate which returns true when a body has been set. .ie n .SS "$res\->code" .el .SS "\f(CW$res\fP\->code" .IX Subsection "$res->code" Alias for \f(CW$res\fR\->status. .ie n .SS "$res\->content_encoding" .el .SS "\f(CW$res\fP\->content_encoding" .IX Subsection "$res->content_encoding" Shortcut for \f(CW$res\fR\->headers\->content_encoding. .ie n .SS "$res\->content_length" .el .SS "\f(CW$res\fP\->content_length" .IX Subsection "$res->content_length" Shortcut for \f(CW$res\fR\->headers\->content_length. .ie n .SS "$res\->content_type" .el .SS "\f(CW$res\fP\->content_type" .IX Subsection "$res->content_type" Shortcut for \f(CW$res\fR\->headers\->content_type. .PP This value is typically set by your view or plugin. For example, Catalyst::Plugin::Static::Simple will guess the mime type based on the file it found, while Catalyst::View::TT defaults to \f(CW\*(C`text/html\*(C'\fR. .ie n .SS "$res\->cookies" .el .SS "\f(CW$res\fP\->cookies" .IX Subsection "$res->cookies" 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 CGI::Simple::Cookie object. .PP .Vb 1 \& $c\->response\->cookies\->{foo} = { value => \*(Aq123\*(Aq }; .Ve .PP The keys of the hash reference on the right correspond to the CGI::Simple::Cookie parameters of the same name, except they are used without a leading dash. Possible parameters are: .IP "value" 4 .IX Item "value" .PD 0 .IP "expires" 4 .IX Item "expires" .IP "domain" 4 .IX Item "domain" .IP "path" 4 .IX Item "path" .IP "secure" 4 .IX Item "secure" .IP "httponly" 4 .IX Item "httponly" .PD .ie n .SS "$res\->header" .el .SS "\f(CW$res\fP\->header" .IX Subsection "$res->header" Shortcut for \f(CW$res\fR\->headers\->header. .ie n .SS "$res\->headers" .el .SS "\f(CW$res\fP\->headers" .IX Subsection "$res->headers" Returns an HTTP::Headers object, which can be used to set headers. .PP .Vb 1 \& $c\->response\->headers\->header( \*(AqX\-Catalyst\*(Aq => $Catalyst::VERSION ); .Ve .ie n .SS "$res\->output" .el .SS "\f(CW$res\fP\->output" .IX Subsection "$res->output" Alias for \f(CW$res\fR\->body. .ie n .SS "$res\->redirect( $url, $status )" .el .SS "\f(CW$res\fP\->redirect( \f(CW$url\fP, \f(CW$status\fP )" .IX Subsection "$res->redirect( $url, $status )" Causes the response to redirect to the specified \s-1URL\s0. The default status is \&\f(CW302\fR. .PP .Vb 2 \& $c\->response\->redirect( \*(Aqhttp://slashdot.org\*(Aq ); \& $c\->response\->redirect( \*(Aqhttp://slashdot.org\*(Aq, 307 ); .Ve .PP This is a convenience method that sets the Location header to the redirect destination, and then sets the response status. You will want to \f(CW\*(C` return \*(C'\fR or \f(CW\*(C`$c\->detach()\*(C'\fR to interrupt the normal processing flow if you want the redirect to occur straight away. .PP \&\fBNote:\fR do not give a relative \s-1URL\s0 as \f(CW$url\fR, i.e: one that is not fully qualified (= \f(CW\*(C`http://...\*(C'\fR, etc.) or that starts with a slash (= \f(CW\*(C`/path/here\*(C'\fR). While it may work, it is not guaranteed to do the right thing and is not a standard behaviour. You may opt to use \fIuri_for()\fR or \&\fIuri_for_action()\fR instead. .ie n .SS "$res\->location" .el .SS "\f(CW$res\fP\->location" .IX Subsection "$res->location" Sets or returns the \s-1HTTP\s0 'Location'. .ie n .SS "$res\->status" .el .SS "\f(CW$res\fP\->status" .IX Subsection "$res->status" Sets or returns the \s-1HTTP\s0 status. .PP .Vb 1 \& $c\->response\->status(404); .Ve .PP \&\f(CW$res\fR\->code is an alias for this, to match HTTP::Response\->code. .ie n .SS "$res\->write( $data )" .el .SS "\f(CW$res\fP\->write( \f(CW$data\fP )" .IX Subsection "$res->write( $data )" Writes \f(CW$data\fR to the output stream. .ie n .SS "$res\->print( @data )" .el .SS "\f(CW$res\fP\->print( \f(CW@data\fP )" .IX Subsection "$res->print( @data )" Prints \f(CW@data\fR to the output stream, separated by $,. This lets you pass the response object to functions that want to write to an IO::Handle. .ie n .SS "$self\->finalize_headers($c)" .el .SS "\f(CW$self\fP\->finalize_headers($c)" .IX Subsection "$self->finalize_headers($c)" Writes headers to response if not already written .SS "\s-1DEMOLISH\s0" .IX Subsection "DEMOLISH" Ensures that the response is flushed and closed at the end of the request. .SS "meta" .IX Subsection "meta" Provided by Moose .SH "AUTHORS" .IX Header "AUTHORS" Catalyst Contributors, see Catalyst.pm .SH "COPYRIGHT" .IX Header "COPYRIGHT" This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.