logo       

Re: <perl> section: <Files> under <Directory> - whats wrong here?: msg#00239

apache.mod-perl

Subject: Re: <perl> section: <Files> under <Directory> - whats wrong here?

PVM@xxxxxxxxx wrote:
Hi,

In a regular Apache configuration style, this works for me:

<Directory /usr/local/httpd/htdocs/capmon/>
<Files '_*.mod'>
PerlSetEnv PERL5LIB /opt/capmon/inc:/usr/local/httpd/htdocs/capmon/cgi
PerlSendHeader On
SetHandler perl-script
PerlHandler Apache::Registry
</Files>
</Directory>

Now why doesn't this work in a <perl> </perl> section, :

$Directory = {
'/usr/local/httpd/htdocs/capmon/' => {
'Files' => {
'_*.mod' => {
'PerlHandler' => 'Apache::Registry',
'PerlSendHeader' => 'On',
'PerlSetEnv' => [
'PERL5LIB',
'/opt/capmon/inc:/usr/local/httpd/htdocs/capmon/cgi'
],
'SetHandler' => 'perl-script'
}
}
}
};

It gives no errors, but just doesn't treat it as CGI. As far as I can see,
it is *exactly* equivalent to the <Directory> section at the top, isn't it?

In a <perl> </perl> section, this works *does* work:

$Files = {
'_*.mod' => {
'PerlHandler' => 'Apache::Registry',
'PerlSendHeader' => 'On',
'PerlSetEnv' => [
'PERL5LIB',
'/opt/capmon/inc:/usr/local/httpd/htdocs/capmon/cgi'
],
'SetHandler' => 'perl-script'
}
};

But it isn't limited to the /usr/local/httpd/htdocs/capmon/ directory.

How do I restrict it to a particular directory?

I've read the
http://perl.apache.org/docs/1.0/guide/config.html#Apache_Configuration_in_Perl

section
and
http://modperl.com:9000/book/chapters/ch8.html#Configuring_Apache_with_Perl
and especially from the last reference, I've tried to follow the "Directive
is a Nested Block " section exactly. Are there any other pointers?

Peter, there are two problems:

1. you misread the usage explanations

It cannot be:

$Directory = { }

it must be:

%Directory = ().

Reread http://modperl.com:9000/book/chapters/ch8.html#Configuring_Apache_with_Perl
again for the explanation. It seems that you've snipped the part from the virtual host examples but didn't set the right type for Directory.

2. It seems that there is a bug in the code that handles the Files sections when they are nested inside another section. I'll post a separate report regarding this to the dev list.

here is a workaround that should solve your problem:

$Directory{'/usr/local/httpd/htdocs/capmon/'} = {
FilesMatch => {
'\.pl$' => {
'Options' => '+ExecCGI',
'SetHandler' => 'perl-script',
'PerlSendHeader' => 'On',
'PerlHandler' => 'Apache::Registry'
},
},
};

add 'PERL5LIB' etc...

P.S: When you subscribe to this mailing list, or when you look for the FAQ
on Google, you are pointed towards:
http://perl.apache.org/faq/
But this is a 404...

This doc has been dissolved into various docs, spread across various dirs, so it's impossible to add a rewrite rule. Hence the 404. I'll fix the mailing list doc to reflect the reality. Thanks for the report. Hopefully Google will catch up with the changes on the site soon.

__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise