OS X CPAN Perl 模块安装问题

OS X CPAN Perl module installation issue

我正在尝试在 OS X:

上使用 CPAN 安装 Perl 模块 MediaWiki::API
sudo cpan MediaWiki::API                                                        Password:
Reading '/Users/qazwsx/.cpan/Metadata'
  Database was generated on Mon, 13 Jul 2015 20:53:32 GMT
Running install for module 'MediaWiki::API'
Running make for E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz
Checksum for /Users/qazwsx/.cpan/sources/authors/id/E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz ok
sh: /opt/local/bin/gzip: No such file or directory
Package seems to come without Makefile.PL.
  (The test -f "/Users/qazwsx/.cpan/build/EXOBUZZ-iwzBiH/Makefile.PL" returned false.)
  Writing one on our own (setting NAME to MediaWikiAPI)

  CPAN.pm: Building E/EX/EXOBUZZ/MediaWiki-API-0.40.tar.gz

Writing Makefile for MediaWikiAPI
Writing MYMETA.yml and MYMETA.json
  EXOBUZZ/MediaWiki-API-0.40.tar.gz
  /usr/bin/make -- OK
'YAML' not installed, will not store persistent state
Running make test
No tests defined for MediaWikiAPI extension.
  EXOBUZZ/MediaWiki-API-0.40.tar.gz
  /usr/bin/make test -- OK
Running make install
Appending installation info to /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level/perllocal.pod
  EXOBUZZ/MediaWiki-API-0.40.tar.gz
  /usr/bin/make install  -- OK

这是安装 Git-Mediawiki 的步骤(参见 https://github.com/moy/Git-Mediawiki/wiki/User-manual)。但是,在所有安装步骤之后,第一个 git 命令报告 MediaWiki::API 模块不可用:

git pull
Can't locate MediaWiki/API.pm in @INC (you may need to install the MediaWiki::API module) (@INC contains: /Users/qazwsx/WorkSpace-X4430/git/perl /Users/qazwsx/WorkSpace-X4430/git/contrib/mw-to-git /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.2/darwin-thread-multi-2level /Library/Perl/Updates/5.18.2 /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 /usr/local/Cellar/git/2.4.1/libexec/git-core/git-remote-mediawiki line 15.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.4.1/libexec/git-core/git-remote-mediawiki line 15.

不知我的Perl模块安装方法是否正确。一件事奇怪的是错误

sh: /opt/local/bin/gzip: No such file or directory

我使用带标准路径的 Homebrew,因此 gzip 二进制文件位于 /usr/local/bin/gzip。但我不知道是否或在哪里修复它。这似乎是一些搜索路径问题,但我不知道如何解决它。

您的 ~/.cpanCPAN 配置可能有问题。你可以试试

# Re-install cpan
brew doctor
brew update
brew install cpan

# Remove or back up ~/.cpan
mv ~/.cpan ~/.cpan.bak

# Re-initialize ~/.cpan
cpan config

# Try installing the Perl module again
sudo cpan install MediaWiki::API