Re: How to reference %Location outside of <Perl>...</Perl>?

Jeff Nokes <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
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 <[email protected]>
To: modperl <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.