perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <>
Subject Re: [mp1] subprocess_env and non-mod_perl handlers
Date Tue, 04 May 2004 00:02:35 GMT

> Example 1:
> I have mod_perl handlers defined for the TypeHandler and FixupHandler 
> phases. If in the TypeHandler code I do this:
> $r->subprocess_env("TEST" => "value");
> Then in FixupHandler I can "see" TEST using:
> $something = $r->subprocess_env("TEST");
> Which is what you would expect.


> Example 2:
> Basically the same except I have a C handler defined for TypeHandler and 
>   a mod_perl handler defined for FixupHandler. When the C code does:
> ap_table_set(r->subprocess_env, "TEST", "value");
> The mod_perl handler for FixupHandler doesn't see it using:
> $something = $r->subprocess_env("TEST");

that's not right.  however, I can't reproduce this with the attached minimal
test case.  see

> If I do the void subprocess_env trick:
> $r->subprocess()
> before retrieving $something, then it's populated along with the rest of 
> the environment.

that only affects %ENV, not the ability of $r->subprocess_env to grab
something from the subprocess_env table.  %ENV is not automatically
populated with the contents of subprocess_env, so if you're really talking
about %ENV then your Example 2 + subprocess_env() trick sounds right.

> However, as mentioned in many of the docs/books, this is expensive and I 
> really only need the one variable.
> I've also tried walking the subprocess_env table in the perl handler, 
> but the value set in the C handler is not there.

that's really strange.  are you sure that you are not removing it in your
application someplace?  try tweaking the test tarball I mentioned bit by bit
until it has the relevant logic from your code in it.  I can't tell you the
number of bugs I've "fixed" by trying to reproduce the bug, only to find I
was the bug :)

> Are the C API subprocess_env table and the mod_perl API subprocess_env 
> table distict until something (like the void call) merges the tables? Is 
> this some sort of scoping issue between C and Perl?

it shouldn't be, so long as you're hitting the tables directly with
$r->subprocess_env.  %ENV is another matter entirely.


Report problems:
Mail list info:
List etiquette:

View raw message