Skip to content

Instantly share code, notes, and snippets.

@eiro
Created January 27, 2013 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiro/4651301 to your computer and use it in GitHub Desktop.
Save eiro/4651301 to your computer and use it in GitHub Desktop.
remove cpan packlist and content
#! /usr/bin/perl
# usage: perl p5_ls_packlist.pl Perlude MARC::MIR | xargs rm
use Modern::Perl;
use File::Find::Rule;
use File::Slurp;
my $matches = do {
s,::,/,g for my @path = @ARGV;
my $pattern = sprintf '/(?:%s)/.packlist$', join '|', @path;
say "qr{$pattern}";
qr{$pattern};
};
map { say for (map {chomp; $_ } read_file $_), $_ }
grep { $_ ~~ $matches }
File::Find::Rule
-> file
-> name('.packlist')
-> in(@INC);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment