X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/016609bcafdaad73410c6984a3d020d5529e5770..8e19b54af507c5ab27542aecc414a80a5ab67428:/lib/lib.pm diff --git a/lib/lib.pm b/lib/lib.pm index 8ca28de..4d32f96 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 or C statements will find modules which are not located on perl's default search path. - =head2 ADDING DIRECTORIES TO @INC The parameters to C 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