You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ken Williams <ke...@mathforum.org> on 2002/05/03 08:07:22 UTC
Re: Can mod_perl help me use ENV variables in httpd.conf?
On Wednesday, May 1, 2002, at 05:04 AM, Fran Fabrizio wrote:
>
> I spoke too soon.
>
> I need:
>
> <Perl>
> push @Alias, [ qw(/cgi-bin/chimpkit/ $ENV{SERVER_ROOT}/cgi-
> bin/chimpkit/) ];
> </Perl>
>
> This does not appear to be possible because there's no way to
> pass in SERVER_ROOT to the apache startup.
I think the problem is your Perl syntax, not the value of the
variable. Scalars do not interpolate in qw() constructs. Try
this instead:
<Perl>
push @Alias, '/cgi-bin/chimpkit/', "$ENV{SERVER_ROOT}/cgi-
bin/chimpkit/";
</Perl>
or even
<Perl>
push @Alias, '/cgi-bin/chimpkit/',
$r->server_root_relative . '/cgi-bin/chimpkit/';
</Perl>
-Ken
Re: Can mod_perl help me use ENV variables in httpd.conf?
Posted by Fran Fabrizio <ff...@mmrd.com>.
What I was really looking for was $r->server_root_relative. =) Thanks
Geoff!
That's to all for your help.
-Fran
> You'll also need to use a PerlPassEnv directive prior to your <Perl>
> block.
>
> For debug purposes, try adding the following inside your <Perl> block:
>
> print join("\n", map { "$_ => $ENV{$_}" } (keys %ENV)), "\n";
>
> OR, my personal quick-debugging catch-all:
>
> use Data::Dumper;
> print Dumper \%ENV;
>
> You'll be able to see what is available in %ENV when running under
> mod_perl. See also Chapter 9, page 498 of the Eagle.
>
> jason
>
> Ken Williams wrote:
>
>>
>> On Wednesday, May 1, 2002, at 05:04 AM, Fran Fabrizio wrote:
>>
>>>
>>> I spoke too soon.
>>>
>>> I need:
>>>
>>> <Perl>
>>> push @Alias, [ qw(/cgi-bin/chimpkit/ $ENV{SERVER_ROOT}/cgi-
>>> bin/chimpkit/) ];
>>> </Perl>
>>>
>>> This does not appear to be possible because there's no way to pass
>>> in SERVER_ROOT to the apache startup.
>>
>>
>>
>> I think the problem is your Perl syntax, not the value of the
>> variable. Scalars do not interpolate in qw() constructs. Try this
>> instead:
>>
>> <Perl>
>> push @Alias, '/cgi-bin/chimpkit/', "$ENV{SERVER_ROOT}/cgi-
>> bin/chimpkit/";
>> </Perl>
>>
>> or even
>>
>> <Perl>
>> push @Alias, '/cgi-bin/chimpkit/',
>> $r->server_root_relative . '/cgi-bin/chimpkit/';
>> </Perl>
>>
>> -Ken
>>
>
Re: Can mod_perl help me use ENV variables in httpd.conf?
Posted by Jason Woodward <jd...@kobasoft.com>.
You'll also need to use a PerlPassEnv directive prior to your <Perl> block.
For debug purposes, try adding the following inside your <Perl> block:
print join("\n", map { "$_ => $ENV{$_}" } (keys %ENV)), "\n";
OR, my personal quick-debugging catch-all:
use Data::Dumper;
print Dumper \%ENV;
You'll be able to see what is available in %ENV when running under
mod_perl. See also Chapter 9, page 498 of the Eagle.
jason
Ken Williams wrote:
>
> On Wednesday, May 1, 2002, at 05:04 AM, Fran Fabrizio wrote:
>
>>
>> I spoke too soon.
>>
>> I need:
>>
>> <Perl>
>> push @Alias, [ qw(/cgi-bin/chimpkit/ $ENV{SERVER_ROOT}/cgi-
>> bin/chimpkit/) ];
>> </Perl>
>>
>> This does not appear to be possible because there's no way to pass in
>> SERVER_ROOT to the apache startup.
>
>
> I think the problem is your Perl syntax, not the value of the variable.
> Scalars do not interpolate in qw() constructs. Try this instead:
>
> <Perl>
> push @Alias, '/cgi-bin/chimpkit/', "$ENV{SERVER_ROOT}/cgi-
> bin/chimpkit/";
> </Perl>
>
> or even
>
> <Perl>
> push @Alias, '/cgi-bin/chimpkit/',
> $r->server_root_relative . '/cgi-bin/chimpkit/';
> </Perl>
>
> -Ken
>