I'm trying to use a [PerlSection][1]
to get the server name and then use it to configure some RewriteCond
-RewriteRule
pairs and some other things. It seems I can't get very far. It says you can do this:
Apache2->httpd_conf("PerlPassEnv $key $val");
But trying to start Apache I get this syntax error:
"Can't locate object method "httpd_conf" via package "Apache2"
The docs then refer to these two files I can supposedly find in the distribution, eg/httpd.conf.pl and eg/perl_sections.txt, but the mod_perl2 distribution doesn't even have an eg dir, and the original mod_perl's eg dir doesn't have either of those files either.
Google was no help either, for "Your search - perl_sections.txt site:http://perl.apache.org/dist/ - did not match any documents" and without the site restriction all I see, besides the docs, is one post asking about these files copied all over with no answer.
Anybody have any resources for how to actually use a <Perl> section?
I feel your pain. I used the docs to produce some educated guesses for my trial and error process. What finally worked was pushing all configuration item onto the @PerlConfig
array. Here's an example from my answer to a completely different question:
<Perl>
my @groups = qw/ foo bar baz /;
foreach ( @groups ) {
push @PerlConfig, qq| <Directory /home/www/$_> blah </Directory> |;
}
</Perl>