分发Perl应用程序
我最近创建了一个Perl小应用程序,该应用程序使用了一些需要通过CPAN安装的非核心模块。
I recently created a little Perl application that utilizes a few non-core modules that will need to be installed via CPAN.
是否可以分发该应用程序能够检查是否已安装必需的模块,如果没有,则将它们从CPAN中拉出?我想我正在寻找类似于CPAN自动依赖安装功能的东西。
Is there a way to distribute the application with the ability to check to see if the required modules are installed and pull them from CPAN if they aren't? I suppose I am looking for something similar to the CPAN auto-dependency-install feature.
我考虑过使用module-starter和Module :: Install来创建一个模块-例如目录结构,然后定制Build文件以将应用程序安装到/ bin ...,但是我不确定这是否是一种解决方案。
I thought about using module-starter and Module::Install to create a module-like directory structure and then tailor the Build file to install the application to /bin... but I'm not sure if this is a shoe-horn solution.
这不是鞋拔子的解决方案,而是正确的做法。由于极端情况,您应该让专门的工具来处理依赖关系,例如输入安装说明:
It's not a shoe-horn solution, but the Right Thing to do. You should let a specialised tool handle the dependencies because of the corner cases, e.g. write in the installation instructions:
- 解压缩存档文件。
- 运行
cpan。
放在未归档的目录中。
- Unpack the archive.
- Run
cpan .
in the unarchived directory.
您无需更改Build文件即可在 bin 目录,默认情况下会执行此操作。
You need not change the Build file to install programs in the bin
directory, it does this by default.