Browse files

+ Don't do a directory stat call if we've already done one to

+    check for a symlink.
  • Loading branch information...
1 parent ba9f9b6 commit 1765b699cb89cac3b63d468178dbd894709ec382 @petdance committed Oct 19, 2007
Showing with 14 additions and 4 deletions.
  1. +6 −0 Changes
  2. +8 −4 Next.pm
View
6 Changes
@@ -1,5 +1,11 @@
Revision history for File-Next
+NEXT
+ [ENHANCEMENTS]
+ Don't do a directory stat call if we've already done one to
+ check for a symlink.
+
+
1.00 Mon Jun 18 10:06:14 CDT 2007
[ENHANCEMENTS]
View
12 Next.pm
@@ -379,17 +379,21 @@ sub _candidate_files {
while ( defined ( my $file = readdir $dh ) ) {
next if $skip_dirs{$file};
+ my $has_stat;
# Only do directory checking if we have a descend_filter
my $fullpath = File::Spec->catdir( $dir, $file );
if ( !$parms->{follow_symlinks} ) {
next if -l $fullpath;
+ $has_stat = 1;
}
- if ( $descend_filter && -d $fullpath ) {
- local $File::Next::dir = $fullpath;
- local $_ = $file;
- next if not $descend_filter->();
+ if ( $descend_filter ) {
+ if ( $has_stat ? (-d _) : (-d $fullpath) ) {
+ local $File::Next::dir = $fullpath;
+ local $_ = $file;
+ next if not $descend_filter->();
+ }
}
push( @newfiles, $dir, $file, $fullpath );
}

0 comments on commit 1765b69

Please sign in to comment.