The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSIS

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

DESCRIPTION

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 2.0 or greater (so that support for APR::Socket->poll is included) otherwise it won't work.

EXPORT

None

BUGS

READ an associated bits are still kinda sketchy, although they've gotten better (thank you Mike and Murray). Most everything should work thought. Documentation is probably somewhat out of date, but should mostly work as advertised above Also the test suite is just broken. As soon as I fix it the above bugs should be resolved.

SEE ALSO

IO::Stringy mod_perl IO::Handle

AUTHOR

mock <mock@obscurity.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by MailChannels Corporation

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.