use lib
use lib "$ENV{HOME}/libperl"; # add ~/libperl
no lib "."; # remove cwdThis pragma simplifies the manipulation of
@INC at compile time. It is typically used to add
extra directories to Perl's search path so that later
do, require, and
use statements will find library files that aren't
located in Perl's default search path. It's especially important with
use, since that happens at compile time too, and
setting @INC normally (that is, at run time) would
be too late.
Parameters to use lib are prepended to the
beginning of Perl's search path. Saying use lib
LIST is almost the
same as saying BEGIN { unshift(@INC,
LIST) }, but
use lib LIST includes
support for platform-specific directories. For each given directory
$dir in its argument list, the
lib pragma also checks to see whether a directory
named $dir/$archname/auto exists. If so, the
$dir/$archname directory is assumed to be a
corresponding platform-specific directory, so is added to
@INC (in front of $dir).
To avoid redundant additions that slow access time and waste a
small amount of memory, trailing duplicate entries in
@INC are removed when entries are added.
Normally, you should only add directories
to @INC. If you do need to delete directories from
@INC, take care to delete only those that you
yourself added, or those that you're somehow certain aren't needed by
other modules in your program. Other modules may have added
directories to your @INC that they need for correct
operation.
The no lib pragma deletes all instances ...