Doug MacEachern wrote:
> On Tue, 27 Aug 2002, Stas Bekman wrote:
> 
> 
>>Any reason why we don't have all the is_ bucket methods, other than eos?
> 
> 
> testing for eos is the only thing i've seen "normal" filters do, i.e. 
> stuff outside the low-level core filters.
> are there good reasons we should have all of them?

For those that are going to write real filters, which may do different 
things according to the bucket type. See below for an example of needing 
is_flush.

>>I need at least is_flush().
> 
> 
> for?  i'm not doubting we should have these methods, just would like to 
> understand why we would.
> 
> also keep in mind, filters overall are another big itch that need to be 
> scratched.

when you write an output filter, you need to pass flush buckets as is, 
here is a typical brigade transform loop:

     for (my $b = $bb->first; $b; $b = $bb->next($b)) {
         $b->remove;
         if ($b->is_eos) {
             $bb_ctx->insert_tail($b);
             last;
         }
         elsif ($b->is_flush) {
             $bb_ctx->insert_tail($b);
             next;
         }
         else {
             $b->read(my $data);
             $data = do_something_with_data($data);
             $b = APR::Bucket->new($data);
             $bb_ctx->insert_tail($b);
         }
     }

Current "examples" in tests lose flush buckets.

 > also keep in mind, filters overall are another big itch that need to
 > be scratched.

you mean, I'm wasting my time trying to document how filters work now, 
since it's all going to change anyway, right?

__________________________________________________________________
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