Uninstall Perl Module

Here’s how to cleanly uninstall any Perl module:

#!/usr/local/bin/perl

use ExtUtils::Packlist;
use ExtUtils::Installed;

$ARGV[0] or die "Usage: $0 Module::Namen";

my $mod = $ARGV[0];

my $inst = ExtUtils::Installed->new();

foreach my $item (sort($inst->files($mod))) {
         print "removing $itemn";
         unlink $item;
}

my $packfile = $inst->packlist($mod)->packlist_file();
print "removing $packfilen";
unlink $packfile;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.