X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=571f260664ce9e7cce20a2a424d8b06a4f01b205;hp=9bf4617e050d295e5f90d54e4631cfc1452f57a9;hb=8738b8fecb20f3761d76a8d7f46660fdae54993a;hpb=2f498a7ee1e99938c3684604336d99488c9d6499 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 9bf4617..571f260 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -50,13 +50,20 @@ has request => ( is => 'rw', default => sub { my $self = shift; - my %p; + my %p = ( _log => $self->log ); $p{_uploadtmp} = $self->_uploadtmp if $self->_has_uploadtmp; $self->request_class->new(\%p); }, lazy => 1, ); -has response => (is => 'rw', default => sub { $_[0]->response_class->new({}) }, required => 1, lazy => 1); +has response => ( + is => 'rw', + default => sub { + my $self = shift; + $self->response_class->new({ _log => $self->log }); + }, + lazy => 1, +); has namespace => (is => 'rw'); sub depth { scalar @{ shift->stack || [] }; } @@ -2008,10 +2015,6 @@ sub prepare { my $uploadtmp = $class->config->{uploadtmp}; my $c = $class->context_class->new({ $uploadtmp ? (_uploadtmp => $uploadtmp) : ()}); - # For on-demand data - $c->request->_context($c); - $c->response->_context($c); - #surely this is not the most efficient way to do things... $c->stats($class->stats_class->new)->enable($c->use_stats); if ( $c->debug || $c->config->{enable_catalyst_header} ) { @@ -2027,8 +2030,6 @@ sub prepare { $c->prepare_request(@arguments); $c->prepare_connection; $c->prepare_query_parameters; - $c->prepare_headers; - $c->prepare_cookies; $c->prepare_path; # Prepare the body for reading, either by prepare_body @@ -2120,25 +2121,11 @@ Prepares connection. sub prepare_connection { my $c = shift; - $c->request->prepare_connection; + # XXX - This is called on the engine (not the request) to maintain + # Engine::PSGI back compat. + $c->engine->prepare_connection($c); } -=head2 $c->prepare_cookies - -Prepares cookies. - -=cut - -sub prepare_cookies { my $c = shift; $c->engine->prepare_cookies( $c, @_ ) } - -=head2 $c->prepare_headers - -Prepares headers. - -=cut - -sub prepare_headers { my $c = shift; $c->engine->prepare_headers( $c, @_ ) } - =head2 $c->prepare_parameters Prepares parameters. @@ -2989,10 +2976,7 @@ your output data, if known. sub write { my $c = shift; - # Finalize headers if someone manually writes output - $c->finalize_headers; - - return $c->engine->write( $c, @_ ); + return $c->response->write( @_ ); } =head2 version