Need to check for opened STDOUT on each of these prints
Andy Grundman [Wed, 25 Oct 2006 16:09:44 +0000 (16:09 +0000)]
lib/Catalyst/Engine/CGI.pm

index dbdfbbd..bd47286 100644 (file)
@@ -42,11 +42,9 @@ sub finalize_headers {
     my ( $self, $c ) = @_;
 
     $c->response->header( Status => $c->response->status );
-    
-    return unless *STDOUT->opened();
 
-    print $c->response->headers->as_string("\015\012");
-    print "\015\012";
+    print $c->response->headers->as_string("\015\012") if *STDOUT->opened();
+    print "\015\012" if *STDOUT->opened();
 }
 
 =head2 $self->prepare_connection($c)