Add module search path using PERL5LIB environment variable

Explains how to add a module search path using the PERL5LIB environment variable.

Linux bash environment variable

The following is bash environment of Linux How to add a module search path by setting "PERL5LIB" in the variable. Add this to the ".bashrc" file.

export PERL5LIB =/foo/lib

If you specify more than one, separate them with a colon.

export PERL5LIB =/foo/lib:/bar/lib

csh environment variable such as commercial UNIX

It is a method to add the search path of the module by setting "PERL5LIB" in the environment variable of csh in commercial UNIX such as FreeBSD. Add this to the "~/.cshrc" file.

setenv PERL5LIB/foo/lib

If you specify more than one, separate them with a colon.

setenv PERL5LIB/foo/lib:/bar/lib

Environment variable in Windows

It is a method to add the search path of the module by setting the environment variable "PERL5LIB" on Windows. The method of setting environment variable in Windows is added by GUI, so please check the method.

# Value of environment variable PERL5LIB
/ foo/lib

If you specify more than one, separate them with a semicolon. This is a different part from Unix/Linux.

# Value of environment variable PERL5LIB
/ foo/lib;/bar/lib

Environment variable PERL5LIB is not portable

The environment variable PERL5LIB is not a portable method because the way environment variable are represented differs depending on the OS.

On the other hand, although it is tightly coupled with the script, lib module works the same in any environment.

Related Informatrion