second try
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine.pm
index 16385dc..733e1ea 100644 (file)
@@ -388,6 +388,7 @@ Get an action in a given namespace.
 
 sub get_action {
     my ( $c, $action, $namespace ) = @_;
+    return [] unless $action;
     $namespace ||= '';
     if ($namespace) {
         $namespace = '' if $namespace eq '/';
@@ -459,10 +460,13 @@ sub handler {
                 for my $begin ( @{ $c->get_action( 'begin', $namespace ) } ) {
                     $c->state( $c->execute( @{ $begin->[0] } ) );
                 }
-                for my $result ( @{ $c->get_action( $action, $default ) }[-1] )
-                {
-                    $c->state( $c->execute( @{ $result->[0] } ) );
-                    last unless $default;
+                if ( my $action = $c->req->action ) {
+                    for my $result (
+                        @{ $c->get_action( $action, $default ) }[-1] )
+                    {
+                        $c->state( $c->execute( @{ $result->[0] } ) );
+                        last unless $default;
+                    }
                 }
                 for my $end ( reverse @{ $c->get_action( 'end', $namespace ) } )
                 {
@@ -486,8 +490,8 @@ sub handler {
             my $av = sprintf '%.3f', 1 / $elapsed;
             my $t = Text::ASCIITable->new;
             $t->setCols( 'Action', 'Time' );
-            $t->setColWidth( 'Action', 65, 1 );
-            $t->setColWidth( 'Time',   8,  1 );
+            $t->setColWidth( 'Action', 64, 1 );
+            $t->setColWidth( 'Time',   9,  1 );
 
             for my $stat (@stats) {
                 $t->addRow(@$stat);
@@ -534,9 +538,9 @@ sub prepare {
     if ( $c->debug ) {
         my $secs = time - $START || 1;
         my $av = sprintf '%.3f', $COUNT / $secs;
-        $c->log->debug('********************************');
+        $c->log->debug('**********************************');
         $c->log->debug("* Request $COUNT ($av/s) [$$]");
-        $c->log->debug('********************************');
+        $c->log->debug('**********************************');
         $c->res->headers->header( 'X-Catalyst' => $Catalyst::VERSION );
     }
     $c->prepare_request($r);