[ID 20010529.003] find2perl and File::Find doesn't emulate find when path is a symlin...
David Dyck [Tue, 29 May 2001 12:19:38 +0000 (05:19 -0700)]
Message-Id: <Pine.LNX.4.33.0105291216510.17409-100000@dd.tc.fluke.com>

p4raw-id: //depot/perl@10308

lib/File/Find.pm

index ef3d241..cec6afb 100644 (file)
@@ -330,9 +330,8 @@ sub _find_opt {
         $top_item =~ s|/\z|| unless $top_item eq '/';
         $Is_Dir= 0;
         
-        ($topdev,$topino,$topmode,$topnlink) = stat $top_item;
-
         if ($follow) {
+           ($topdev,$topino,$topmode,$topnlink) = stat $top_item;
             if (substr($top_item,0,1) eq '/') {
                 $abs_dir = $top_item;
             }
@@ -353,6 +352,7 @@ sub _find_opt {
             }
         }
        else { # no follow
+           ($topdev,$topino,$topmode,$topnlink) = lstat $top_item;
             $topdir = $top_item;
             unless (defined $topnlink) {
                 warn "Can't stat $top_item: $!\n";