Esteban Fernandez Stafford wrote:
The problem is that I've written a patch that makes the $filter->print() outside the while() loop work, but it was never committed. So the doc is out of sync with the core code. For now please apply this patch:Hello,I am currently developing a modperl filter that uses the streaming approach. I started off with the example in http://perl.apache.org/docs/2.0/user/handlers/filters.html#Stream_oriented_Output_Filter sub handler { my $filter = shift; my $left_over = ''; while ($filter->read(my $buffer, BUFF_LEN)) { $buffer = $left_over . $buffer; $left_over = ''; while ($buffer =~ /([^\r\n]*)([\r\n]*)/g) { $left_over = $1, last unless $2; $filter->print(scalar(reverse $1), $2); } } $filter->print(scalar reverse $left_over) if length $left_over; Apache::OK; } This seems to work OK when the file is small (smaller than 8192). When the file is larger, then there is a line that gets cut. This is because the handler gets called more than once for big requests. Is there a nice way to overcome this problem? I was thinking using filter context to store variable $left_over, but then I dont know how to detect the "real" end of the stream.
http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=102828686110352&w=2
I'll see that it gets into the core asap.
--
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/