【发布时间】:2020-03-19 15:35:31
【问题描述】:
线程perl how can I append STDOUT of list form system call of perl script to a file 导致了以下解决方案:use IPC::Run qw( run );。在我运行 perl 5.18.4 的 macos 10.14.6 上,这引发了错误:Can't locate IPC/Run.pm in @INC (you may need to install the IPC::Run module)。因此,在What's the easiest way to install a missing Perl module? 之后,我做到了
> cpan IPC::Run
<snip: 403 lines later>
Appending installation info to /Users/BNW/perl5/lib/perl5/darwin-thread-multi-2level/perllocal.pod
TODDR/IPC-Run-20180523.0.tar.gz
/usr/bin/make install -- OK
然后重新启动了我的 MacBookPro。我编辑了我的 perl 脚本,bosswrap.pl,开始
#!/usr/bin/perl
use strict; use warnings;
use IPC::Run qw( run );
但这又会引发与以前相同的错误:
> bosswrap.pl
Can't locate IPC/Run.pm in @INC (you may need to install the IPC::Run module) (@INC contains: /sw/lib/perl5/darwin-thread-multi-2level /sw/lib/perl5 /sw/lib/perl5/darwin /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /Users/BNW/u/kh/bin/bosswrap.pl line 3.
BEGIN failed--compilation aborted at /Users/BNW/u/kh/bin/bosswrap.pl line 3.
我做错了什么,或者更确切地说,我怎样才能让它工作?
【问题讨论】:
-
它看起来像是安装在一个非标准目录中(以避免需要 root),但没有告诉 Perl 去那里寻找模块。
set | grep ^PERL; echo 'o conf' | cpan的输出是什么 -
简而言之,我认为
/Users/BNW/perl5/lib需要添加到env varPERL5LIB中。