From: André Walker Date: Tue, 2 Aug 2011 18:24:37 +0000 (-0300) Subject: fixed __lookup_mvc X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=5cd3e38f295b5e88b588f4a2dbd09cb5ccb2342f fixed __lookup_mvc --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index f36117b..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') { + 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); } diff --git a/t/lib/TestAppOneView.pm b/t/lib/TestAppOneView.pm index 59354b3..01975fd 100644 --- a/t/lib/TestAppOneView.pm +++ b/t/lib/TestAppOneView.pm @@ -1,7 +1,7 @@ package TestAppOneView; -use strict; -use warnings; +use Moose; use Catalyst; +extends 'Catalyst'; __PACKAGE__->setup;