Removing C::E::CGI::NPH
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Response.pm
1 package Catalyst::Response;
2
3 use strict;
4 use base 'Class::Accessor::Fast';
5
6 __PACKAGE__->mk_accessors(qw/cookies headers output redirect status/);
7
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(@_)           }
12
13 =head1 NAME
14
15 Catalyst::Response - Catalyst Response Class
16
17 =head1 SYNOPSIS
18
19     $resp = $c->response;
20     $resp->content_encoding;
21     $resp->content_length;
22     $resp->content_type;
23     $resp->cookies;
24     $resp->header;
25     $resp->headers;
26     $resp->output;
27     $resp->redirect;
28     $resp->status;
29
30 See also L<Catalyst::Application>.
31
32 =head1 DESCRIPTION
33
34 This is the Catalyst Response class, which provides a set of accessors to
35 response data.
36
37 =head1 METHODS
38
39 =over 4
40
41 =item $resp->content_encoding
42
43 Shortcut to $resp->headers->content_encoding
44
45 =item $resp->content_length
46
47 Shortcut to $resp->headers->content_length
48
49 =item $resp->content_type
50
51 Shortcut to $resp->headers->content_type
52
53 =item $resp->cookies
54
55 Returns a reference to a hash containing the cookies.
56
57     $c->response->cookies->{foo} = { value => '123' };
58
59 =item $resp->header
60
61 Shortcut to $resp->headers->header
62
63 =item $resp->headers
64
65 Returns a L<HTTP::Headers> object containing the headers.
66
67     $c->response->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
68
69 =item $resp->output($text)
70
71 Contains the final output.
72
73     $c->response->output('Catalyst rockz!');
74
75 =item $resp->redirect($url)
76
77 Contains a location to redirect to.
78
79     $c->response->redirect('http://slashdot.org');
80
81 =item status
82
83 Contains the HTTP status.
84
85     $c->response->status(404);
86
87 =back
88
89 =head1 AUTHOR
90
91 Sebastian Riedel, C<sri@cpan.org>
92
93 =head1 COPYRIGHT
94
95 This program is free software, you can redistribute it and/or modify it under
96 the same terms as Perl itself.
97
98 =cut
99
100 1;