prettier statistics
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine.pm
index 98a5f92..593daeb 100644 (file)
@@ -127,11 +127,13 @@ sub execute {
     my ( $c, $class, $code ) = @_;
     $class = $c->comp($class) || $class;
     $c->state(0);
+    my $callsub = ( caller(1) )[3];
     eval {
         if ( $c->debug )
         {
             my $action = $c->actions->{reverse}->{"$code"};
             $action = "/$action" unless $action =~ /\-\>/;
+            $action = "  $action" if $callsub =~ /forward$/;
             my ( $elapsed, @state ) =
               $c->benchmark( $code, $class, $c, @{ $c->req->args } );
             push @{ $c->{stats} },
@@ -164,19 +166,19 @@ sub finalize {
     if ( my $location = $c->response->redirect ) {
         $c->log->debug(qq/Redirecting to "$location"/) if $c->debug;
         $c->response->header( Location => $location );
-        $c->response->status(302);
+        $c->response->status(302) if $c->response->status !~ /3\d\d$/;
     }
 
     if ( $#{ $c->error } >= 0 ) {
         $c->finalize_error;
     }
 
-    if ( !$c->response->output && $c->response->status !~ /^(1|3)\d\d)$/ ) {
+    if ( !$c->response->output && $c->response->status !~ /^(1|3)\d\d$/ ) {
         $c->finalize_error;
     }
 
-    if ( $c->response->output ) {
-        use bytes; # play safe with a utf8 aware perl
+    if ( $c->response->output && !$c->response->content_length ) {
+        use bytes;    # play safe with a utf8 aware perl
         $c->response->content_length( length $c->response->output );
     }