6 use Getopt::Long qw(:config bundling nopermute passthrough);
10 ) or die "usage: metagrep [-w] pattern\n";
12 use Cwd qw(getcwd abs_path);
15 my $pat = shift or die "usage: metagrep pattern\n";
16 $opt_w and $pat = "\\b$pat\\b";
20 my $mcpath = abs_path "/pro/3gl/CPAN/metaconfig" or die "cannot cd metaconfig\n";
22 my $onmeta = $cwd =~ m{CPAN/meta[^/]+$} ? 1 : 0;
24 my %dir; # I don't want a file for which any path component symlinks
27 -d and $dir{$File::Find::name}++;
30 print STDERR "<$pat>\n";
36 exists $dir{$File::Find::dir} or return;
37 #print STDERR "$File::Find::dir - $_\n";
39 open my $f, "<$_" or die "$File::Find::name: $!\n";
40 my $fnm = $File::Find::name;
42 print map { "$fnm:$_" } grep /$pat/, <$f>;