From: Rafael Garcia-Suarez Date: Mon, 14 Nov 2005 15:40:08 +0000 (+0000) Subject: A better fix for [perl #35847] File::Find not performing as documented, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=54bd407c97e6a92e0d8fe74bdc8d886f888a65cc;p=p5sagit%2Fp5-mst-13.2.git A better fix for [perl #35847] File::Find not performing as documented, suggested by Darren Dunham. Includes a fix to the code example that uses File::Find in perlfaq3. p4raw-id: //depot/perl@26128 --- diff --git a/lib/File/Find.pm b/lib/File/Find.pm index e41c241..497051e 100644 --- a/lib/File/Find.pm +++ b/lib/File/Find.pm @@ -120,11 +120,10 @@ If either I or I is in effect: =item * -Previous versions of File::Find were guaranteed to call an I -before the user's C function was called, but this is no -longer the case. Since this depends on C<$File::Find::dont_use_nlink>, $^O, -and other factors, fast file checks involving C<_> are not recommended -unless C calls I first. +It is guaranteed that an I has been called before the user's +C function is called. This enables fast file checks involving S<_>. +Note that this guarantee no longer holds if I or I +are not set. =item * diff --git a/pod/perlfaq3.pod b/pod/perlfaq3.pod index 67a8d43..02e15b7 100644 --- a/pod/perlfaq3.pod +++ b/pod/perlfaq3.pod @@ -85,10 +85,12 @@ with File::Find which is part of the standard library. use File::Find; my @files; - find sub { push @files, $File::Find::name if -f _ && /\.pm$/ }, - @INC; + find( + sub { push @files, $File::Find::name if -f $File::Find::name && /\.pm$/ }, + @INC + ); - print join "\n", @files; + print "$_\n" for @files; If you simply need to quickly check to see if a module is available, you can check for its documentation. If you can