我已经将我的应用程序打包为Perl模块,它无法使用cpan或cpanm命令进行安装。问题是,这些命令--如果不是根用户运行--将先决条件模块安装到~/perl5 5目录中。但是,我的~/perl5 5目录没有包含在@INC中。
这导致了cpanm的以下令人困惑的输出:
$ cpanm --installdeps .
--> Working on .
Configuring my-module-0.001 ... OK
==> Found dependencies: Image::Size
--> Working on Image::Size
Fetching http://www.cpan.org/authors/id/R/RJ/RJRAY/Image-Size-3.232.tar.gz ... OK
Configuring Image-Size-3.232 ... OK
Building and testing Image-Size-3.232 ... OK
Successfully installed Image-Size-3.232
! Installing the dependencies failed: Module 'Image::Size' is not installed
! Bailing out the installation for my-module-0.001.
1 distribution installed如您所见,它成功地下载、测试和安装了Image::Size模块,但随后尝试使用它,但失败了。
我知道我可以通过将环境变量$PERL5LIB设置为“~/perl5 5/lib/perl5 5”并在我的$PATH中添加“~/perl5 5/bin”来解决这个问题,但我很想知道这种情况最初是如何产生的。我想为我的应用程序的用户提供尽可能简单的安装说明,并且手动修改环境变量不是我计划要指导他们的事情。
发布于 2014-07-14 19:09:22
如果使用bash,可以将本地::lib添加类似于.bashrc文件的内容
# adds $HOME/perl5/bin to PATH
[ $SHLVL -eq 1 ] && eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"这应该能解决你的问题。问题在于您的本地系统的配置方式,因此需要对其进行调整,而不是在不需要Dist::Zilla的情况下将其引入混合系统。
发布于 2014-07-13 19:04:09
这是我自己解决这个问题的办法。我切换到地区::Zilla,并为我的用户提供了以下安装说明:
Installation instructions
=========================
To install this program you need Dist::Zilla, which can be installed
by running the following command as root:
cpan Dist::Zilla
After that, make sure you're in directory where this INSTALL file is,
and run the following command as root:
dzil installhttps://stackoverflow.com/questions/24721671
复制相似问题