1

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?

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Kev
  • 15,899
  • 15
  • 79
  • 112

1 Answers1

2

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>
Community
  • 1
  • 1
innaM
  • 47,505
  • 4
  • 67
  • 87
  • Oh, okay, that part of the docs is actually true. I had tried the $ServerName they refer to and was beginning to assume it was fabricated... ;) – Kev Sep 24 '09 at 19:59
  • sorry for bringing up the dead, but I am new to perl and im trying to get this thing working... i am getting this exact error but I do not understand what I am meant to do. its all new to me I dont want to break anything. could you direct me into what the problem is so i can search abit more? – TheHidden Mar 30 '16 at 14:11