Monday, March 09, 2009

A bit of Perl (2)

A tiny Perl script to remove installed modules, specially handy for those installed via MCPAN.

#!/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;


# EoF #

Labels: , ,

0 Comments:

Post a Comment

<< Home