home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

3.3 Environment Variables

Environment variables are used to set user preferences. Individual Perl modules or programs are always free to define their own environment variables, and there is also a set of special environment variables that are used in the CGI environment (see Chapter 9, CGI Overview ).

Perl uses the following environment variables:

HOME

Used if chdir has no argument.

LOGDIR

Used if chdir has no argument and HOME is not set.

PATH

Used in executing subprocesses and in finding the script if -S is used.

PATHEXT

On Win32 systems, if you want to avoid typing the extension every time you execute a Perl script, you can set the PATHEXT environment variable so that it includes Perl scripts. For example:

> set PATHEXT=%PATHEXT%;.PLX
This setting lets you type:
> myscript
without including the file extension. Take care when setting PATHEXT permanently - it also includes executable file types like .com, .exe, .bat , and .cmd . If you inadvertently lose those extensions, you'll have difficulty invoking applications and script files.

PERL5LIB

A colon-separated list of directories in which to look for Perl library files before looking in the standard library and the current directory. If PERL5LIB is not defined, PERLLIB is used. When running taint checks, neither variable is used. The script should instead say:

use lib "/my/directory";

PERL5OPT

Command-line options (switches). Switches in this variable are taken as if they were on every Perl command line. Only the - [ DIMUdmw ] switches are allowed. When running taint checks, this variable is ignored.

PERLLIB

A colon-separated list of directories in which to look for Perl library files before looking in the standard library and the current directory. If PERL5LIB is defined, PERLLIB is not used.

PERL5DB

The command used to load the debugger code. The default is:

BEGIN { require 'perl5db.pl' }

PERL5SHELL

On Win32 systems, may be set to an alternative shell for Perl to use internally to execute "backtick" commands or the system function.

PERL_DEBUG_MSTATS

Relevant only if your Perl executable was built with -DDEBUGGING_MSTATS. If set, causes memory statistics to be dumped after execution. If set to an integer greater than one, it also causes memory statistics to be dumped after compilation.

PERL_DESTRUCT_LEVEL

Relevant only if your Perl executable was built with -DDEBUGGING. Controls the behavior of global destruction of objects and other references.

Perl also has environment variables that control how Perl handles data specific to particular natural languages. See the perllocale manpage.











??????????????@Mail.ru