[ANNOUNCE] Apache2::TrapSubRequest 0.03
http://search.cpan.org/~dorian/ - now with working tests. 0.03 should show up soon (forgot to remove the bit about ap_save_brigade in 0.02)
Re: [ANNOUNCE] Apache2::TrapSubRequest 0.03
Dorian Taylor <[EMAIL PROTECTED]> writes: > http://search.cpan.org/~dorian/ - now with working tests. > > 0.03 should show up soon (forgot to remove the bit about > ap_save_brigade in 0.02) Hmm, have you considered removing the _filter sub and writing it as a closure instead? Here's some code that I've been using for that: use base "Apache2::Filter"; ... my $content = ""; $subr->add_output_filter(bless sub : FilterRequestHandler { my ($f, $bb) = @_; while (my $e = $bb->first) { $e->read(my $buf); $content .= $buf; $e->delete; } return Apache2::Const::OK; }); $subr->run; # reads entire subrequest into $content This way your subrequest buckets are all consumed by the filter, and you don't need a pnote to store the captured subrequest (I really don't know why you want to use ap_save_brigade). IMO dynamically creating filters using closures is a really nifty feature of mod_perl2; I use it to postprocess stuff stored inside a mod_authz_svn-protected subversion repository. Just *try* getting the authz info correct with a plain-old CGI script :-). -- Joe Schaefer
Re: [ANNOUNCE] Apache2::TrapSubRequest 0.03
> Hmm, have you considered removing the _filter sub and writing > it as a closure instead? Here's some code that I've been using > for that: i suppose i could do that. today is clean-my-modules-and-get-them-on-cpan day so perhaps later. ;) .d
Re: [ANNOUNCE] Apache2::TrapSubRequest 0.03
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [...] Joe Schaefer schrieb: | my $content = ""; | $subr->add_output_filter(bless sub : FilterRequestHandler { |my ($f, $bb) = @_; |while (my $e = $bb->first) { |$e->read(my $buf); |$content .= $buf; |$e->delete; |} |return Apache2::Const::OK; | }); | | $subr->run; # reads entire subrequest into $content just for curiosity why do you bless the sub? [...] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCqUVXkVPeOFLgZFIRAoSFAJ47LkKdz0jjbumPJc2rKqJrekpKoACdGPEX YWyNGh7JpP/Huu5iRQ88Ojk= =QREe -END PGP SIGNATURE-
Re: [ANNOUNCE] Apache2::TrapSubRequest 0.03
Tom Schindl <[EMAIL PROTECTED]> writes: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > [...] > Joe Schaefer schrieb: > > | my $content = ""; > | $subr->add_output_filter(bless sub : FilterRequestHandler { > |my ($f, $bb) = @_; > |while (my $e = $bb->first) { > |$e->read(my $buf); > |$content .= $buf; > |$e->delete; > |} > |return Apache2::Const::OK; > | }); > | > | $subr->run; # reads entire subrequest into $content > > just for curiosity why do you bless the sub? Cargo cult, I suppose; AFAICT it's not necessary. Thanks for the spot. -- Joe Schaefer