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=3c71fde35709ee0a957f072d231782f940804d22;hp=3b57cab8dedd522a141ac0682988846366a8e7ad;hb=0fc2d522eec43202c21e9f0062e43f10db4d9008;hpb=e5ecd5bc38bac3e2fcfaf643ea2a4c6ab46d7e57 diff --git a/lib/Catalyst/Response.pm b/lib/Catalyst/Response.pm index 3b57cab..3c71fde 100644 --- a/lib/Catalyst/Response.pm +++ b/lib/Catalyst/Response.pm @@ -1,19 +1,25 @@ package Catalyst::Response; +use Class::C3; use Moose; +use HTTP::Headers; -has cookies => (is => 'rw'); -has body => (is => 'rw'); +has cookies => (is => 'rw', default => sub { {} }); +has body => (is => 'rw', default => ''); has location => (is => 'rw'); -has status => (is => 'rw'); +has status => (is => 'rw', default => 200); +has finalized_headers => (is => 'rw', default => 0); has headers => ( is => 'rw', handles => [qw(content_encoding content_length content_type header)], + default => sub { HTTP::Headers->new() }, + required => 1, + lazy => 1, ); - has _context => ( is => 'rw', weak_ref => 1, + handles => ['write'], ); sub output { shift->body(@_) } @@ -84,7 +90,7 @@ 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: -=over +=over =item value @@ -144,15 +150,11 @@ Sets or returns the HTTP 'Location'. Sets or returns the HTTP status. $c->response->status(404); - + =head2 $res->write( $data ) Writes $data to the output stream. -=cut - -sub write { shift->_context->write(@_); } - =head2 meta Provided by Moose @@ -165,7 +167,7 @@ Marcus Ramberg, C =head1 COPYRIGHT -This program is free software, you can redistribute it and/or modify +This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut