remove Test::WWW::Mechanize::Catalyst from Makefile.PL (circular dep)
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Base.pm
index 7536dc6..ea2063a 100644 (file)
@@ -27,7 +27,7 @@ sub _BEGIN : Private {
     my ( $self, $c ) = @_;
     my $begin = ( $c->get_actions( 'begin', $c->namespace ) )[-1];
     return 1 unless $begin;
-    $begin->execute($c);
+    $begin->dispatch( $c );
     return !@{ $c->error };
 }
 
@@ -35,7 +35,7 @@ sub _AUTO : Private {
     my ( $self, $c ) = @_;
     my @auto = $c->get_actions( 'auto', $c->namespace );
     foreach my $auto (@auto) {
-        $auto->execute($c);
+        $auto->dispatch( $c );
         return 0 unless $c->state;
     }
     return 1;
@@ -47,7 +47,7 @@ sub _ACTION : Private {
         && $c->action->can('execute')
         && $c->req->action )
     {
-        $c->action->execute($c);
+        $c->action->dispatch( $c );
     }
     return !@{ $c->error };
 }
@@ -56,7 +56,7 @@ sub _END : Private {
     my ( $self, $c ) = @_;
     my $end = ( $c->get_actions( 'end', $c->namespace ) )[-1];
     return 1 unless $end;
-    $end->execute($c);
+    $end->dispatch( $c );
     return !@{ $c->error };
 }
 
@@ -72,10 +72,15 @@ See L<Catalyst>
 
 Catalyst Base Class
 
+This is the base class for all Catalyst components. It also handles 
+dispatch of actions for controllers.
+
 =head1 METHODS
 
 =head2 $self->action_namespace($c)
 
+Determine the namespace for actions in this component.
+
 =cut
 
 sub action_namespace {
@@ -88,12 +93,16 @@ sub action_namespace {
 
 =head2 $self->path_prefix($c)
 
+alias for action_namespace
+
 =cut
 
 sub path_prefix { shift->action_namespace(@_); }
 
 =head2 $self->register_actions($c)
 
+register all actions for this component based on a given context.
+
 =cut
 
 sub register_actions {
@@ -127,20 +136,24 @@ sub register_actions {
             next;
         }
         my $reverse = $namespace ? "$namespace/$method" : $method;
-        my $action = $self->_action_class->new(
-            {
-                name       => $method,
-                code       => $code,
-                reverse    => $reverse,
-                namespace  => $namespace,
-                class      => $class,
-                attributes => $attrs,
-            }
+        my $action = $self->create_action(
+            name       => $method,
+            code       => $code,
+            reverse    => $reverse,
+            namespace  => $namespace,
+            class      => $class,
+            attributes => $attrs,
         );
+
         $c->dispatcher->register( $c, $action );
     }
 }
 
+sub create_action {
+    my $self = shift;
+    $self->_action_class->new( { @_ } );
+}
+
 sub _parse_attrs {
     my ( $self, $c, $name, @attrs ) = @_;
     my %attributes;