> question: how does one access the environment variables when using
> mod_perl as a transhandler?
[ SNIP transhandler vs content handler diffs ]
> Is there a better way to get at ENV stuff than subprocess_env?

The setup of %ENV is a convenience for CGI programmers.  In fact, other than
loading/caching scripts, most of what Apache::Registry does is emulate the
CGI environment by setting up the %ENV hash and STDIN/STDOUT.

But the information that is placed into %ENV is all copied from the request
record (which is normally not available to CGI scripts), e.g.:

sub handler {
   my $r = shift;

   # $ENV{REMOTE_ADDR}
   print $r->connection->remote_addr;

   # $ENV{DOCUMENT_ROOT}
   print $r->document_root;

   # $ENV{REQUEST_URI}
   print $r->uri;
}

These methods are all documented in the various mod_perl/Apache::*, plus the
guide, plus the Quick Reference card lists them.

Hope this helps!

L8r,
Rob

Reply via email to