如何在 macos 上安装 perl 模块?

Jac*_*lin 7 macos perl cpan module

线程perl how can I append STDOUT of list form system call of perl script to a file导致以下解决方案:use IPC::Run qw( run );。在我的 macos 10.14.6 上运行 perl 5.18.4,这引发了一个错误:Can't locate IPC/Run.pm in @INC (you may need to install the IPC::Run module)。因此,安装缺少的 Perl 模块最简单的方法是什么?,我做了

> 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
Run Code Online (Sandbox Code Playgroud)

并重新启动了我的 MacBookPro。我编辑了我的 perl 脚本,bosswrap.pl开始

#!/usr/bin/perl
use strict; use warnings;
use IPC::Run qw( run );
Run Code Online (Sandbox Code Playgroud)

但这再次引发了与之前相同的错误:

> 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.
Run Code Online (Sandbox Code Playgroud)

我做错了什么,或者更确切地说,我怎样才能让它发挥作用?

Bar*_*n S 6

尝试以下操作:

sudo perl -MCPAN -e 'install -force Net::ARP'
Run Code Online (Sandbox Code Playgroud)


小智 0

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
Run Code Online (Sandbox Code Playgroud)