Skip to content

Commit

Permalink
no need for additional stat calls
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 16, 2016
1 parent fce71fa commit aea16c6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/Mojo/Util.pm
Expand Up @@ -132,11 +132,12 @@ sub files {
# This may break in the future, but is worth it for performance
local $File::Find::skip_pattern = qr/^\./ unless $options->{hidden};

my @files;
my $wanted = sub { -d $File::Find::name or push @files, $File::Find::name };
find {wanted => $wanted, no_chdir => 1}, $dir if -d $dir;
my %files;
my $want = sub { $files{$_}++ };
my $post = sub { delete $files{$File::Find::dir} };
find {wanted => $want, postprocess => $post, no_chdir => 1}, $dir if -d $dir;

return sort @files;
return sort keys %files;
}

sub html_unescape {
Expand Down

0 comments on commit aea16c6

Please sign in to comment.