6 messages in org.apache.perl.modperlRe: Reading post-data
FromSent OnAttachments
Reif PeterJun 11, 2007 2:50 am 
Jani M.Jun 11, 2007 3:56 am 
Reif PeterJun 11, 2007 11:43 pm 
Reif PeterJun 19, 2007 11:44 pm 
Fred MoyerJun 19, 2007 11:59 pm 
Reif PeterJun 20, 2007 12:34 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Reading post-dataActions...
From:Fred Moyer (fr@redhotpenguin.com)
Date:Jun 19, 2007 11:59:39 pm
List:org.apache.perl.modperl

Reif Peter wrote:

Reif Peter wrote: my $postdata = ""; while ($r->read(my $buf, 8192)) { $postdata .= $buf; }

You should ofcourse select a read-buffer size that will best suite your setup. I do not know what would be the most optimal setting here.

Yes, this code works and I am using it, too. But the documentation says, you can use $r->read($buf, $r->headers_in->{'content-length'}

this statement reads the entire request content in one iteration by using a read buffer size equal to the content-length of the request.

http://perl.apache.org/docs/2.0/user/porting/compat.html I want to know if the documentation is wrong, and if it is wrong, it should be corrected!

I'm not sure if there is anything wrong with it, seems like a good way to slurp the request content.

If the request content is large and you are performing a memory intensive operation on each chunk then you might want to read in a while loop as in your first example and perform some work on each chunk, so that the overall memory usage is low.