perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Dunlap <j...@lariat.co>
Subject Re: PerlSetVar inside <Location> doesn't seem to work
Date Thu, 16 Jul 2015 00:12:50 GMT
*within a <Directory>

On Wed, Jul 15, 2015 at 8:12 PM, John Dunlap <john@lariat.co> wrote:

> 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 <jhg@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 (jhg@acm.org)
>> PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88
>>
>
>
>
> --
> John Dunlap
> *CTO | Lariat *
>
> *Direct:*
> *john@lariat.co <john@lariat.co>*
>
> *Customer Service:*
> 877.268.6667
> support@lariat.co
>



-- 
John Dunlap
*CTO | Lariat *

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

*Customer Service:*
877.268.6667
support@lariat.co

Mime
View raw message