more accurate require() pseudocode (from James P. Williams
Gurusamy Sarathy [Wed, 1 Dec 1999 19:09:31 +0000 (19:09 +0000)]
<James.P.Williams@USAHQ.UnitedSpaceAlliance.com>)

p4raw-id: //depot/perl@4610

pod/perlfunc.pod

index 16da798..fa67bab 100644 (file)
@@ -3424,15 +3424,16 @@ subroutine:
            foreach $prefix (@INC) {
                $realfilename = "$prefix/$filename";
                if (-f $realfilename) {
+                   $INC{$filename} = $realfilename;
                    $result = do $realfilename;
                    last ITER;
                }
            }
            die "Can't find $filename in \@INC";
        }
+       delete $INC{$filename} if $@ || !$result;
        die $@ if $@;
        die "$filename did not return true value" unless $result;
-       $INC{$filename} = $realfilename;
        return $result;
     }