http://qs321.pair.com?node_id=533839

jeanluca has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks
how do I uninstall a package. I just wrote a test package and installed it. But now I would like to remove it. Now that we are discussing un-installing packages/modules, how to uninstall a package with CPAN ?

Thanks in advance
Luca

Replies are listed 'Best First'.
Re: howto uninstall a package/module
by Gilimanjaro (Hermit) on Mar 02, 2006 at 11:31 UTC

    There is no 'real' way to uninstall packages with CPAN, but there is a clean method described in the CPAN FAQ...

      Wouldn't it make sense to add this as an `uninstall' command to the CPAN shell?

        I think the guys that make CPANPLUS have done exactly that...

        Problem is that 'install' basically just runs a script, and there's no guarantee that removing all the files listed in the packlist completely removes/uninstalls the package...

        Providing an uninstall command might lead users to believe that the results is a 'clean' uninstall, even though that may not be the case. (Nor can it be checked whether it happened).

        My personally prefered way to handle perl-packages is to build them, and package them in an RPM. That way, the perl-package can be easily installed and removed using rpm... This preference has probably arrisen because of my sysadmin background; creating one rpm and placing it in a yum or apt repository that all my machines automatically update from is simple and safe way to maintain identical versions on all systems, and allows kickstart installations that include all required perl-packages...

        There are various ways to create an rpm package out of a CPAN module. I usually use cpan2rpm. But IIRC, CPANPLUS also includes support for tools like this, and would thereby combine CPAN's power and the (admin) easy of rpm's (or other package styles like .deb).

Re: howto uninstall a package/module
by displeaser (Hermit) on Mar 02, 2006 at 10:32 UTC
    Hi,
    if you use the activestate distribution you can use the ppm command to remove/uninstall a package.

    Enter PPM and type "help uninstall" to get the details.

    Hope this helps.

    Displeaser
      I'm not sure what disrtibution I'm using, how can I tell ? perl --version gives:
      This is perl, v5.8.7 built for i686-linux
      Also, I don't seem to have a tool called ppm (or PPM) ?

      Any other suggestions ?
      Luca
        If you wrote the module yourself, you are the one responsible for providing clean uninstall method for it.

        If you used MakeMaker for creating a Makefile (I'm assuming that is what you did), it should create an uninstall target for you, so, if you installed your module with make install, you should be able to uninstall it with make uninstall from module's directory.

        Anyway, you should provide more details (how did you install this test module? windoze ppm? perl -MCPAN -e "install Test::Module"? make install?

Re: howto uninstall a package/module
by perlsen (Chaplain) on Mar 02, 2006 at 13:36 UTC
    Hi,
    I don't Know Exactly Because I never tried this before
    But This may help
    Please try for below Links, If You wish
  • CPAN
  • PerlPOD
  • Cpan Delete

  • Regards,
    Perlsen
Re: howto uninstall a package/module
by perlfan (Vicar) on Mar 02, 2006 at 17:40 UTC
    Not the most elegant method, but I just delete where it was installed. Of course, this doesn't help if you want to recursively delete anything that may have been installed as a pre-req.
Re: howto uninstall a package/module
by mattr (Curate) on Mar 06, 2006 at 13:45 UTC
    I just did this because I am a bad boy. I had to install SQLite on an RH9/perl5.8.1 system and it refused! (And said it had duplicate driver files in the tree..). So if you are talking ancient installs and who knows where that came from, watching make won't hack it.

    I solved it all by uninstalling DBI and cpan install Bundle::DBI. Whew.

    How did I uninstall? Followed the instructions google gave me.. namely search and destroy. In my paranoia I don't destroy and will never know where things should go back if everything breaks, so..

    I ran locate DBI.pm to find the various places it hides in the perl tree. At one point I think/hope I did a find . |grep DBI.pm since locate was not up to date but.. okay so I found a bunch of paths ending in DBI.pm.

    Basically I renamed all folders called DBI to DBI_old and all DBI.pm files renamed to DBI_old.pm without moving them anywhere. This salved my paranoia (I could grep for DBI_old later on) and my machine is happy. I am wanting to upgrade my perl though.. my other machine is a 5.8.8. (on which various modules like SQL::Statement discover make tests need patching).

    Hope this helps. I just pondered the potential merits of saving records of installation sessions on a per-session basis for roll-back but my mind almost melted down. Have a nice day!

      In Webmin, we can select modules and uninstall the selected modules.