Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.102 lessChapter 8
Standard Modules
Next: 8.104 locale
 

8.103 lib

Permits adding additional directories to Perl's default search path at compile time. The directories are added at the front of the search path.

use lib list;
adds the directories specified in list to @INC.

For each directory $dir in list, lib looks for an architecture-specific subdirectory that has an auto subdirectory under it-that is, it looks for $dir/$archname/auto. If it finds that directory, then $dir/$archname is also added to the front of @INC, preceding $dir.

Normally, you should only add directories to @INC. However, you can also delete directories. The statement:

no lib list
deletes the first instance of each named directory from @INC. To delete all instances of all the specified names from @INC, specify :ALL as the first parameter of list.

As with adding directories, lib checks for a directory called $dir/$archname/auto and deletes the $dir/$archname directory from @INC. You can restore @INC to its original value with:

@INC = @lib::ORIG_INC;


Previous: 8.102 lessPerl in a NutshellNext: 8.104 locale
8.102 lessBook Index8.104 locale



Banner.Novgorod.Ru