[Catalyst-commits] r10865 - Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Sun Jul 12 00:57:19 GMT 2009


Author: t0m
Date: 2009-07-12 00:57:19 +0000 (Sun, 12 Jul 2009)
New Revision: 10865

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm
Log:
Refactor to remove warning

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm	2009-07-12 00:56:51 UTC (rev 10864)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm	2009-07-12 00:57:19 UTC (rev 10865)
@@ -158,11 +158,16 @@
 
     # Prepend the headers if they have not yet been sent
     if ( $self->_has_header_buf ) {
-        $buffer = $self->_clear_header_buf . $buffer;
+        $self->_warn_on_write_error(
+            $self->$orig($self->_clear_header_buf)
+        );
     }
 
-    my $ret = $self->$orig($c, $buffer);
+    $self->_warn_on_write_error($self->$orig($c, $buffer));
+};
 
+sub _warn_on_write_error {
+    my ($self, $ret) = @_;
     if ( !defined $ret ) {
         $self->_write_error($!);
         DEBUG && warn "write: Failed to write response ($!)\n";
@@ -170,9 +175,8 @@
     else {
         DEBUG && warn "write: Wrote response ($ret bytes)\n";
     }
-
     return $ret;
-};
+}
 
 =head2 run
 




More information about the Catalyst-commits mailing list