Perl - How to uninstall / delete Perl module

Installing Perl modules can use the cpanm utility, but how about removing Perl modules? App::pmuninstall module is the answer!

Installation :

$ cpanm App::pmuninstall
--> Working on App::pmuninstall
Fetching http://search.cpan.org/CPAN/authors/id/X/XA/XAICRON/App-
pmuninstall-0.16.tar.gz ... OK
Configuring App-pmuninstall-0.16 ... OK
Building and testing App-pmuninstall-0.16 ... OK
Successfully installed App-pmuninstall-0.16

Usage :

pm-uninstall --help
      pm-uninstall [options] Module ...

          -v,--verbose                  Turns on chatty output
          -f,--force                    Uninstalls without prompts
          -c,--checkdeps                Check dependencies ( default on )
          -n,--no-checkdeps             Not check dependencies
          -h,--help                     This help message
          -V,--version                  Show version
          -l,--local-lib                Additional module path
          -L,--local-lib-contained      Additional module path (don't include non-core modules)

Example :

$ pm-uninstall Acme::Time::Baby
Acme::Time::Baby is included in the distribution Acme-Time-Baby and contains:


Are you sure to uninstall Acme-Time-Baby? [y] y
Acme::Time::Baby is successfully uninstalled.

You may want to rebuild man(1) entires. Try `mandb -c` if needed
this will uninstall the module name Acme::Time::Baby, and it works with local::lib.

Au revoir !!!

Update : I probably should explicitly state that the Perl module "App::pmuninstall" is authored by Yuji Shimada. And I forgot to say "Thanks, Yuji"! :)


Anonymous said...

Wouldn't it make more sense to include this functionality directly into cpanm?

sjn said...

Nice module! If it also could detect wether or not a module was installed by a packaging system (e.g. RPM, DEB) and handle those appropriately... :)

Still, having it as a separate module is nice. Especially if it's done in a way that cpan, cpanp and cpanm can make use of. :D

Daddy said...

@nxadm I would say no... but then, they're not my modules. :)

Miyagawa created cpanm to do one thing and do it simply... and it does so. Yuji did likewise.

I think it'd be helpful if their respective Pod perhaps suggested the other (more so to get from cpanm to point you towards pmuninstall than vice versa) but beyond that, separation of concerns seems good to me.

Zak said...

Great, thanks for sharing. I needed to do this today. :)

Prani said...

Thanks for the tip. I used this and successfully uninstalled the module