I'd like to use APR::Request's custom parser under some different environments like FastCGI, PerlEx and PersistentPerl. All these tie STDIN to some package, which defines methods to read a particular socket. APR::Request::CGI doesn't work, because the operating system's STDIN is not used.
Currently, to feed APR::Request's parser I have to do the following: $length = $ENV{CONTENT_LENGTH}; read(STDIN, $buffer, $length); [...] $b = APR::Bucket->new($ba, $buffer); [...] This works nice for simple requests, but not good for file uploads, especially not good for the previously mentioned environments, because they are persistent just like mod_perl and filling $buffer to the limit would take a lot of RAM, which is bad. If I understand the "file bucket" conception right, if I supply a file handle instead of a scalar to APR::Bucket->new, it should work as desired, because APR::Request's parser has a way to limit the number of bytes read. APR's documentation says something about file buckets: "It's important to know that certain bucket types (e.g. file bucket), may perform a split and insert extra buckets following the current one. Therefore never call C<L<$b-E<gt>remove|/C_remove_>>, before calling C<$b-E<gt>read>, or you may lose data." but it doesn't say how to create one. Apache2::TieBucketBrigade won't work for me. "Will Whittaker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On Fri, Sep 16, 2005 at 12:25:24AM +0300, Nikolay Ananiev wrote: > > > > > > I'd like to do the following: > > open $fh, '<', 'some_file'; # A very big file > > $b = APR::Bucket->new($ba, $fh); > > > > while($b->read($buffer, 2048)) { > > ..... > > } > > > > or > > $b = APR::Bucket->new($ba, \*STDIN); > > > > > > > > > > > > > I'm not sure what you are trying to do in the above. If you are trying to > make brigades usuable as filehandles then try Apache2::TieBucketBrigade > http://search.cpan.org/~mock/Apache2-TieBucketBrigade-0.07/ > > mock >