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=1a723dc1a75a4dc351ca5aad28233ccbf9cb8820;hp=877f8c967daea14e14ea0fe987a6155f63bf9a23;hb=059c085bfcead450e70ace9ef193aa99ac2ab37d;hpb=25f55123b7c0b520eb166890bf47f1f3217200af diff --git a/lib/Catalyst/Response.pm b/lib/Catalyst/Response.pm index 877f8c9..1a723dc 100644 --- a/lib/Catalyst/Response.pm +++ b/lib/Catalyst/Response.pm @@ -1,16 +1,24 @@ package Catalyst::Response; -use strict; -use base 'Class::Accessor::Fast'; +use Moose; -__PACKAGE__->mk_accessors(qw/cookies body headers location status/); +has cookies => (is => 'rw'); +has body => (is => 'rw'); +has location => (is => 'rw'); +has status => (is => 'rw'); +has headers => ( + is => 'rw', + handles => [qw(content_encoding content_length content_type header)], +); -*output = \&body; +has _context => ( + is => 'rw', + weak_ref => 1, +); -sub content_encoding { shift->headers->content_encoding(@_) } -sub content_length { shift->headers->content_length(@_) } -sub content_type { shift->headers->content_type(@_) } -sub header { shift->headers->header(@_) } +sub output { shift->body(@_) } + +no Moose; =head1 NAME @@ -127,6 +135,10 @@ sub redirect { return $self->location; } +=head2 $res->location + +Sets or returns the HTTP 'Location'. + =head2 $res->status Sets or returns the HTTP status. @@ -139,7 +151,11 @@ Writes $data to the output stream. =cut -sub write { shift->{_context}->write(@_); } +sub write { shift->_context->write(@_); } + +=head2 meta + +Provided by Moose =head1 AUTHORS