In perl.git, the branch sprout/misc-post-5.16 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/969fbc7f80bc15e03eeb7c70e34dc2a91e0be118?hp=f0eae910d6824b0506e27b59338f2cf593419c04>

- Log -----------------------------------------------------------------
commit 969fbc7f80bc15e03eeb7c70e34dc2a91e0be118
Author: jkeenan <[email protected]>
Date:   Fri Apr 6 20:20:59 2012 -0400

    Individual files may appear in list of directories to be searched.
    
    Document that, then demonstrate that with additional tests.
    
    For RT #59750.

M       lib/File/Find.pm

commit 6828b88713d36b478467fb2ebc5e586229ccdec4
Author: jkeenan <[email protected]>
Date:   Thu Apr 5 20:41:14 2012 -0400

    Individual files may appear in list of directories to be searched.
    
    Document that, then demonstrate that with additional tests.
    
    For RT #59750.

M       lib/File/Find/t/find.t

commit 9e35a15de905c2e20541ad9a856fa3bc207690ae
Author: Father Chrysostomos <[email protected]>
Date:   Tue Apr 24 17:01:00 2012 -0700

    Increase $File::Find::VERSION to 1.21

M       lib/File/Find.pm
-----------------------------------------------------------------------

Summary of changes:
 lib/File/Find.pm       |   10 ++++++++-
 lib/File/Find/t/find.t |   52 +++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/lib/File/Find.pm b/lib/File/Find.pm
index f2fe20b..fe50b4f 100644
--- a/lib/File/Find.pm
+++ b/lib/File/Find.pm
@@ -3,7 +3,7 @@ use 5.006;
 use strict;
 use warnings;
 use warnings::register;
-our $VERSION = '1.20';
+our $VERSION = '1.21';
 require Exporter;
 require Cwd;
 
@@ -280,6 +280,14 @@ links that don't resolve:
          -l && !-e && print "bogus link: $File::Find::name\n";
     }
 
+Note that you may mix directories and (non-directory) files in the list of 
+directories to be searched by the C<wanted()>.
+
+    find(\&wanted, "./foo", "./bar", "./baz/epsilon");
+
+In the example above, no file in F<./baz/> other than F<./baz/epsilon> will be
+evaluated by C<wanted()>.
+
 See also the script C<pfind> on CPAN for a nice application of this
 module.
 
diff --git a/lib/File/Find/t/find.t b/lib/File/Find/t/find.t
index 1d0a087..87306cc 100644
--- a/lib/File/Find/t/find.t
+++ b/lib/File/Find/t/find.t
@@ -18,7 +18,7 @@ BEGIN {
     $SIG{'__WARN__'} = sub { $warn_msg = $_[0]; warn "# $_[0]"; }
 }
 
-my $test_count = 85;
+my $test_count = 98;
 $test_count += 119 if $symlink_exists;
 $test_count += 26 if $^O eq 'MSWin32';
 $test_count += 2 if $^O eq 'MSWin32' and $symlink_exists;
@@ -108,6 +108,21 @@ sub cleanup {
        rmdir dir_path('fb', 'fbc');
        rmdir dir_path('fb');
     }
+    if (-d dir_path('fc')) {
+        unlink (
+            file_path('fc', 'fca', 'match_alpha'),
+            file_path('fc', 'fca', 'match_beta'),
+            file_path('fc', 'fcb', 'match_gamma'),
+            file_path('fc', 'fcb', 'delta'),
+            file_path('fc', 'fcc', 'match_epsilon'),
+            file_path('fc', 'fcc', 'match_zeta'),
+            file_path('fc', 'fcc', 'eta'),
+        );
+        rmdir dir_path('fc', 'fca');
+        rmdir dir_path('fc', 'fcb');
+        rmdir dir_path('fc', 'fcc');
+        rmdir dir_path('fc');
+    }
     if ($need_updir) {
         my $updir = $^O eq 'VMS' ? File::Spec::VMS->updir() : 
File::Spec->updir;
         chdir($updir);
@@ -870,6 +885,41 @@ if ($symlink_exists) {  # Issue 68260
     Check (!$dangling_symlink);
 }
 
+print "# RT 59750\n";
+MkDir( dir_path('fc'), 0770 );
+MkDir( dir_path('fc', 'fca'), 0770 );
+MkDir( dir_path('fc', 'fcb'), 0770 );
+MkDir( dir_path('fc', 'fcc'), 0770 );
+touch( file_path('fc', 'fca', 'match_alpha') );
+touch( file_path('fc', 'fca', 'match_beta') );
+touch( file_path('fc', 'fcb', 'match_gamma') );
+touch( file_path('fc', 'fcb', 'delta') );
+touch( file_path('fc', 'fcc', 'match_epsilon') );
+touch( file_path('fc', 'fcc', 'match_zeta') );
+touch( file_path('fc', 'fcc', 'eta') );
+
+my @files_from_mixed = ();
+sub wantmatch {
+    if ( $File::Find::name =~ m/match/ ) {
+        push @files_from_mixed, $_;
+        print "# \$_ => '$_'\n";
+    }
+}
+find( \&wantmatch, (
+    dir_path('fc', 'fca'),
+    dir_path('fc', 'fcb'),
+    dir_path('fc', 'fcc'),
+) );
+Check( scalar(@files_from_mixed) == 5 );
+
+@files_from_mixed = ();
+find( \&wantmatch, (
+    dir_path('fc', 'fca'),
+    dir_path('fc', 'fcb'),
+    file_path('fc', 'fcc', 'match_epsilon'),
+    file_path('fc', 'fcc', 'eta'),
+) );
+Check( scalar(@files_from_mixed) == 4 );
 
 if ($^O eq 'MSWin32') {
     # Check F:F:f correctly handles a root directory path.

--
Perl5 Master Repository

Reply via email to