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 || [] }; }
my $uploadtmp = $class->config->{uploadtmp};
my $c = $class->context_class->new({ $uploadtmp ? (_uploadtmp => $uploadtmp) : ()});
- # For on-demand data
- $c->request->_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} ) {
return $headers;
}
-has _context => (
- is => 'rw',
- weak_ref => 1,
- clearer => '_clear_context',
+has _log => (
+ is => 'ro',
+ weak_ref => 1,
+ required => 1,
);
# Amount of data to read from input on each pass
my ($orig, $self, $params) = @_;
if ($params) {
if ( !ref $params ) {
- $self->_context->log->warn(
+ $self->_log->warn(
"Attempt to retrieve '$params' with req->params(), " .
"you probably meant to call req->param('$params')"
);
request => (
reader => 'request',
required => 1,
- default => sub { Catalyst::Request->new(arguments => [qw/one two/]) },
+ default => sub { Catalyst::Request->new(_log => Catalyst::Log->new, arguments => [qw/one two/]) },
),
),
],
use_ok('TestApp');
my $request = Catalyst::Request->new( {
+ _log => Catalyst::Log->new,
base => URI->new('http://127.0.0.1/foo')
} );
my $dispatcher = TestApp->dispatcher;
use_ok('TestApp');
my $request = Catalyst::Request->new( {
+ _log => Catalyst::Log->new,
base => URI->new('http://127.0.0.1/foo')
} );
my $dispatcher = TestApp->dispatcher;
# Tests with Context
#
my $request = Catalyst::Request->new( {
+ _log => Catalyst::Log->new,
base => URI->new('http://127.0.0.1/foo')
} );
my $base = 'http://127.0.0.1';
my $request = Catalyst::Request->new({
+ _log => Catalyst::Log->new,
base => URI->new($base),
uri => URI->new("$base/"),
});
use strict;
use warnings;
-use Test::More tests => 10;
+use Test::More;
use URI;
+use Catalyst::Log;
use_ok('Catalyst::Request');
my $request = Catalyst::Request->new( {
+ _log => Catalyst::Log->new,
uri => URI->new('http://127.0.0.1/foo/bar/baz')
} );
);
my $request2 = Catalyst::Request->new( {
+ _log => Catalyst::Log->new,
uri => URI->new('http://127.0.0.1/foo/bar/baz?bar=gorch')
} );
is(
'append mode URI appends arrayref param'
);
+done_testing;
+