This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.003_01: lib/lib.pm
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>
Mon, 3 Jun 1996 00:21:06 +0000 (00:21 +0000)
committerCharles Bailey <bailey@genetics.upenn.edu>
Mon, 3 Jun 1996 00:21:06 +0000 (00:21 +0000)
Handle empty strings gracefully
Look for architecture-specific directory with or without version
Update reference to FindBin in documentation

lib/lib.pm

index 546ae87..8748613 100644 (file)
@@ -11,10 +11,15 @@ my $archname = $Config{'archname'};
 sub import {
     shift;
     foreach (reverse @_) {
+       unless (defined $_ and $_ ne '') {
+           require Carp;
+           Carp::carp("Empty or undefined compile time value given"); # 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";
+       unshift(@INC, "$_/$archname")    if -d "$_/$archname/auto";
     }
 }
 
@@ -118,7 +123,7 @@ can say
 
 =head1 SEE ALSO
 
-AddINC - optional module which deals with paths relative to the source file.
+FindBin - optional module which deals with paths relative to the source file.
 
 =head1 AUTHOR