John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

What's the cpan command to un-install a module? The help doesn't show anything of the sort!

Replies are listed 'Best First'.
Re: How to remove a module?
by marto (Cardinal) on Mar 21, 2011 at 09:58 UTC
      Funny story about cpanp, unless you install a module with cpanp, which leaves a log in ....cpanplus/install-logs, you can't uninstall a module using cpanp

      You first have to install it using cpanp , if it is already installed, you have to cpanp i MODULE --force

      I found out after I deleted my install-logs directory

        Hmm, I just got home and read your post. Using cpan I:

        Then using cpanp:

        CPAN Terminal> u HTML::Template --force --verbose [MSG] No 'C:\Documents and Settings\marto\Application Data\.cpanplus\c +ustom-sour ces' dir, skipping custom sources [MSG] No 'C:\Documents and Settings\marto\Application Data\.cpanplus\c +ustom-sour ces' dir, skipping custom sources [MSG] No 'C:\Documents and Settings\marto\Application Data\.cpanplus\c +ustom-sour ces' dir, skipping custom sources Uninstalling 'HTML::Template' [MSG] Unlinking 'C:\strawberry\perl\site\lib\HTML\Template.pm' Running [C:\strawberry\perl\bin\perl.exe -eunlink+q[C:\strawberry\perl +\site\lib\ HTML\Template.pm]]... [MSG] Unlinking 'C:/strawberry/perl/site/lib/auto/HTML/Template/.packl +ist' Running [C:\strawberry\perl\bin\perl.exe -eunlink+q[C:/strawberry/perl +/site/lib/ auto/HTML/Template/.packlist]]... [MSG] Removing 'C:\strawberry\perl\site\lib\HTML' Running [C:\strawberry\perl\bin\perl.exe -e rmdir q[C:\strawberry\perl +\site\lib\ HTML]]... Module 'HTML::Template' uninstalled successfully All modules uninstalled successfully

        And tested it via:

        C:\>perl -e "use HTML::Template" Can't locate HTML/Template.pm in @INC (@INC contains: C:/strawberry/pe +rl/site/li b C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib .) at -e line 1 +. BEGIN failed--compilation aborted at -e line 1.

        Looks like it worked as expected.

        Actually, it worked for me.
Re: How to remove a module?
by educated_foo (Vicar) on Mar 21, 2011 at 17:18 UTC
    See the "modrm" example in the ExtUtils::Packlist documentation. It's kind of verbose, but might solve your problem.
Re: How to remove a module?
by fangly (Initiate) on Dec 24, 2011 at 10:16 UTC
    I have just tried the CPAN module App::pmuninstall, which seems to remove installed modules fine: App-pmuninstall