我如何在macOS上安装perl模块?

问题描述 投票:0回答:1

线程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.

我在做什么错了,或者更确切地说,我该怎么做?

macos perl module cpan
1个回答
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
© www.soinside.com 2019 - 2024. All rights reserved.