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 listdeletes 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;
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access