From: Gurusamy Sarathy Date: Thu, 6 Jan 2000 19:51:08 +0000 (+0000) Subject: add undocumented globals for compatibility--find.pl, and find2perl X-Git-Tag: accepted/trunk/20130322.191538~35715 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7b91b67de5d0f0f6a116fcb08b706e17f3f0bd8;p=platform%2Fupstream%2Fperl.git add undocumented globals for compatibility--find.pl, and find2perl generated code need them (from Helmut Jarausch ) p4raw-id: //depot/perl@4764 --- diff --git a/lib/File/Find.pm b/lib/File/Find.pm index 5cd58c6..c674b2c 100644 --- a/lib/File/Find.pm +++ b/lib/File/Find.pm @@ -122,6 +122,10 @@ When or are in effect there is also a C<$File::Find::fullname>. The function may set C<$File::Find::prune> to prune the tree unless C was specified. +Unless C or C is specified, for compatibility +reasons (find.pl, find2perl) there are in addition the following globals +available: C<$File::Find::topdir>, C<$File::Find::topdev>, C<$File::Find::topino>, +C<$File::Find::topmode> and C<$File::Find::topnlink>. This library is useful for the C tool, which when fed, @@ -286,6 +290,8 @@ sub _find_opt { $untaint_pat = $wanted->{untaint_pattern}; $untaint_skip = $wanted->{untaint_skip}; + # for compatability reasons (find.pl, find2perl) + our ($topdir, $topdev, $topino, $topmode, $topnlink); # a symbolic link to a directory doesn't increase the link count $avoid_nlink = $follow || $File::Find::dont_use_nlink; @@ -295,7 +301,7 @@ sub _find_opt { die "insecure cwd in find(depth)" unless defined($cwd_untainted); } - my ($abs_dir, $nlink, $Is_Dir); + my ($abs_dir, $Is_Dir); Proc_Top_Item: foreach my $TOP (@_) { @@ -324,14 +330,15 @@ sub _find_opt { } } else { # no follow - $nlink = (lstat $top_item)[3]; - unless (defined $nlink) { + $topdir = $top_item; + ($topdev,$topino,$topmode,$topnlink) = lstat $top_item; + unless (defined $topnlink) { warn "Can't stat $top_item: $!\n"; next Proc_Top_Item; } if (-d _) { $top_item =~ s/\.dir$// if $Is_VMS; - _find_dir($wanted, $top_item, $nlink); + _find_dir($wanted, $top_item, $topnlink); $Is_Dir= 1; } else {