【问题标题】:how do I install perl modules on macos?如何在 macos 上安装 perl 模块?
【发布时间】: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 var PERL5LIB中。

标签: macos perl module cpan


【解决方案1】:

http://triopter.com/archive/how-to-install-perl-modules-on-mac-os-x-in-4-easy-steps/ 给出了深入的教程。据我所知,可能需要一些 CPAN 配置行,但是没有提供足够的代码来说明问题的原因。无论如何,这里是 CPAN 配置代码。

$ sudo perl -MCPAN -e shell
perl> o conf init

【讨论】:

  • 您需要查看什么代码?我保存了所有的 cpan 输出,412 行,并且可以发布它们。
  • 可能是前 12 行。
【解决方案2】:

解决方案嵌入在perl how can I append STDOUT of list form system call of perl script to a file 的解决方案中。通过执行所需的模块安装,部分回答了该问题。感谢http://triopter.com/archive/how-to-install-perl-modules-on-mac-os-x-in-4-easy-steps/

【讨论】:

    【解决方案3】:

    尝试以下方法:

    sudo perl -MCPAN -e 'install -force Net::ARP'
    

    【讨论】:

      猜你喜欢
      • 2015-06-14
      • 2019-10-19
      • 1970-01-01
      • 2018-04-12
      • 1970-01-01
      • 2016-10-27
      • 1970-01-01
      • 2010-12-20
      • 2012-01-19
      相关资源
      最近更新 更多