Vipul Ved Prakash wrote: > > Hi, > > I'd like to create an object in the PerlChildInitHandler and allow > access to this object in various PerlResponseHandlers. What's the best > way to do this? > > I created a bucket brigade in childinit and associated it with the child > pool and put the object on it. I don't know how to access this bucket > brigade from a response handler. Here's the childinit handler: > > sub child_init { > my ($cp, $s) = @_; > > my $foo = 42; > $ba = APR::BucketAlloc->new($cp); > my $bb = APR::Brigade->new($cp, $ba); > my $b = APR::Bucket->new($ba, $foo); > $bb->insert_head($b); > > return OK; > } > > Help greatly appreciated.
package My:Module my $bb; sub child_init { my ($cp, $s) = @_; my $foo = 42; $ba = APR::BucketAlloc->new($cp); $bb = APR::Brigade->new($cp, $ba); my $b = APR::Bucket->new($ba, $foo); $bb->insert_head($b); return OK; } sub get_global_bb { return $bb; } Then anywhere at request time you can pull this out with My::Module->get_global_bb(); There is nothing special there ;-) -------------------------------------------------------------------------------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
signature.asc
Description: OpenPGP digital signature