How do I fix problems with require or use statements in taint mode?
The Perl require and use statements also change slightly when taint mode is turned on. Basically, the path to load libraries/modules no longer contains “.” (the current directory) from its path. So if you load any libaries or modules relative to the current working directory without explicitly specifying the path, your script will break under taint mode. To further illustrate this, normally you can read a setup file in the current working directory in a CGI script with a command like: require “myscript.setup”; However, this will not work when taint mode is on. Instead, you must tell the require statement explicitly where to load the library since “.” is removed during taint mode from the @INC array. @INC contains a list of valid paths to read library files and modules from. If taint mode is on, you would simply change the above require code to the following: require “./myscript.setup”; This lets Perl know that the myscript.setup will be explicitly loaded from the current directory. Alt