OK, I have a clue why ap_save_brigade wasn't implemented. I looked at its source and it basically does this:
# XXX UNTESTED CODE sub Apache2::Filter::save_brigade { my ($f, $saveto, $bb, $pool) = @_; # XXX should this be $f->r->pool? $pool ||= $f->c->pool; my $ret = APR::Const::SUCCESS; for (my $b = $bb->first; !$b->is_eos; $b = $bb->next($b)) { my $rv = $b->setaside($pool); if ($rv == APR::Const::ENOTIMPL) { my $len = $b->read(my $data); # apparently this changes the bucket type? $rv = $b->setaside($pool) if $len; } # check for some other kind of error if ($rv != APR::Const::SUCCESS) { $ret = $rv; return $rv if $rv != APR::Const::ENOTIMPL; } } # now concatenate the brigade to the target $saveto->concat($bb); return $ret; } The difference in the C version is that saveto and bb are pointers to pointers to brigades, so if saveto is NULL, ap_save_brigade creates one, which would be kind of icky for a Perl interface. It also means that patch I submitted in 2005 was probably broken anyway. There's really no reason why it couldn't be implemented in mod_perl in a way that stipulates passing a target brigade in as input though. I'm pretty sure it'd be a heck of a lot more efficient than that subroutine I just wrote above. On Mon, Jul 22, 2013 at 12:14 AM, dorian taylor <dorian.taylor.li...@gmail.com> wrote: > Hello, > > Is there a reason why ap_save_brigade hasn't been implemented? Does it > have special needs? > > (Funnily, after googling this issue, I found I had asked the same > question in 2005: > http://mail-archives.apache.org/mod_mbox/perl-modperl/200505.mbox/%3c20050509222133.gb31...@foobarsystems.com%3E > —and apparently written a patch.) > > Cheers, > > -- > Dorian Taylor > http://doriantaylor.com/ -- Dorian Taylor http://doriantaylor.com/