Re: PerlSetVar inside <Location> doesn't seem to work

John Dunlap <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC5eUSt5Kc24Wwid8HdSFUMC=HPGS6PVfpGohnvhmtkByH1XpQ@mail.gmail.com>
I'm also using a virtual host, though I place my PerlSetVar without a
<Directory>. This is the code that I use to extract them:

        foreach my $apache_key (CORE::keys %{$apache->dir_config}) {
$literals{$apache_key} = $apache->dir_config->{$apache_key};
        }

In this example, $apache is an instance of Apache2::RequestRec

On Wed, Jul 15, 2015 at 8:07 PM, Jim Garrison <[email protected]> wrote:

> I have the following config
>
>
> >     <VirtualHost [redacted]:80>
> >
> >         ...
> >
> >         PerlOptions +Parent
> >         PerlSwitches -T -w -I/home/pdxep/gallery
> >
> >         PerlModule Apache2::Reload
> >         PerlModule Album
> >         PerlModule env
> >
> >         <Location /gallery>
> >
> >             PerlInitHandler Apache2::Reload
> >
> >             PerlSetVar app_dir      /var/webapp
> >             PerlSetVar template_dir /templates
> >             PerlSetVar albums_dir   /albums
> >             PerlSetVar static_url   /static
> >             PerlSetVar albums_url   /albums
> >
> >             SetHandler perl-script
> >             PerlResponseHandler Album
> >
> >         </Location>
> >
> >         <Location /env>
> >             SetHandler perl-script
> >             PerlResponseHandler env
> >         </location>
> >
> >     </VirtualHost>
>
> My handler script (Album.pm) retrieves the variables with
>
>     my $s = Apache2::ServerUtil->server;
>     my $app_dir      = $s->dir_config('app_dir');
>     my $template_dir = $app_dir . $s->dir_config('template_dir');
>
> However it's getting empty strings for the values.  This was working
> when the PerlSetVar directives were outside the VirtualHost block.
>
> According to the documentation
>
>
> https://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_Directives_Argument_Types_and_Allowed_Location
>
> PerlSetVar is scoped "DIR" meaning it can appear in Directory,
> Location or Files blocks.  What am I doing wrong?
>
> --
> Jim Garrison ([email protected])
> PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88
>



-- 
John Dunlap
*CTO | Lariat *

*Direct:*
*[email protected] <[email protected]>*

*Customer Service:*
877.268.6667
[email protected]
100x60.png (image/png, 2.1 KB) - not displayed
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.