Practical mod_perl / HTML Book /



previous page: 4.2.11. PerlSetVar and PerlAddVar
  
page up: HTML Version of the book
  
next page: 4.2.13. PerlWarn and PerlTaintCheck

4.2.12. PerlSetupEnv


Certain Perl modules used in CGI code (such as CGI.pm) rely on a number of environment variables that are normally set by mod_cgi. For example, many modules depend on QUERY_STRING, SCRIPT_FILENAME, and REQUEST_URI. When the PerlSetupEnv directive is turned on, mod_perl provides these environment variables in the same fashion that mod_cgi does. This directive is On by default, which means that all the environment variables you are accustomed to being available under mod_cgi are also available under mod_perl.

The process of setting these environment variables adds overhead for each request, whether the variables are needed or not. If you don't use modules that rely on this behavior, you can turn it off in the general configuration and then turn it on in sections that need it (such as legacy CGI scripts):

PerlSetupEnv Off
<Location /perl-run>
    SetHandler perl-script
    PerlHandler Apache::PerlRun
    Options +ExecCGI
    PerlSetupEnv On
</Location>

You can use mod_perl methods to access the information provided by these environment variables (e.g., $r->path_info instead of $ENV{PATH_INFO}). For more details, see the explanation in Chapter 11.

 

Continue to:

  • prev: 4.2.11. PerlSetVar and PerlAddVar
  • Table of Contents
  • next: 4.2.13. PerlWarn and PerlTaintCheck







TOP
previous page: 4.2.11. PerlSetVar and PerlAddVar
  
page up: HTML Version of the book
  
next page: 4.2.13. PerlWarn and PerlTaintCheck


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com