我在Windows生产箱上安装了草莓perl(v.5.16.3)。我假设很多个月前,有人将它安装在C:驱动器上,然后将其移动到D:。我不知道,我不在那里,但它工作正常,除非我试图安装模块。使用cpanm只会将模块抛出到C:驱动器上。不好。 @INC并没有去那里,管理员也不想要任何东西。我需要在D上使用Perl:
所以,我尝试使用cpan并更改目录:
cpan> o conf mbuildpl_arg "--install_base D:/strawberry/perl"
mbuildpl_arg [--install_base D:strawberryperl]
commit: wrote 'D:\strawberry\perl\lib/CPAN/Config.pm'
cpan> o conf makepl_arg "PREFIX=D:/strawberry/perl"
makepl_arg [PREFIX=D:/strawberry/perl]
commit: wrote 'D:\strawberry\perl\lib/CPAN/Config.pm'
cpan> install Email::Simple
它在D:/ strawberry / perl / lib中安装了Email Simple - 不完美,但它确实有效。大!其他一些人经历了同样的事情。去安装Module :: Runtime
cpan> install Module::Runtime
然后是D:/ strawberry / perl / lib / perl5。咦?好的,不完美,但我的@INC包括D:/ strawberry / perl / lib所以这不应该是一个问题,对吧?去安装MooX :: Types :: MooseLike :: Base
cpan> install MooX::Types::MooseLike::Base
不会安装。这是cpan barf out:
cpan> install MooX::Types::MooseLike::Base
Running install for module 'MooX::Types::MooseLike::Base'
Running make for M/MA/MATEU/MooX-Types-MooseLike-0.29.tar.gz
Checksum for D:\strawberry\cpan\sources\authors\id\M\MA\MATEU\MooX-Types-MooseLike-0.29.tar.gz ok
CPAN.pm: Building M/MA/MATEU/MooX-Types-MooseLike-0.29.tar.gz
Checking if your kit is complete...
Looks good
Warning: prerequisite Module::Runtime 0.014 not found.
... Detected uninstalled Perl. Trying to continue.
Have \strawb~1\perl\lib
Want \strawberry\perl\lib
Writing Makefile for MooX::Types::MooseLike
Writing MYMETA.yml and MYMETA.json
---- Unsatisfied dependencies detected during ----
---- MATEU/MooX-Types-MooseLike-0.29.tar.gz ----
Module::Runtime [requires]
Running make test
Delayed until after prerequisites
Running make install
Delayed until after prerequisites
Running install for module 'Module::Runtime'
Running Build for Z/ZE/ZEFRAM/Module-Runtime-0.014.tar.gz
Has already been unwrapped into directory D:\strawberry\cpan\build\Module-Runtime-0.014-yHdcFp
Has already been made
Running Build test
Has already been tested successfully
Running Build install
Already done
Running make for M/MA/MATEU/MooX-Types-MooseLike-0.29.tar.gz
Has already been unwrapped into directory D:\strawberry\cpan\build\MooX-Types-MooseLike-0.29-UaWuDZ
CPAN.pm: Building M/MA/MATEU/MooX-Types-MooseLike-0.29.tar.gz
Warning: Prerequisite 'Module::Runtime => 0.014' for 'MATEU/MooX-Types-MooseLike-0.29.tar.gz' already built but the resu
lt looks suspicious. Skipping another build attempt, to prevent looping endlessly.
cp lib/MooX/Types/MooseLike.pm blib\lib\MooX\Types\MooseLike.pm
cp lib/MooX/Types/MooseLike/Base.pm blib\lib\MooX\Types\MooseLike\Base.pm
MATEU/MooX-Types-MooseLike-0.29.tar.gz
D:\strawberry\c\bin\dmake.exe -- OK
Running make test
D:\strawberry\perl\bin\perl.exe "-ID:/strawberry/perl/lib" "-ID:/strawberry/perl/lib" "-MExtUtils::Command::MM" "-e" "te
st_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/basic.t ........................ Can't locate Module/Runtime.pm in @INC (@INC contains: D:\strawberry\cpan\build\MooX-
Types-MooseLike-0.29-UaWuDZ\blib\lib D:\strawberry\cpan\build\MooX-Types-MooseLike-0.29-UaWuDZ\blib\arch D:/strawberry/p
erl/lib D:/strawberry/perl/site/lib/MSWin32-x86-multi-thread D:/strawberry/perl/site/lib D:/strawberry/perl/vendor/lib D
:/strawberry/perl/lib .) at D:/strawberry/perl/lib/Moo/_Utils.pm line 23.
BEGIN failed--compilation aborted at D:/strawberry/perl/lib/Moo/_Utils.pm line 23.
Compilation failed in require at D:/strawberry/perl/lib/Moo.pm line 13.
BEGIN failed--compilation aborted at D:/strawberry/perl/lib/Moo.pm line 13.
Compilation failed in require at t/basic.t line 4.
BEGIN failed--compilation aborted at t/basic.t line 4.
t/basic.t ........................ Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t/builder.t ...................... Can't locate Module/Runtime.pm in @INC (@INC contains: D:\strawberry\cpan\build\MooX-
Types-MooseLike-0.29-UaWuDZ\blib\lib D:\strawberry\cpan\build\MooX-Types-MooseLike-0.29-UaWuDZ\blib\arch D:/strawberry/perl/lib D:/strawberry/perl/site/lib/MSWin32-x86-multi-thread D:/strawberry/perl/site/lib D:/strawberry/perl/vendor/lib
此错误重复几次,所有测试都失败等等。
Files=14, Tests=0, 1 wallclock secs ( 0.06 usr + 0.03 sys = 0.09 CPU)
Result: FAIL
Failed 14/14 test programs. 0/0 subtests failed.
dmake.exe: Error code 130, while making 'test_dynamic'
MATEU/MooX-Types-MooseLike-0.29.tar.gz
one dependency not OK (Module::Runtime); additionally test harness failed
D:\strawberry\c\bin\dmake.exe test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports MATEU/MooX-Types-MooseLike-0.29.tar.gz
Running make install
make test had returned bad status, won't install without force
Stopping: 'install' failed for 'M/MA/MATEU/MooX-Types-MooseLike-0.29.tar.gz'.
Failed during this command:
MATEU/MooX-Types-MooseLike-0.29.tar.gz : make_test NO one dependency not OK (Module::Runtime); additionally test
harness failed
所以,问题......
(1)我需要做什么才能将Module :: Runtime放在正确的位置?我之前尝试更改目录的尝试适用于某些,但不适用于此。我更喜欢D:\ strawberry \ perl \ site \ lib - 因为看起来cpanm会把它放在那里,但是D:\ strawberry \ perl \ lib也能正常工作。
如果我们确定数字(1)这并不重要,但我很好奇是否有人有答案:
(2)当它位于@INC的一个子目录中时,为什么不能找到Module :: Runtime?
所以我知道一个答案是在正确的位置重新安装草莓,但这是一个生产盒,其中包含不断运行的Perl脚本,没有停机时间,所以不,这不是一个选项。无论如何,他们不允许我这样做。
提前感谢您的帮助。