使用ExtUtils::Installed和ExtUtils::Packlist这两个模块来实现。下面是一个例子,在ExtUtils::Packlist中有更详细的例子,可以参考一下。
#!/usr/local/bin/perl -w
use ExtUtils::Packlist;
use ExtUtils::Installed;
$ARGV[0] or die "Usage: $0 Module::Name\n";
my $mod = $ARGV[0];
my $inst = ExtUtils::Installed->new();
foreach my $item (sort($inst->files($mod))) {
print "removing $item\n";
unlink $item;
}
my $packfile = $inst->packlist($mod)->packlist_file();
print "removing $packfile\n";
unlink $packfile;
================================
perl version
![](https://i-blog.csdnimg.cn/blog_migrate/4173e26d7e2c14726a6ececf1a9cb449.png)