简体   繁体   English

在perl脚本中使用CPAN

[英]Using CPAN in perl scripts

I'm writing a script that uses some CPAN modules. 我正在编写一个使用一些CPAN模块的脚本。 What can I do so that co-workers can use my script without manually installing these CPAN modules? 我可以做什么,以便同事可以使用我的脚本而无需手动安装这些CPAN模块?

Thanks! 谢谢!

Simply mark them as dependencies for your script. 只需将它们标记为脚本的依赖项即可。 When he installs your script, cpan / cpanm will automatically install them too if needed. 当他安装你的脚本时,如果需要, cpan / cpanm也会自动安装它们。

If it's going to be shipped and installed, I definitely recommend packaging as a CPAN-style distribution with dependencies declared in the normal way (modules of note: Dist::Zilla , Module::Build , ExtUtils::MakeMaker . 如果它将被发货和安装,我绝对建议打包为CPAN风格的发行版,其中依赖项以正常方式声明(注意模块: Dist :: ZillaModule :: BuildExtUtils :: MakeMaker

However , there may be the odd occasion when shipping the dependencies with the script itself is desirable. 但是 ,在使用脚本本身运送依赖项时,可能会出现奇怪的情况。 For pure-perl dependencies and having played around a little bit, App::FatPacker seems to work OK ( cpanm uses it itself ). 对于纯perl依赖并且玩了一下, App :: FatPacker似乎工作正常( cpanm 自己使用它)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM