Skip to content

Instantly share code, notes, and snippets.

@kberov
Last active October 1, 2018 19:59
Show Gist options
  • Save kberov/35ec4011dbcbf8b688191e90de3c11b4 to your computer and use it in GitHub Desktop.
Save kberov/35ec4011dbcbf8b688191e90de3c11b4 to your computer and use it in GitHub Desktop.
Uninstall Perl modules installed via cpan or cpanm
#!/bin/sh
# I tried this even wth my system perl because I had installed modules there
# For this you need to be root, but beware you can break your system,
# if you have important scripts using some of these modules
# get list of installed modules via `cpanm` or `cpan`
export PERLLOCAL=`find "$1" -name 'perllocal.pod'`
# find and uninstall installed modules. cpanm will propt for each one
cpanm -U `perl -ne 'print "$1 " if /L\<([^\|]+)\|/' $PERLLOCAL`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment