summaryrefslogtreecommitdiff
path: root/lib/lib.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib.pm')
-rw-r--r--lib/lib.pm14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/lib.pm b/lib/lib.pm
index 8ca28de3ea..4d32f96355 100644
--- a/lib/lib.pm
+++ b/lib/lib.pm
@@ -1,10 +1,10 @@
package lib;
+use vars qw(@ORIG_INC);
use Config;
my $archname = $Config{'archname'};
-@ORIG_INC = (); # (avoid typo warning)
@ORIG_INC = @INC; # take a handy copy of 'original' value
@@ -15,13 +15,16 @@ sub import {
next unless defined($_);
if ($_ eq '') {
require Carp;
- Carp::carp("Empty compile time value given to use lib"); # at foo.pl line ...
+ Carp::carp("Empty compile time value given to use lib");
+ # at foo.pl line ...
}
unshift(@INC, $_);
# Put a corresponding archlib directory infront of $_ if it
# looks like $_ has an archlib directory below it.
- unshift(@INC, "$_/$archname/$]") if -d "$_/$archname/$]/auto";
- unshift(@INC, "$_/$archname") if -d "$_/$archname/auto";
+ if (-d "$_/$archname") {
+ unshift(@INC, "$_/$archname") if -d "$_/$archname/auto";
+ unshift(@INC, "$_/$archname/$]") if -d "$_/$archname/$]/auto";
+ }
}
}
@@ -67,7 +70,6 @@ It is typically used to add extra directories to perl's search path so
that later C<use> or C<require> statements will find modules which are
not located on perl's default search path.
-
=head2 ADDING DIRECTORIES TO @INC
The parameters to C<use lib> are added to the start of the perl search
@@ -87,7 +89,6 @@ architecture specific directory and is added to @INC in front of $dir.
If LIST includes both $dir and $dir/$archname then $dir/$archname will
be added to @INC twice (if $dir/$archname/auto exists).
-
=head2 DELETING DIRECTORIES FROM @INC
You should normally only add directories to @INC. If you need to
@@ -113,7 +114,6 @@ architecture specific directory and is also deleted from @INC.
If LIST includes both $dir and $dir/$archname then $dir/$archname will
be deleted from @INC twice (if $dir/$archname/auto exists).
-
=head2 RESTORING ORIGINAL @INC
When the lib module is first loaded it records the current value of @INC