OK, figured out how to make the SetEnv bit work. Just set $ENV directly in the 
<Perl> section. Seems a bit inconsistent that you can't push on @SetEnv as you 
would for other directives, but oh, well.

So now, I am trying to figure out how to do the equivalent of this in a Perl 
section:

---
<Directory "C:/Users/Desiletsa/Documents/eclipse_workspace/WeBiText/htdocs">
  Order Deny,Allow
  Allow from all
</Directory>
---

Here is what I tried;

---
<Perl>
        
$Directory{"C:/Users/Desiletsa/Documents/eclipse_workspace/WeBiText/htdocs"} =
                {
                        Order => 'Deny,Allow',
                        Allow => 'from,all'
                };
</Perl>
---

But Apache does not start. What am I doing wrong here?

________________________________________
From: Desilets, Alain [alain.desil...@nrc-cnrc.gc.ca]
Sent: Monday, January 16, 2012 4:36 PM
To: modperl@perl.apache.org
Subject: Perl sections in Apache conf files

I am trying to use <Perl> sections in my Apache conf files, in order to 
automate management of my various installations on various servers.

Looking at this page:

http://perl.apache.org/docs/2.0/api/Apache2/PerlSections.html#Configuration_Variables

I gather that any directive that can be written in an Apache conf file, can 
also be written as a perl statement in a <Perl> section of the Apache conf file.

As I understand it, you do this by pushing the directives arguments to an array 
whose name is the same as the directive.

For example, if I want to write a Perl statement which does the equivalent of 
this:

---
SetEnv HELLO_WORLD "Salutation earthlings"
---

I would write this:

---
<Perl>
   push @SetEnv, "HELLO_WORLD", "Salutation earthlings";
</Perl>
---

Is that correct?

I have tried this, but it does not seem to work. The reason I say this is that 
if I run a script that prints the environment:

--- print_env.cgi:
print "Content-type: text/plain\r\n\r\n";

print "Environment variables are:\n";
foreach my $a_key ( keys %ENV ) {
    print "$a_key:\t$ENV{$a_key}\n";
}
--- end of print_env.cgi

I do see a HELLO_WORLD variable,  but it's empty. I also see a Salutation 
variable (also empty), which I guess is what Apache did with the first word the 
value which I intended for HELLO_WORLD. There is no "earthlings" variable.

What am I doing wrong?

Reply via email to