Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was attempting to upgrade my Perl modules through CPAN, but I did not supply a regex/module name to upgrade: perl -MCPAN -e 'upgrade'; I can only assume the worst (which seems to be supported by the output of perldoc perllocal), i.e. all Perl modules from CPAN are installing.

How can I undo this mess? I suppose I can remove /usr/local/share/perl, but what are the implications of that?

Edit: I still have 95% free space on my hard drive, so it's not a huge concern. I just don't want lots of unnecessary clutter. I'm considering rm'ing that directory, doing dpkg --purge perl and redoing the apt-get and CPAN install process. But is it really necessary, or can I just remove the unnecessary modules from /usr/local/share/perl?

share|improve this question
    
Some people feel it really is not a good idea to directly delete system files (and folders). It maybe be better to use things like apt-get or Synaptic so that the system does the deletion thoroughly and updates requisite databases. –  user25656 Mar 7 '13 at 3:55
4  
@vasa1 Perl modules installed under CPAN are not tracked that way. The directory where the modules reside probably needs to be deleted. Or one must manually delete them through CPAN and it's a cr*pshoot if they will obey an uninstall directive, or even a make uninstall command. Its a completely different package management system, unfortunately. stackoverflow.com/questions/2626449/… –  Kevin Bowen Mar 7 '13 at 4:07
    
@maggotbrain, thanks! I didn't know that. (The only Perl I use for little things comes with the OS.) –  user25656 Mar 7 '13 at 6:08
add comment

2 Answers

up vote 4 down vote accepted

Looking at this a bit closer, I don't think that you need to or should delete any directories or files on your system.

Running the command perl -MCPAN -e 'upgrade' from the command line will not install additional modules onto your system.

It will only attempt to upgrade installed modules, through the CPAN package management system, and not through Synaptic.

This is similar to running the 'r' command and then running the upgrade command at the cpan[1]> prompt. See here.

CPAN and Synaptic are two separate and distinct package management systems.

This will not install all possible Perl modules from CPAN. Nor will it modify the existing system package dB. So, you can definitely roll this back safely.

However, this is still potentially risky if an application or your system depends upon a particular version of a Perl module.

If you have interrupted the upgrade process, chances are good that you have avoided harming your system.

Recovery options:

From a command line, start cpan, and run the command r to see the list of installed modules and available upgrades. For example, here is the abbreviated output from my cpan:

cpan[7]> r

Package namespace         installed    latest  in CPAN file
App::Cpan                    1.5701      1.61  BDFOY/App-Cpan-1.61.tar.gz
DBD::mysql                    4.020     4.022  CAPTTOFU/DBD-mysql-4.022.tar.gz
DBI                           1.616     1.623  TIMB/DBI-1.623.tar.gz
DB_File                       1.821     1.827  PMQS/DB_File-1.827.tar.gz
Error                       0.17010   0.17019  SHLOMIF/Error-0.17019.tar.gz
Eval::Closure                  0.06      0.08  DOY/Eval-Closure-0.08.tar.gz
....

Take the Eval::Closure module, for this example. Let's say that you let the perl -MCPAN -e 'upgrade' command complete and you now have version 0.08 installed.

Looking at Synaptic, in this case, it will show that the latest version in the repository will still be 0.06(0.06-1, specifically, in my instance).

You can roll back to your system version, by running the following command:

sudo apt-get install --reinstall libeval-closure-perl

If you have installed any Perl modules manually and want to roll them back to a previous version, you will need download them again (either from source.cpan.org or elsewhere), and manually re-install them.

To summarize: Upgrading Perl modules within CPAN should not affect your system repository.

Best of luck. Don't panic.

share|improve this answer
    
Excellent and thorough answer! "Don't panic" is the key phrase here. I saw lots of output and read about using arguments to specify the module, so I jumped to conclusions too quickly. I was surprised to find that I used barely any HD space, but I still saw some modules I didn't recognize (probably because of dependencies). Good to know this requires no work for me! –  paulrehkugler Mar 7 '13 at 23:54
add comment

I would recommend doing: apt-get remove <installed-packages> && apt-get autoremove(to remove dependencies) && apt-get purge <installed-packages>(to remove config files remaning) then you can remove the folders that you don't need, but it should already be done for you :)

share|improve this answer
2  
The OP did this through CPAN. A purge isn't going to help since these modules aren't under package management. –  Kevin Bowen Mar 7 '13 at 3:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.