You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Ian D. Stewart" <id...@compuvative.com> on 2002/05/27 21:13:41 UTC

Referencing Directives

Is it possible to reference the value of one Directive within another 
Directive (e.g., PerlSetVar VariableName ${DocumentRoot}/subdir) ?


Thanx,
Ian

Re: Referencing Directives

Posted by "Ian D. Stewart" <id...@compuvative.com>.
On 2002.05.28 01:23 Per Einar Ellefsen wrote:

> 
> Or... maybe you could try using Apache class methods inside <Perl> 
> sections (like document_root) -- however I think that'd be pretty 
> shaky.

Hmm...something to tinker with as time permits...


Thanx,
Ian

Re: Referencing Directives

Posted by "Ian D. Stewart" <id...@compuvative.com>.
On 2002.05.27 15:39 Per Einar Ellefsen wrote:
> At 21:13 27.05.2002, Ian D. Stewart wrote:
>> Is it possible to reference the value of one Directive within 
>> another Directive (e.g., PerlSetVar VariableName 
>> ${DocumentRoot}/subdir) ?
> 
> If you use <Perl> sections, yes.
> 
> <Perl>
> $DocumentRoot = '/home/httpd/htdocs';
> push @PerlSetVar, [ VariableName => "$DocumentRoot/subdir"];
> </Perl>

Thanx Per.  I thought of something like that after I sent out the 
message, though wasn't sure of the syntax.

> 
> Note that you need to set $DocumentRoot in a <Perl> section as well.

So Directives declared outside the <Perl> section (e.g., ServerRoot, 
DocumentRoot, etc) are not accessible within the <Perl> section?

> 
> You might want to look at mod_macro too.

Will do.


Thanx,
Ian

Re: Referencing Directives

Posted by Per Einar Ellefsen <pe...@skynet.be>.
At 21:13 27.05.2002, Ian D. Stewart wrote:
>Is it possible to reference the value of one Directive within another 
>Directive (e.g., PerlSetVar VariableName ${DocumentRoot}/subdir) ?

If you use <Perl> sections, yes.

<Perl>
$DocumentRoot = '/home/httpd/htdocs';
push @PerlSetVar, [ VariableName => "$DocumentRoot/subdir"];
</Perl>

Note that you need to set $DocumentRoot in a <Perl> section as well.

You might want to look at mod_macro too.


-- 
Per Einar Ellefsen
per.einar@skynet.be