I was comparing the echo and echo_filter modules in t/. echo being 
simple since it just reads and writes directly to/from the socket, but 
cannot use filters. echo_filter which has the same protocol logic but 
supports filters is quite messy because of the all the bucket brigade 
manipulations cruft. Then I thought about the bb based filters vs. 
stream based filters. I think we can use the same simplification for 
protocol handlers as we did for stream based filters, where it fits. so 
the echo_filter could rewritten as:

package TestFilter::echo;
...
sub handler {
     my Apache::Connection $c = shift;

     my $last = 0;
     while (my $filter = $c->input_filters->next) {
         while ($filter->read(my $buffer, BUFF_LEN)) {
             $filter->print($buffer);
         }
     }

     Apache::OK;
}

PerlProcessConnectionHandler TestFilter::echo

of course next() in $c->input_filters->next doesn't exist yet, but this 
is just to give an idea.

Now if you think this will work, should/can we simply reuse the 
Apache::Filter API or does it have to be a separate implementation which 
may use the same methods?


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to