Re: Pushing OutputHandler using PerlFixupHandler
[prev]
[thread]
[next]
[Date index for 2005/03/22]
This is a multi-part message in MIME format.
--------------050105050000060609070608
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Stas Bekman wrote:
| Tom Schindl wrote:
|
[...]
|
| and finally the config section is lucking. Otherwise users will not know
| when this handler is run :)
|
| Thanks Tom.
|
Ok. Here it is including the config-sections and without the unneeded
imports :-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCQGTNkVPeOFLgZFIRAiV5AKC6cLJwuoHinHzuduhcz3xMotGe1gCcCHJg
09TciU3rC3RazvIrkbE7nIU=
=/oBZ
-----END PGP SIGNATURE-----
--------------050105050000060609070608
Content-Type: text/x-patch;
name="filter.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="filter.patch"
Index: src/docs/2.0/user/handlers/filters.pod
===================================================================
--- src/docs/2.0/user/handlers/filters.pod (Revision 158635)
+++ src/docs/2.0/user/handlers/filters.pod (Arbeitskopie)
@@ -909,9 +909,35 @@
C<L<DIR|docs::2.0::user::config::config/item_DIR>>.
+=head2 Adding OutFilters dynamically
+If you have the need to add output filters dymically during the request.
+mod_perl 2.0 offers you the possibility to push filter callbacks during
+the request is processed. If want for example add an outfilter during the
+Fixup-Phase the your config would look the following:
+ <Files *\.html >
+ PerlFixupHandler MyApache::AddFilterDyn
+ </Files>
+And your module could look like this:
+
+ package MyApache::AddFilterDyn;
+
+ use Apache::Const -compile => qw(OK);
+ use Apache::Filter;
+ use MyApache::FilterObfuscate;
+
+ sub handler {
+ my $r = shift;
+
+ $r->add_output_filter(\&MyApache::FilterObfuscate::handler);
+
+ return Apache::OK;
+ }
+
+ 1;
+
=head2 HTTP Request vs. Connection Filters
mod_perl 2.0 supports connection and HTTP request filtering. mod_perl
--------------050105050000060609070608--
 |
(message missing)
|