安装 perl 模块:cpan shell 与 rpm/deb
我只是想知道 - 与通过包管理安装相比,从 cpan shell 安装 perl 模块有什么优势吗?除了偶尔更快地访问最新模块版本之外?
I just wonder - are there any advantages to installing perl modules from the cpan shell compared to installing them by package management? Apart from occasionally having quicker access to the latest modules version?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯,这完全取决于模块的预期用途。
本机包管理有很多优点:
文件位于正确的(取决于系统)位置,脚本添加到
PATH等
模块(例如 Debian Perl 组)。
(可能有或没有平台特定知识)。
直接从 CPAN 安装时,您还有一些优势:
如今, local::lib 和 perlbrew (howto)已制定了 CPAN对于开发人员来说更有趣。 local::lib 让您在使用系统的 perl 二进制文件时拥有私有模块树perlbrew 可以让您轻松创建自己的完整 Perl 安装(还有多个 Perl 版本)并行)。
两种方法都是有效的,并且如上所述,优点取决于预期用途。
Well, it all depends on the intended use of the modules.
The native package management has many advantages:
files are in the right (system-dependant) place, scripts added to the
PATH, etc.
modules (e.g. the Debian Perl group).
(that may or not have the platform specific knowledge).
When installing directly from CPAN, you also have some advantages:
Nowadays, local::lib and perlbrew (howto) has made the CPAN way a lot more interesting for a developer. local::lib lets you have your private module tree while using the system's perl binary and perlbrew lets you easily create your own complete Perl installations (also several Perl releases in parallel).
Both ways are valid, and as said, the advantage depends on the intended usage.
使用本机 CPAN 客户端可以访问 CPAN 上的所有模块,其中大多数模块可能不是由您的发行版打包的,但代价是您的发行版的包管理器不知道它们已安装(用于依赖项解析等) 。我知道 Debian 提供了 dh-make-perl 软件包用于将 CPAN 模块转换为 debs,这似乎应该为您提供两全其美的功能,但我自己从未尝试过。
不过,最重要的是选择一种方法并坚持下去。
Using a native CPAN client gives you access to all modules on CPAN, most of which probably aren't packaged by your distro, but at the cost of your distro's package manager not knowing that they're installed (for dependency resolution, etc.). I know that Debian provides the
dh-make-perl
package for converting CPAN modules to debs, which seems like it should give you the best of both worlds, but I've never tried it myself.The most important thing, though, is to pick one method or the other and stick with it.