Getting %ENV into a filter

[prev] [thread] [next] [Date index for 2005/03/14]

From: Mike Whitaker
Subject: Getting %ENV into a filter
Date: 12:40 on 14 Mar 2005
I'm replacing a somewhat flaky use of mod_layout with a 
PerlOutputFilterHandler  - it's all a little bit ugly, but...

Basically:

I have a RewriteRule whose major function is to set an ENV variable 
(PACKAGE) dependent on the Host: header before invoking a CGI.

The output of this CGI gets passed through a filter, viz:

	PerlModule Foo
	AddHandler cgi-script .cgi
	<Directory "/foo/cgi/">
		AllowOverride None
		Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
		PerlOptions +SetupEnv
		PerlOutputFilterHandler Foo
	</Directory>

And then Foo.pm has a handler(), viz:

sub handler
{
	my $f = shift;
	$f->r->subprocess_env;
	my $p = $ENV{PACKAGE};
	...

}

And I get:

[Mon Mar 14 12:25:24 2005] [error] [client 192.168.1.107] Can't locate 
object method "subprocess_env" via package "Apache::RequestRec" at 
Foo.pm line 22.

If I leave the subprocess_env call out, it all works except (obviously) 
%ENV doesn't get populated.

What am I missing?

(Debian apache2 2.0.53, mod_perl 1.999.20)

Getting %ENV into a filter
Mike Whitaker 12:40 on 14 Mar 2005

Re: Getting %ENV into a filter
Mike Whitaker 13:19 on 14 Mar 2005

Re: Getting %ENV into a filter
Stas Bekman 13:25 on 14 Mar 2005

Generated at 16:59 on 18 Mar 2005 by mariachi v0.52