use APR::Const -compile => qw/SUCCESS/; use APR::Brigade; use APR::Bucket; use APR::Status; use APR::Error; [...] sub handler { [...] my $bb_in = APR::Brigade->new($c->pool, $c->bucket_alloc); my $bb_out = APR::Brigade->new($c->pool, $c->bucket_alloc); while (1) { my $rc = $c->input_filters->get_brigade($bb_in, Apache2::Const::MODE_GETLINE); last if APR::Status::is_EOF($rc); die APR::Error::strerror($rc) unless $rc == APR::Const::SUCCESS; my $last = 0; while (!$bb_in->is_empty) { my $b = $bb_in->first; $b->remove; if ($b->is_eos) { $bb_out->insert_tail($b); $last++; last; } if ($b->read(my $data)) { warn $data; # testing line } $bb_out->insert_tail($b); } if ($last) { $bb_out->insert_tail(APR::Bucket::flush_create($c->bucket_alloc)); $c->output_filters->pass_brigade($bb_out); last; } } [...]