http://qs1969.pair.com?node_id=900023

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

hello monks,

I have ubuntu installed,I was in error when I downloaded the Perl 5.12.3 source and unzipped and then installed in /usr/local (the default one) Perl 5.12.3

The problem now is that I have Ubuntu's Perl which is 5.10.1 and 5.12.3 and somehow because /usr/local is before /usr in $PATH it seems that 5.12.3 is now the Perl on my machine, and at the same time I discover some modules are not working so good or not working at well on it, so I'd like to uninstall 5.12.3

How do I do that ? How do I uninstall it ? Because I've looked at the Makefile and it does not have a uninstall target.

I could go through all the files that are in /usr/local and delete any Perl-related ones ?

So the question is, how do I uninstall Perl

I know about App::perlbrew and it's an awesome module, but I wasn't aware of it when I tried to uninstall.

Replies are listed 'Best First'.
Re: fixing a mistake
by moritz (Cardinal) on Apr 19, 2011 at 07:39 UTC

    Here's an idea: Install the same perl version into a local directory, and then get a directory lising from that installation. You can pipe that list of files to an xargs rm running in /usr/local/.

    Assuming that the perl installation didn't override any files, that should be far more reliable and convenient than going through the list by hand.

Re: fixing a mistake
by educated_foo (Vicar) on Apr 19, 2011 at 00:20 UTC
    Uninstalling is a huge pain, but if you still have your perl build directory around, you can try parsing the output of make -n install ("-n" means "print out what you're going to do, but don't do it"). If that doesn't work, you can try removing stuff from /usr/local/bin/, but perl installs a lot of programs.
Re: fixing a mistake
by Eliya (Vicar) on Apr 19, 2011 at 09:20 UTC

    If you've installed into /usr/local, it's unlikely that you've overwritten any "system files", as Ubuntu system files aren't installed into /usr/local.

    So, just rename /usr/local/bin/perl to somethink else like /usr/local/bin/perl5.12.3 and be done.  As saying "perl" will now no longer find the new perl along the PATH, there's no need to remove it. And you could even call /usr/local/bin/perl5.12.3 in case you should want to test something with the newer version.

Re: fixing a mistake
by Anonymous Monk on Apr 19, 2011 at 01:19 UTC
    So the question is, how do I uninstall Perl

    If you used apt-get/rpm/whatever to install perl, you use apt-get/rpm/whatever to uninstall perl :)

    If you did not, you use rm -rf, usually rm -rf /usr/local/perl5 or whatever is in @INC (or whatever is specified in  perl -V:install.*)

    Or see the .packlist file in perl -V:archlib for a core list of files installed with perl

    Since you installed over an existing install, maybe you simply need to trim @INC/PERL5LIB or rearrange $PATH, it depends if perl -V:install.* doesn't include version specific directories (with 5.12.3 in the name)

    Maybe you simply need to reinstall the old version :) These might be relevant

Re: fixing a mistake
by tweetiepooh (Hermit) on Apr 19, 2011 at 11:14 UTC
    One solution would be to rename the Perl binary in /usr/local to myperl or something. That way perl -> Ubuntu's Perl and myperl to yours.