为什么不鼓励在 Windows 上将 PPM perl 模块与 Strawberry perl 一起使用?
任何人都可以解释为什么人们会发表此评论吗?我在 stackoverflow 上看到了几个线程(像这个),其中人们这么说。在我看来,PPM 只不过是刚刚放入 Perl 安装中的模块的预编译版本。假设它们对系统 DLL 没有外部依赖性,那么最大的风险是什么?
据我所知,当您安装特定模块时,PPM 会进行依赖性检查,并将安装它所需的任何其他模块。看起来与在 Linux 发行版上使用 .deb 或 .rpm 文件是一样的。
编辑#1:
我发现此页面有关该模块Wx,他们展示了如何使用 PPM 为 Strawberry Perl 安装 Wx。我尝试过它们,它们似乎工作得很好。我还使用 PPM 和 cpanminus 混合了 CPAN 模块,一切看起来都很好。模块如:
- Wx
- DateTime
- DBI
- Data::Dumper
- DBD::AnyData
我的结论是,关于将 PPM 与 Strawberry Perl 混合的风险的评论应该持保留态度,因为可能 会给你带来一些问题,但总的来说,将 PPM 模块与 Strawberry Perl 一起使用是完全可以的。
Can anyone shed light on why people would be making this comment? I've seen several threads on stackoverflow (like this one) where people say this. It seems to me that PPMs are nothing more than pre-compiled versions of modules that are just getting dropped into your perl installation. Assuming they have no external dependencies to a system DLL, what's the big risk?
As far as I can tell PPM does dependency checking when you install a particular module and will install any others that it requires. Seems like the same thing as using .deb or .rpm files on a Linux distro.
EDIT #1:
I found this page regarding the module Wx where they're showing how to use PPM to install Wx for Strawberry Perl. I tried them and they seem to work just fine. I also mixed CPAN modules using PPM and cpanminus, and everything seems fine. Modules such as:
- Wx
- DateTime
- DBI
- Data::Dumper
- DBD::AnyData
I'm concluding that the comments regarding the risk of mixing PPM with Strawberry Perl as something that should be taken with a grain of salt, as something that may cause you an issue here or there, but in general its perfectly fine to use PPM modules with Strawberry Perl.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PPM 的创建(我认为是由 ActiveState 创建的)是为了让用户可以安装带有 XS 扩展或使用外部库的模块,而不需要 C 编译器或 make,或者 cpan 期望提供的任何 unixy 东西。他们的问题之一是 ActiveState(或某人)必须为您想要的模块以及它使用的 CPAN 中的所有模块制作 PPM。有时这意味着使用旧版本直到他们赶上,有时这意味着模块不可用。
Strawberry 的天才在于它提供了一个隐藏的 unixy 环境,cpan 可以使用它来为您构建模块,从而消除了打包二进制文件的需要。
这意味着您可以通过 cpan 完成依赖项检查,并且安装较新版本的模块或链接到奇怪位置的库变得更加容易(对于某些 easy 值),并且无需任何其他 CPAN 模块即可使用任何人的努力。
对于使用 linux-distro 打包系统也可以提出同样的论点。如果您需要一个与发行版不同步的模块版本,那么您就会陷入困境。如果您想使用更新的 Perl,那么您就陷入困境了。 Perl 在 CPAN 生态系统中拥有自己非常好的打包系统,因此如果可以的话,使用它确实很有意义。
同时,有时使用一组提供的二进制包更为明智,特别是如果您必须部署大量系统,并且 Perl 安装只是您需要跟踪的包集合的一小部分。
PPMs were created (by ActiveState, I think) so that users could install modules with XS extensions or which used external libraries, without needing to have a C compiler or make, or any of the unixy stuff that cpan expects to have present. One of their problems is that ActiveState (or someone) has to have made the PPM for the module you want, and all the modules it uses from CPAN. Sometimes this meant using an older version until they caught up, and sometimes it meant modules just weren't available.
The genius of Strawberry is that it provides a hidden unixy environment that cpan can use to build modules for you, so doing away with the need to package binaries.
This means you get the dependency checking done by cpan, and it becomes much easier (for certain values of easy) to install newer versions of modules, or to link to libraries in odd places, and for many more CPAN modules to be available without any effort from anyone.
The same arguments can be made about using a linux-distro packaging system. If you need a module version that's out of sync with the distro then you're stuck. If you want to use a more up to date Perl, you're stuck. Perl has its own very good packaging system in the CPAN ecosystem, so it really makes sense to use that if you can.
At the same time, sometimes it's more sensible to use a set of provided binary packages, especially if you have to roll out lots of systems, and your Perl install is only a small part of the collection of packages you need to keep track of.
PPD 实际上可以包含外部库(例如 XML::LibXML 的包包含 libxml2),因此安装起来会更简单。
PPD 已编译,因此安装速度更快。
PPD 给您的控制权较少,因为它们是由其他人准备的。您仅限于可用的模块(值得庆幸的是,这是一个巨大的可用模块)和可用的版本。
我通常会犹豫是否要混合使用两个系统,但我从未遇到过在同一版本上同时使用
ppm
和cpan
的任何问题。只需使用您方便的那个即可。
PPDs can actually include external libraries (e.g. XML::LibXML's package includes libxml2), so they can be simpler to install.
PPDs are already compiled, so they can be faster to install.
PPDs give you less control since they are prepared by someone else. You are limited to the modules available (which is thankfully a huge swath of what's available) and to the versions available.
I normally hesitate to mix two systems, but I have never encountered a single issue from using both
ppm
andcpan
on the same build.Just use the one that's convenient for you.