You need to use $f->r->subprocess_env in the filter. subprocess_env is
a RequestRec method, not a Filter method.
Adam
Chris Datfung wrote:
On Thu, Apr 15, 2010 at 12:23 AM, Perrin Harkins <phark...@gmail.com
<mailto:phark...@gmail.com>> wrote:
The subprocess_env info that Adam sent you should have worked. Can
you show us what you tried? Can you try it in a response handler to
make sure it's not an odd bug with filters?
Hi Perrin,
Thanks, subprocess_env works when just using a response handler. When
used with a filter I get the following error message:
==================================================================
[Thu Apr 15 11:47:34 2010] [error] [client 127.0.0.1] Can't locate
object method "subprocess_env" via package "Apache2::Filter" at
/opt/modperl//TE/ST.pm line 40.\n
[Thu Apr 15 11:47:34 2010] [debug] core.c(3765): [client 127.0.0.1]
(500)Unknown error 500: default_handler: ap_pass_brigade returned 500
[Thu Apr 15 11:47:34 2010] [error] [client 127.0.0.1] Can't locate
object method "subprocess_env" via package "Apache2::Filter" at
/opt/modperl//TE/ST.pm line 40.\n
==================================================================
Can I test the script to use Apache2:RequestRec for the subprocess_env?
The source of the package is as follows:
==================================================================
package TE::ST;
use strict;
use warnings;
use Apache2::Filter ();
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use APR::Table ();
BEGIN { push @INC, "/opt/modperl/"; }
use Apache2::Const -compile => qw(OK);
use constant BUFF_LEN => 1024;
sub handler
{
my $f = shift;
$f->subprocess_env;
my $envar = $ENV{TE};
unless ($f->ctx)
{
while ($f->read(my $buffer, BUFF_LEN))
{
$buffer =~ s/It/Chris/g;
$buffer .= "[" . $envar . "]";
$f->print($buffer);
}
return Apache2::Const::OK;
}
}
1;
==================================================================
Finally, the TE Apache environment variable is set in the virtual host
config via:
SetEnv TE TEST
Thanks,
- Chris