perlquestion
olus
Hi Monks,<br>
<br>
I'm trying to read a variable, that was set on the apache2 conf with PerSetVar, on a PerlPostReadRequestHandler, but so far all my tries failed.<br>
I do see the variable when accessing it from the requested page.<br>
<br>
A snipet of the post read request handler code:
<code>
...
sub handler {
my $r = shift;
my $var = $r->dir_config('var');
$ENV{'VAR'} = $var;
$ENV{'AM_I_SET'} = 'Yes';
return Apache2::Const::OK;
}
</code>
When printing the %ENV I see AM_I_SET as 'Yes' but VAR is undef.<br>
<br>
On the requested page I have:
<code>
my $r = shift;
# template initialization not shown
my $var = $r->dir_config('var');
$vars{'message'} = "Var is: $var";
$vars{'message'} .= '<br />'.Dumper(\%ENV);
$template->process("hello.html", \%vars) || die $template->error();
</code>
The resulting web page will correctly display the value of 'var' and undef on %ENV.<br>
<br>
I've been browsing the <a href="http://perl.apache.org/docs/2.0/">mod_perl2 docs</a>, the <a href="http://modperlbook.org/html/index.html">Practical mod_perl book</a> and searching the monastery and the web, but still haven't found the solution.<br>
<br>
So, is it possible to access variables set with PerlSetVar from within the early handlers (those other than the final script)? How? What am I not doing?<br>
<br>
--<br>
olus