卸载cpan安装的所有perl模块 [英] Uninstall all perl modules installed by cpan

查看:331
本文介绍了卸载cpan安装的所有perl模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我想测试一些软件,并在其中说的文档中进行安装,我只需要输入

cpan -i Software

我从未使用过cpan,我只知道它是perl软件包管理器. (是.. ??)但是,事实证明,我需要大量的依赖项,而且由于我很愚蠢,所以我只安装了所有这些依赖项. (首先,我必须设置cpan,问了很多问题)长话短说,我只想再次删除所有内容.我用谷歌搜索了一下,看来cpan没有卸载例程,尤其是一次安装所有软件包. 我可以只删除一些目录,还是会遇到麻烦?

解决方案

cpan命令实际上不是像apt-get这样的程序包管理器.它是从CPAN(站点或其镜像之一)下载并安装的工具.完成此任务后,它不会记得很多以前做过的事情,至少还不足以删除先前安装的模块,至少不能可靠,干净或依赖安全地删除. (更新:查看 App::pmuninstall 之后,它可以用于处理依赖关系,但是它是通过连接到外部(阅读:Web)源来实现的,这些源是分开计算的,这很好,但是我坚持前面的声明,即CPAN.pm不这样做.

我曾经担心删除模块,但是现在我意识到大多数Perl模块占用的空间很小,所以我不必担心会安装一些您永远不会使用的额外模块.因此,除非您使用的是光盘非常小的计算机,否则我就顺其自然.

在Windows上,或者如果您在Linux/Mac上使用非系统Perl,则只需删除Perl并重新安装它即可.如果您在Linux/Mac上使用系统安装的Perl,则不建议这样做,因为这样做可能会中断OS(如果您小心一点,可能会没事,但是节省几个Mb是不值得的!).

将来,您可以使用 perlbrew 轻松安装Perl的本地版本.如果文档不够(应该是),则可以遍及整个网络.这还具有使您可以使用最新,最出色的Perl版本的好处,而您的系统可能还没有该版本.然后,如果您安装了一大堆垃圾,或什至破坏了它的疯狂功能,请删除该版本,然后重新安装/安装其他版本.

另一个不错的工具是 cpanminus (简称cpanm),它是一种更新的,更用户友好的工具cpan工具.所有很酷的孩子都在使用它.

Yesterday I wanted to test some software and in the documentation it said, to install I just needed to type

cpan -i Software

I never used cpan, I just know that it is the perl package manager. (Is it..?) However, it turned out that I needed loads of dependencies, and stupid as I am, I just installed all of them. (First, I had to set up cpan which asked me lots of questions) Long story short, I just want to remove all of it again. I googled a bit, and it seems like cpan does not have an uninstall routine, especially for all the packages at once. Can I just remove some directory or will I run into troubles?

解决方案

the cpan command isn't really a package manager like apt-get is. It is more a tool that downloads and installs from CPAN (the site, or one of its mirrors). After it has finished this task it doesn't remember much about what was done before, at least not enough to remove previously installed modules, at least not reliably, cleanly or dependency-safely. (Update: After looking at App::pmuninstall, it can be used to handle dependencies, but it does so by connecting to outside (read: web) sources, which compute these separately, which is fine, but I stand by the previous statement that CPAN.pm doesn't do this.)

I used to worry about removing modules, but now I realize that most Perl modules take up so little room that I just don't worry about having a few extra modules installed that you will never use. So unless you are on a computer with a REALLY small disc, I would just let it be.

On Windows or if you are using a non-system Perl on Linux/Mac you could just remove Perl and reinstall it. I would not recommend this if you are using the system installed Perl on Linux/Mac however as you could break your OS doing this (you might be ok if you were careful, but not worth it to save a few Mb!).

In the future, you can easily install a local version of Perl using perlbrew, there are tutorials all over the web if the docs aren't sufficient (they should be). This also has the bonus of letting you play with the newest and greatest Perl versions, which your system likely doesn't come with yet. Then if you install a mountain of junk, or even break it doing something crazy, remove that version and reinstall/install a different version.

Another nice tool is cpanminus (or cpanm for short) which is a newer, more user friendly cpan tool. All the cool kids are using it.

这篇关于卸载cpan安装的所有perl模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆