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

E R <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Mon, Feb 28, 2011 at 4:41 PM, Jeff Nokes <[email protected]> wrote:
> 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 ...

Thanks, I've found that this works:

<Perl>
  use Some::Module;
  Some::Module::init(__PACKAGE__);
</Perl>

package Some::Module;

sub init {
  my $package = shift;
  *Redirect = *{ $package . "::Redirect" };
  push(@Redirect, [ '/to-cnn', 'http://cnn.com' ]);
  ...
}

Modperl2 uses a different package name for each <Perl> block.
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.