Practical mod_perlPractical mod_perlSearch this book

A.4. Redirecting While Maintaining Environment Variables

Let's say you have a module that sets some environment variables. Redirecting most likely tells the web browser to fetch the new page. This makes it a totally new request, so no environment variables are preserved.

However, if you're using internal_redirect( ), you can make the environment variables visible in the subprocess via subprocess_env( ). The only nuance is that the %ENV keys will be prefixed with REDIRECT_. For example, $ENV{CONTENT_LENGTH} will become:

$r->subprocess_env->{REDIRECT_CONTENT_LENGTH};


Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.