Fixed dispatcher, so $c->req->action(undef) works again
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Base.pm
index 6292fd3..1b672f0 100644 (file)
@@ -43,7 +43,9 @@ sub _AUTO : Private {
 
 sub _ACTION : Private {
     my ( $self, $c ) = @_;
-    $c->action->execute($c);
+    if ( ref $c->action && $c->action->isa('Catalyst::Action') ) {
+        $c->action->execute($c);
+    }
     return !@{ $c->error };
 }
 
@@ -55,6 +57,26 @@ sub _END : Private {
     return !@{ $c->error };
 }
 
+=head1 NAME
+
+Catalyst::Base - Catalyst Base Class
+
+=head1 SYNOPSIS
+
+See L<Catalyst>
+
+=head1 DESCRIPTION
+
+Catalyst Base Class
+
+=head1 METHODS
+
+=over 4
+
+=item $self->action_namespace($c)
+
+=cut
+
 sub action_namespace {
     my ( $self, $c ) = @_;
     return Catalyst::Utils::class2prefix( ref $self,
@@ -62,6 +84,10 @@ sub action_namespace {
       || '';
 }
 
+=item $self->register_actions($c)
+
+=cut
+
 sub register_actions {
     my ( $self, $c ) = @_;
     my $class = ref $self || $self;
@@ -114,7 +140,8 @@ sub _parse_attrs {
 
         # Parse out :Foo(bar) into Foo => bar etc (and arrayify)
 
-        if ( my ( $key, $value ) = ( $attr =~ /^(.*?)(?:\(\s*(.+?)\s*\))?$/ ) ) {
+        if ( my ( $key, $value ) = ( $attr =~ /^(.*?)(?:\(\s*(.+?)\s*\))?$/ ) )
+        {
 
             if ( defined $value ) {
                 ( $value =~ s/^'(.*)'$/$1/ ) || ( $value =~ s/^"(.*)"/$1/ );
@@ -125,25 +152,11 @@ sub _parse_attrs {
     return \%attributes;
 }
 
-=head1 NAME
-
-Catalyst::Base - Catalyst Controller Base Class
-
-=head1 SYNOPSIS
-
-
-=head1 DESCRIPTION
-
-
-=head1 METHODS
-
-=over 4
-
 =back
 
 =head1 SEE ALSO
 
-L<Catalyst>.
+L<Catalyst>, L<Catalyst::Controller>.
 
 =head1 AUTHOR