X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=7c51d8de924b3d75a26b985a4012c0f9c1aeb328;hb=5cd3e38f295b5e88b588f4a2dbd09cb5ccb2342f;hp=0e0acd68c7f8884bbc946aea0ce476039be8c866;hpb=065ac54c902d392fc440ae548618dbbe2d87426c;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 0e0acd6..7c51d8d 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -615,16 +615,17 @@ sub view { shift->_lookup_mvc('view', @_) } sub _lookup_mvc { my ( $c, $type, $name, @args ) = @_; - if (ref $c && !$name && $type ne 'controller') { - my $current_instance = $c->stash->{current_${type}_instance}; + if (ref $c && !$name) { + my $current_instance = $c->stash->{"current_${type}_instance"}; return $current_instance - if $current_instance; + if $current_instance && $type ne 'controller'; - $name = $c->stash->{current_${type}}; + $name = $type eq 'controller' + ? Catalyst::Utils::class2classshortsuffix($c->action->class) + : $c->stash->{"current_${type}"} + ; } - $name ||= Catalyst::Utils::class2classshortsuffix($c->action->class); - return $c->container->get_component_from_sub_container($type, $name, $c, @args); }