Apache::TieBucketBrigade - Perl extension which ties an IO::Handle to Apache's Bucket Brigade so you can use standard filehandle type operations on the brigade.


  use Apache::Connection ();
  use Apache::Const -compile => 'OK';
  use Apache::TieBucketBrigade;
  sub handler { 
      my $FH = Apache::TieBucketBrigade->new_tie($c);
      my @stuff = <$FH>;
      print $FH "stuff goes out too";
      $FH->print("it's and IO::Handle too!!!");


This module has one usefull method "new_tie" which takes an Apache connection object and returns a tied IO::Handle object. It should be used inside a mod_perl protocol handler to make dealing with the bucket brigade bitz easier. FILENO will emulate a real fileno (using FILE::IO::new_tmpfile) and overrides CORE::select so that 4 arg select will work as expected (APR::Socket->poll underneath). IO::Handle::blocking will also work to set BLOCKING or NONBLOCKING, however autoflush is a noop. New to this version, closing the filehandle will actually close the connection. Note that several things here are a bit hackish, and there is the potential for resource problems since twice as many real file descriptors are used if FILENO is used then would otherwise be if I didn't have to fake it.

This module requires mod_perl 1.99_18 or greater (so that support for APR::Socket->poll is included) otherwise it won't work.




Many, I know for a fact everything other than readline, write, close, fileno and tiehandle doesn't work properly. The above are probably buggy as hell. Also the test suite is just broken. As soon as I fix it the above bugs should be resolved.


IO::Stringy mod_perl IO::Handle


mock <>


Copyright (C) 2004 by Will Whittaker and Ken Simpson

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.