so when i tried the httpd.conf approach i ran into a problem. i added
this to my conf file:

<Directory /var/www/vhosts/mydomain.com/httpdocs/test>
       PerlOptions -InputFilter -OutputFilter
</Directory>

but when i ran "apachectl -t" on it i got this syntax error:

Invalid per-directory PerlOption: InputFilter

so it seems that while PerlOption is allowed at the directory level,
the InputFilter and OutputFilter options are not. (i actually couldn't
find a relevant section in the docs about that so i am unsure.)

it is my preferred solution to be able to turn the filter off for
particular directories via the conf file so it is my fading hope that
i'm doing something wrong?

if i am not then my plan of attack is to use PerlSetVar. then my conf
file would look like so:

<Directory /var/www/vhosts/mydomain.com/httpdocs/test>
       PerlSetVar EnableMyFilter false
</Directory>

and my input and output filter handlers would look something like this:

sub handler : FilterRequestHandler
{
        my $f = shift;

        return Apache2::Const::DECLINED if $f->r->dir_config (
'EnableMyFilter' ) eq 'false';

        ...
}

does that approach sound correct?

or is that i need to add an enabling / disabling filter into the
filter chain in front of my filter that reads the PerlSetVar option
and then either leaves my filter in the chain or uses something like
"$f->next->next...->remove" to remove it?

thanks,
mike


On Thu, Jul 30, 2009 at 12:26 PM, Torsten
Foertsch<torsten.foert...@gmx.net> wrote:
> On Thu 30 Jul 2009, Torsten Foertsch wrote:
>
> Sorry, I hit return while one of my left hand fingers rested on the CTRL
> key and the MUA interpreted this as "send mail now".
>
> So, here comes the rest of what I wanted to say.
>
>> On Wed 29 Jul 2009, Mike Barborak wrote:
>> > is there magic to remove filters for a subdirectory or even disable
>> > mod_perl altogether?
>>
>> A filter can remove itself on first invocation ($f->remove). It can
>> also remove any filter further down the filter chain
>> ($f->next->next...->remove).
>
> So, you can write a simple filter that checks things and removes the
> next filter in the chain if necessary. Then you insert this filter
> right before the unwanted one.
>
> You can also disable mod_perl for certain request phases:
>
> http://perl.apache.org/docs/2.0/user/config/config.html#C_Perl_Handler_
>
> or completely:
>
> http://perl.apache.org/docs/2.0/user/config/config.html#C_Enable_
>
> Torsten
>
> --
> Need professional mod_perl support?
> Just hire me: torsten.foert...@gmx.net
>

Reply via email to