7.2.41 lib - Manipulate @INC at Compile-Timeuse lib This module simplifies the manipulation of Perl's special @INC variable at compile-time. It is used to add extra directories to Perl's search path so that later use or require statements will find modules not located along Perl's default search path. 7.2.41.1 Adding directories
Directories itemized in
use lib
is almost the same as saying:
BEGIN { unshift(@INC,
The difference is that, for each directory in use Config; $archname = $Config{'archname'};
If so, the
If 7.2.41.2 Deleting directoriesYou should normally only add directories to @INC . If you need to delete directories from @INC , take care to delete only those you yourself added. Otherwise, be certain that the directories you delete are not needed by other modules directly or indirectly invoked by your script. Other modules may have added directories they need for correct operation. By default the statement:
no lib
deletes the first instance of each named directory from @INC . To delete multiple instances of the same name from @INC you can specify the name multiple times.
To delete all instances of all the specified names from
@INC
you can specify no lib qw(:ALL .);
For each directory in
If 7.2.41.3 Restoring the original directory list
When the lib module is first loaded, it records the current value of
@INC
in an array @INC = @lib::ORIG_INC; 7.2.41.4 See alsoThe AddINC module (not in the standard Perl library, but available from CPAN) deals with paths relative to the source file. |
|