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 <j...@jhmg.net> 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 (j...@acm.org)
> PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88
>



-- 
John Dunlap
*CTO | Lariat *

*Direct:*
*j...@lariat.co <j...@lariat.co>*

*Customer Service:*
877.268.6667
supp...@lariat.co

Reply via email to