I've seen it done where you can make a home-grown module that has a second 
package declaration for Apache[2]::ReadConfig.  Something like ...


... in httpd.conf ...

<Perl>
   use Some::Module;
   Some::Module::my_custom_config();
</Perl>



... in Module.pm ...

package Some::Module;


sub my_custom_config(;){

   package Apache2::ReadConfig;

   use strict;
   use vars qw(
          $ServerName $ServerRoot $DocumentRoot $User $Group
          @PerlChildInitHandler @PerlChildExitHandler
          %DirectoryMatch %Directory %Location
          ...
       );

   for my $uri (...) {
      $Location{$uri} ...



You can reference: 
 http://perl.apache.org/docs/2.0/api/Apache2/PerlSections.html   for a bit more 
info as well.

Going from memory so I could be a bit rusty, but I think it's close.  Hope it 
helps,
- Jeff



________________________________
From: E R <pc88m...@gmail.com>
To: modperl <modperl@perl.apache.org>
Sent: Mon, February 28, 2011 1:03:41 PM
Subject: How to reference %Location outside of <Perl>...</Perl>?

I have the following <Perl> block in my httpd.conf file which installs
mod-perl handlers for a list of urls:

<Perl>
  ...
  for my $uri (...) {
    $Location{$uri} = ...;
  }
</Perl>

If I wanted to move this code to a normal perl module, how should I
reference %Location?

Thanks,
ER

Reply via email to