<div dir="ltr"><div><div>How can mod-perl access environment variables set by other Apache modules? I tried the following:</div><div><br></div><div>in the virtual host config I set:</div></div><div><br></div><div> SetEnvIf Request_URI "\.html$" TE=TEST</div>
<div> PerlRequire "/opt/modperl/TE/ST.pm"</div><div> PerlOutputFilterHandler TE::ST</div><div><br></div><div>the contents of /opt/modperl/TE/ST.pm is as follows:</div><div>======================================================================</div>
<div>package TE::ST;</div><div><br></div><div>use strict;</div><div>use warnings;</div><div><div>use Apache2::Filter ();</div><div>use Apache2::RequestRec ();</div><div>use APR::Table ();</div><div><br></div><div>BEGIN { push @INC, "/opt/modperl/"; }</div>
<div><br></div><div>use Apache2::Const -compile => qw(OK);</div><div>use constant BUFF_LEN => 1024;</div><div><br></div><div>sub handler</div><div>{</div><div> my $f = shift;</div><div><br></div><div> unless ($f->ctx)</div>
<div> {</div><div> while ($f->read(my $buffer, BUFF_LEN))</div><div> {</div><div> $buffer =~ s/It/Eli/g;</div><div> $buffer .= $ENV{"TE"};</div>
<div> $f->print($buffer);</div><div> }</div><div> return Apache2::Const::OK;</div><div> }</div><div>}</div><div>1;</div><div><br></div><div>The 'It' in the index.html file is changed properly, but I the 'TE' environment variable setup by SetEnvIf does not show up. Any ideas what I'm missing?</div>
<div><br></div><div>Thanks,</div><div>Eli</div></div></div>