Author: geoff
Date: Fri Dec 10 09:19:33 2004
New Revision: 111525

URL: http://svn.apache.org/viewcvs?view=rev&rev=111525
Log:
$r->print() and print() now return 0E0 (zero but true) when the call
was successful but for zero bytes

Modified:
   perl/modperl/trunk/Changes
   perl/modperl/trunk/t/response/TestAPI/request_rec.pm
   perl/modperl/trunk/t/response/TestModperl/print.pm
   perl/modperl/trunk/xs/Apache/RequestIO/Apache__RequestIO.h
   perl/modperl/trunk/xs/maps/modperl_functions.map
   perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm

Modified: perl/modperl/trunk/Changes
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=111525&p1=perl/modperl/trunk/Changes&r1=111524&p2=perl/modperl/trunk/Changes&r2=111525
==============================================================================
--- perl/modperl/trunk/Changes  (original)
+++ perl/modperl/trunk/Changes  Fri Dec 10 09:19:33 2004
@@ -12,6 +12,9 @@
 
 =item 1.99_18-dev
 
+$r->print() and print() now return 0E0 (zero but true) when the call
+was successful but for zero bytes.  [Geoffrey Young]
+
 a new function Apache::ServerUtil::server_shutdown_cleanup_register to
 register cleanups to be run at server shutdown. [Stas]
 

Modified: perl/modperl/trunk/t/response/TestAPI/request_rec.pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestAPI/request_rec.pm?view=diff&rev=111525&p1=perl/modperl/trunk/t/response/TestAPI/request_rec.pm&r1=111524&p2=perl/modperl/trunk/t/response/TestAPI/request_rec.pm&r2=111525
==============================================================================
--- perl/modperl/trunk/t/response/TestAPI/request_rec.pm        (original)
+++ perl/modperl/trunk/t/response/TestAPI/request_rec.pm        Fri Dec 10 
09:19:33 2004
@@ -95,7 +95,7 @@
     {
         local $| = 0;
         ok t_cmp $r->print("# buffered\n"), 11, "buffered print";
-        ok t_cmp $r->print(), 0, "buffered print";
+        ok t_cmp $r->print(), "0E0", "buffered print";
 
         local $| = 1;
         my $string = "# not buffered\n";

Modified: perl/modperl/trunk/t/response/TestModperl/print.pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestModperl/print.pm?view=diff&rev=111525&p1=perl/modperl/trunk/t/response/TestModperl/print.pm&r1=111524&p2=perl/modperl/trunk/t/response/TestModperl/print.pm&r2=111525
==============================================================================
--- perl/modperl/trunk/t/response/TestModperl/print.pm  (original)
+++ perl/modperl/trunk/t/response/TestModperl/print.pm  Fri Dec 10 09:19:33 2004
@@ -12,7 +12,7 @@
 sub handler {
     my $r = shift;
 
-    plan $r, tests => 3;
+    plan $r, tests => 6;
 
     binmode STDOUT; #Apache::RequestRec::BINMODE (noop)
 
@@ -20,7 +20,22 @@
 
     ok 2;
 
-    printf "ok %d\n", 3;
+    {
+        # print should return true on success, even
+        # if it sends no data.
+        my $rc = print '';
+
+        ok ($rc);
+        ok ($rc == 0);  # 0E0 is still numerically 0
+    }
+
+    {
+        my $rc = print "# 11 bytes\n";  # don't forget the newline
+
+        ok ($rc == 11);
+    }
+
+    printf "ok %d\n", 6;
 
     Apache::OK;
 }

Modified: perl/modperl/trunk/xs/Apache/RequestIO/Apache__RequestIO.h
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/Apache/RequestIO/Apache__RequestIO.h?view=diff&rev=111525&p1=perl/modperl/trunk/xs/Apache/RequestIO/Apache__RequestIO.h&r1=111524&p2=perl/modperl/trunk/xs/Apache/RequestIO/Apache__RequestIO.h&r2=111525
==============================================================================
--- perl/modperl/trunk/xs/Apache/RequestIO/Apache__RequestIO.h  (original)
+++ perl/modperl/trunk/xs/Apache/RequestIO/Apache__RequestIO.h  Fri Dec 10 
09:19:33 2004
@@ -75,8 +75,8 @@
 }
 
 static MP_INLINE
-apr_size_t mpxs_Apache__RequestRec_print(pTHX_ I32 items,
-                                         SV **MARK, SV **SP)
+SV *mpxs_Apache__RequestRec_print(pTHX_ I32 items,
+                                 SV **MARK, SV **SP)
 {
     modperl_config_req_t *rcfg;
     request_rec *r;
@@ -95,7 +95,7 @@
     
     mpxs_output_flush(r, rcfg, "Apache::RequestIO::print");
     
-    return bytes;
+    return bytes ? newSVuv(bytes) : newSVpvn("0E0", 3);
 }  
 
 static MP_INLINE

Modified: perl/modperl/trunk/xs/maps/modperl_functions.map
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/modperl_functions.map?view=diff&rev=111525&p1=perl/modperl/trunk/xs/maps/modperl_functions.map&r1=111524&p2=perl/modperl/trunk/xs/maps/modperl_functions.map&r2=111525
==============================================================================
--- perl/modperl/trunk/xs/maps/modperl_functions.map    (original)
+++ perl/modperl/trunk/xs/maps/modperl_functions.map    Fri Dec 10 09:19:33 2004
@@ -48,7 +48,7 @@
 
 MODULE=Apache::RequestIO   PACKAGE=Apache::RequestRec
  SV *:DEFINE_TIEHANDLE    | | SV *:stashsv, SV *:sv=Nullsv
- apr_size_t:DEFINE_PRINT  | | ...
+ SV *:DEFINE_PRINT  | | ...
  apr_size_t:DEFINE_PRINTF | | ...
  SV *:DEFINE_BINMODE  | | request_rec *:r
  SV *:DEFINE_CLOSE    | | request_rec *:r

Modified: perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm?view=diff&rev=111525&p1=perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm&r1=111524&p2=perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm&r2=111525
==============================================================================
--- perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm       
(original)
+++ perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm       Fri Dec 
10 09:19:33 2004
@@ -6766,7 +6766,7 @@
     ]
   },
   {
-    'return_type' => 'apr_size_t',
+    'return_type' => 'SV *',
     'name' => 'mpxs_Apache__RequestRec_print',
     'args' => [
       {

Reply via email to