Fix Catalyst::Dispatcher to handle a subclassless / COMPONENT-less View
SineSwiper [Fri, 18 May 2012 20:37:27 +0000 (16:37 -0400)]
lib/Catalyst/Dispatcher.pm
t/lib/TestAppOneView/View/Dummy.pm

index fb1efea..7b21510 100644 (file)
@@ -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;
     }
index c579995..368d192 100644 (file)
@@ -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;