如何将自定义模块添加到perl纸箱?

时间:2013-11-12 08:37:13

标签: perl

我正在尝试使用纸箱作为部署容器。但我遇到了一个小问题。我不知道,如何安装私有模块。

创建了一个快速测试模块:

h2xs -AX Foo::Bar

tree Foo-Bar/
Foo-Bar/
├── Changes
├── lib
│   └── Foo
│       └── Bar.pm
├── Makefile.PL
├── MANIFEST
├── README
└── t
    └── Foo-Bar.t

打包它:tar cvfz Foo-Bar-0.01.tar.gz Foo-Bar/ 将包复制到vendor/cache目录。

ls vendor/cache/
Foo-Bar-0.01.tar.gz  Try-Tiny-0.18.tar.gz

cat cpanfile
requires 'Foo::Bar', '0.01';
requires 'Try::Tiny', '0.18';

carton install --cached
Installing modules using /home/donpedro/Garbage/Carton/cpanfile
! Couldn't find module or a distribution Foo::Bar (0.01)
Successfully installed Try-Tiny-0.18
! Installing the dependencies failed: Module 'Foo::Bar' is not installed
! Bailing out the installation for /home/donpedro/Garbage/Carton/.
1 distribution installed
Installing modules failed

还尝试了一个Milla默认模块(教程示例,milla new Dist-Name),但没有结果。文档提到对于DarkPan模块,只需将模块放入供应商/缓存目录,我正在尝试这样做。 官方CPAN模块可以直接放入供应商/缓存目录。

接下来要尝试什么或如何解决我的问题? :)

修改 纸箱IRC频道中的miyagawa和lejeunerenard给了我这个信息: 为此目的,需要Carton 1.1(当前稳定1.0)和新的cpanfile开发版。 cpanfile有新选项 -dist => '/path/to/Foo-Bar.tar.gz' argument for the requires method

由于我懒得成为早期采用者,我会选择Carton for CPAN bundle和cpanm for private bundle。

感谢miyagawa和lejeunerenard。

2 个答案:

答案 0 :(得分:2)

纸盒IRC频道中的miyagawa和lejeunerenard给了我这样的信息:为了让这个工作,目前需要Carton 1.1(当前稳定1.0)和新的cpanfile开发版。 cpanfile有新选项-dist => require方法的'/path/to/Foo-Bar.tar.gz'参数

截至目前(28.12)仍然没有Carton版本的凹凸和git 1.1分支是3个月大。所以事情需要一点时间。 Pinto目前似乎正在积极发展。

答案 1 :(得分:0)

您也可以将模块放在local / lib / custom(或其他)中,然后在perl应用程序中使用该库 - 或者将其添加到PERL5LIB或使用perl -Ilocal / lib / custom。

相关问题