X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=2aa1de20e00d26f7fe1e0fc64b957351904c0030;hp=2f9225fbabb7b3a5d647e6412ad341ed72ccd879;hb=a2c6c7b9ce592929b361dbfc88f8f87332b17516;hpb=4995a5cebbc06c813c20daabc8d248247f33cb37 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 2f9225f..2aa1de2 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -52,20 +52,30 @@ has request => ( is => 'rw', default => sub { my $self = shift; - my %p = ( _log => $self->log ); - $p{_uploadtmp} = $self->_uploadtmp if $self->_has_uploadtmp; - $self->request_class->new(\%p); + $self->request_class->new($self->_build_request_constructor_args); }, lazy => 1, ); +sub _build_request_constructor_args { + my $self = shift; + my %p = ( _log => $self->log ); + $p{_uploadtmp} = $self->_uploadtmp if $self->_has_uploadtmp; + \%p; +} + has response => ( is => 'rw', default => sub { my $self = shift; - $self->response_class->new({ _log => $self->log }); + $self->response_class->new($self->_build_response_constructor_args); }, lazy => 1, ); +sub _build_response_constructor_args { + my $self = shift; + { _log => $self->log }; +} + has namespace => (is => 'rw'); sub depth { scalar @{ shift->stack || [] }; } @@ -102,7 +112,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.90015'; +our $VERSION = '5.90016'; sub import { my ( $class, @arguments ) = @_; @@ -1270,7 +1280,7 @@ path, use C<< $c->uri_for_action >> instead. sub uri_for { my ( $c, $path, @args ) = @_; - if (blessed($path) && $path->isa('Catalyst::Controller')) { + if ( $path->$_isa('Catalyst::Controller') ) { $path = $path->path_prefix; $path =~ s{/+\z}{}; $path .= '/'; @@ -1287,7 +1297,7 @@ sub uri_for { $arg =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go; } - if ( blessed($path) ) { # action object + if ( $path->$_isa('Catalyst::Action') ) { # action object s|/|%2F|g for @args; my $captures = [ map { s|/|%2F|g; $_; } ( scalar @args && ref $args[0] eq 'ARRAY'