![]() |
Practical mod_perl / HTML Version / | ![]() |
||
![]() |
||||
![]() |
![]() |
|||
![]() |
![]() |
|||
![]() |
||||
|
|
||||
![]() |
![]() |
|||
![]() |
25.3.2. Filter Configuration |
![]() |
||
![]() |
||||
![]() |
![]() |
![]() |
||
![]() |
||||
HTTP request filter handlers are declared using the FilterRequestHandler attribute. Consider the following request input and output filter skeletons:
package Book::FilterRequestFoo;
use base qw(Apache::Filter);
sub input : FilterRequestHandler {
my($filter, $bb, $mode, $block, $readbytes) = @_;
#...
}
sub output : FilterRequestHandler {
my($filter, $bb) = @_;
#...
}
1;
If the attribute is not specified, the default FilterRequestHandler attribute is assumed. Filters specifying subroutine attributes must subclass Apache::Filter.
The request filters are usually configured in the <Location> or equivalent sections:
PerlModule Book::FilterRequestFoo
PerlModule Book::NiceResponse
<Location /filter_foo>
SetHandler modperl
PerlResponseHandler Book::NiceResponse
PerlInputFilterHandler Book::FilterRequestFoo::input
PerlOutputFilterHandler Book::FilterRequestFoo::output
</Location>
Now we have the request input and output filters configured.
The connection filter handler uses the FilterConnectionHandler attribute. Here is a similar example for the connection input and output filters:
package Book::FilterConnectionBar;
use base qw(Apache::Filter);
sub input : FilterConnectionHandler {
my($filter, $bb, $mode, $block, $readbytes) = @_;
#...
}
sub output : FilterConnectionHandler {
my($filter, $bb) = @_;
#...
}
1;
This time the configuration must be done outside the <Location> or equivalent sections, usually within the <VirtualHost>section or the global server configuration:
Listen 8005
<VirtualHost _default_:8005>
PerlModule Book::FilterConnectionBar
PerlModule Book::NiceResponse
PerlInputFilterHandler Book::FilterConnectionBar::input
PerlOutputFilterHandler Book::FilterConnectionBar::output
<Location />
SetHandler modperl
PerlResponseHandler Book::NiceResponse
</Location>
</VirtualHost>
This accomplishes the configuration of the connection input and output filters.
 
Continue to:
mod_perl, modperl, Apache, perl, cgi, html, mod_perl, e-commerce, scalability, free, open source, OSS, apache, squid, high availability, modperl, linux, unix, Web, www, mod_perl, webserver, admin, apache, book, webmaster, tools, modperl, guide, docs, documentation, help, mod_perl, perl, information, apache, script, errata, eric cholet, perl, apache, mod-perl, stas bekman, mod_perl, cool, perl, Apache, performance, speed, choice
![]() |
Other projects to check out: meta-religion.com is for those interested in Religious, Spiritual and Esoteric Phenomena. i-want-a-better.com is a community of people discussing what they would like to be improved in their lives and things they use and interact with. You may also want to find a healer in your area or read articles on variety of topics.