fix header sending for tied printing
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 31 Mar 2007 00:45:07 +0000 (02:45 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 31 Mar 2007 00:49:28 +0000 (02:49 +0200)
Headers were not sent on initial printf or print with empty first argument.

plp.tieprint.patch by Shiar 2002-08-21 18:54:45

PLP.pm
PLP/Tie/Print.pm

diff --git a/PLP.pm b/PLP.pm
index 6d6a520d0cc78c353f4a99c128449f8c4903cb70..57292ad2589d0760f3b1aa84668eb22c66b0c6ec 100644 (file)
--- a/PLP.pm
+++ b/PLP.pm
@@ -172,7 +172,7 @@ sub mod_perl_init {
 
 # FAST printing under mod_perl
 sub mod_perl_print {
-    return if @_ == 1 and not length $_[0];
+       return unless grep length, @_;
     PLP::sendheaders() unless $PLP::sentheaders;
     $PLP::r->print(@_);
 }
index 8ec4e4a389fd30c8636366ec1198364806fe4aca..83b5c76726f7b41f30dd4411634e973b5b5c2521 100644 (file)
@@ -18,7 +18,7 @@ sub WRITE { undef }
 
 sub PRINT {
     shift;
-    return if @_ == 1 and not length $_[0];
+    return unless grep length, @_;
     PLP::sendheaders() unless $PLP::sentheaders;
     print STDOUT @_;
     select STDOUT;
@@ -26,6 +26,8 @@ sub PRINT {
 
 sub PRINTF {
     shift;
+    return unless length $_[0];
+    PLP::sendheaders() unless $PLP::sentheaders;
     printf STDOUT @_;
     select STDOUT;
 }