Database Reference
In-Depth Information
require the library must set the appropriate variable. Alternatively, if the language
processor has a configuration file, you might be able to set a parameter in the file
that affects scripts globally for all users.
We'll use the second approach. For our API languages, the following table shows the
relevant variables. In each case, the variable value is a directory or list of directories:
Language
Variable name
Variable type
Perl
Environment variable
PERL5LIB
Ruby
Environment variable
RUBYLIB
PHP
include_path Configuration variable
Python
Environment variable
PYTHONPATH
Java
Environment variable
CLASSPATH
For general information on setting environment variables, read “Executing Programs
from the Command Line” on the companion website (see the Preface ). You can use
those instructions to set environment variables to the values in the following discussion.
Suppose that you want to install library files in a directory that language processors do
not search by default. For purposes of illustration, let's use /usr/local/lib/mcb on Unix
and C:\lib\mcb on Windows. (To put the files somewhere else, adjust the pathnames in
the variable settings accordingly. For example, you might want to use a different direc‐
tory, or you might want to put libraries for each language in separate directories.)
Under Unix, if you put Perl library files in the /usr/local/lib/mcb directory, set the
PERL5LIB environment variable appropriately. For a shell in the Bourne shell family ( sh ,
bash , ksh ), set the variable like this in the appropriate startup file:
export PERL5LIB=/usr/local/lib/mcb
For the original Bourne shell, sh , you may need to split this into two
commands:
PERL5LIB=/usr/local/lib/mcb
export PERL5LIB
For a shell in the C shell family ( csh , tcsh ), set PERL5LIB like this in your .login file:
setenv PERL5LIB /usr/local/lib/mcb
Under Windows, if you put Perl library files in C:\lib\mcb , set PERL5LIB as follows:
PERL5LIB=C:\lib\mcb
In each case, the variable value tells Perl to look in the specified directory for library
files, in addition to any other directories it searches by default. If you set PERL5LIB to
 
Search WWH ::




Custom Search