summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/lib/File/Find.pm
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/perl5/lib/File/Find.pm')
-rw-r--r--contrib/perl5/lib/File/Find.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/contrib/perl5/lib/File/Find.pm b/contrib/perl5/lib/File/Find.pm
index 1305d21..7e67003 100644
--- a/contrib/perl5/lib/File/Find.pm
+++ b/contrib/perl5/lib/File/Find.pm
@@ -22,10 +22,10 @@ finddepth - traverse a directory structure depth-first
=head1 DESCRIPTION
The first argument to find() is either a hash reference describing the
-operations to be performed for each file, or a code reference. If it
-is a hash reference, then the value for the key C<wanted> should be a
-code reference. This code reference is called I<the wanted()
-function> below.
+operations to be performed for each file, a code reference, or a string
+that contains a subroutine name. If it is a hash reference, then the
+value for the key C<wanted> should be a code reference. This code
+reference is called I<the wanted() function> below.
Currently the only other supported key for the above hash is
C<bydepth>, in presense of which the walk over directories is
@@ -177,6 +177,8 @@ sub finddir {
--$subcount;
next if $prune;
+ # Untaint $_, so that we can do a chdir
+ $_ = $1 if /^(.*)/;
if (chdir $_) {
$name =~ s/\.dir$// if $Is_VMS;
&finddir($wanted,$name,$nlink, $bydepth);
@@ -194,7 +196,7 @@ sub finddir {
sub wrap_wanted {
my $wanted = shift;
- defined &$wanted ? {wanted => $wanted} : $wanted;
+ ref($wanted) eq 'HASH' ? $wanted : { wanted => $wanted };
}
sub find {
OpenPOWER on IntegriCloud