From: SineSwiper Date: Fri, 18 May 2012 20:37:27 +0000 (-0400) Subject: Fix Catalyst::Dispatcher to handle a subclassless / COMPONENT-less View X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=418188af18be72b5da445f9ab4514ea668badb29;p=catagits%2FCatalyst-Runtime.git Fix Catalyst::Dispatcher to handle a subclassless / COMPONENT-less View --- diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index fb1efea..7b21510 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -320,9 +320,9 @@ sub _invoke_as_component { my ( $self, $c, $component_or_class, $method ) = @_; my $component = $self->_find_component($c, $component_or_class); - my $component_class = blessed $component || return 0; + my $component_class = blessed($component) || $component || return 0; - if (my $code = $component_class->can('action_for')) { + if ( blessed $component and my $code = $component_class->can('action_for') ) { my $possible_action = $component->$code($method); return $possible_action if $possible_action; } diff --git a/t/lib/TestAppOneView/View/Dummy.pm b/t/lib/TestAppOneView/View/Dummy.pm index c579995..368d192 100644 --- a/t/lib/TestAppOneView/View/Dummy.pm +++ b/t/lib/TestAppOneView/View/Dummy.pm @@ -8,6 +8,9 @@ sub COMPONENT { package AClass; -use base 'Catalyst::View'; +### Turning this off on purpose to test out instances +### without COMPONENT or subclassing + +#use base 'Catalyst::View'; 1;