# require "Module"
if ($package->isa('PPI::Token::Quote'))
{
- $outsep = $insep = '/';
- $keep_extension = 1;
+ $outsep = $insep = '/';
+ $keep_extension = 1;
}
elsif ($package =~ /'/)
{
- # the goofball is using the ancient ' package sep, we'll humor him
- $outsep = q{'};
- $insep = "'|::";
+ # the goofball is using the ancient ' package sep, we'll humor him
+ $outsep = q{'};
+ $insep = "'|::";
}
my @directories = split $insep, $package;
my @found;
+ my $add_recursively;
+ $add_recursively = sub {
+ my ($path, $iteration, @more) = @_;
+ opendir((my $dirhandle), $path);
+ for (readdir $dirhandle)
+ {
+ next if /^\.+$/; # skip . and ..
+ next if $iteration == 0 && $_ !~ $final_re;
+
+ my $match = $_;
+ my $fullmatch = File::Spec->rel2abs($match, $path);
+ if (-d $fullmatch)
+ {
+ $add_recursively->($fullmatch, $iteration + 1, @more, $match);
+ }
+ else
+ {
+ $match =~ s/\..*// unless $keep_extension;
+ push @found, join $outsep, @directories, @more, $match;
+ }
+ }
+ };
+
INC: for (@INC)
{
my $path = $_;
-d $path or next INC;
}
- opendir((my $dirhandle), $path);
- for my $match (grep { $_ =~ $final_re } readdir $dirhandle)
- {
- $match =~ s/\..*// unless $keep_extension;
- push @found, join $outsep, @directories, $match;
- }
+ $add_recursively->($path, 0);
}
return $orig->(@_), @found;