问题
The thread perl how can I append STDOUT of list form system call of perl script to a file led to the following solution: use IPC::Run qw( run );
. On my macos 10.14.6 running perl 5.18.4, this threw an error: Can't locate IPC/Run.pm in @INC (you may need to install the IPC::Run module)
. Accordingly, following What's the easiest way to install a missing Perl module?, I did
> 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
and rebooted my MacBookPro. And I edited my perl script, bosswrap.pl
, to start
#!/usr/bin/perl
use strict; use warnings;
use IPC::Run qw( run );
but this again throws apparently the same error as before:
> 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.
What am I doing wrong, or rather, how can I get this to work?
回答1:
http://triopter.com/archive/how-to-install-perl-modules-on-mac-os-x-in-4-easy-steps/ gives an in-depth tutorial. As far as I can tell some CPAN Config lines may be needed however there is not enough code provided to say that is the cause of the issue. In any event here is the CPAN config code.
$ sudo perl -MCPAN -e shell
perl> o conf init
回答2:
The solution is embedded in the solution at perl how can I append STDOUT of list form system call of perl script to a file. That question was answered in part by performing the desired installation of a module. Thanks to http://triopter.com/archive/how-to-install-perl-modules-on-mac-os-x-in-4-easy-steps/.
来源:https://stackoverflow.com/questions/59013279/how-do-i-install-perl-modules-on-macos