Search code examples
perlinstallationperl-modulecpanmediawiki-api

OS X CPAN Perl module installation issue


I'm trying to install Perl module MediaWiki::API using CPAN on OS X:

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

This is a step of installing Git-Mediawiki (see https://github.com/moy/Git-Mediawiki/wiki/User-manual). However, after all the installation steps, the first git command reports that MediaWiki::API module isn't available:

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.

I wonder if my installation method for the Perl module is correct. One thing strikes out as odd is the error

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

I use Homebrew with standard paths, so the gzip binary is at /usr/local/bin/gzip. But I don't know if or where to fix it. It appears to be some search paths issue but I don't know how to fix it.


Solution

  • There might be something wrong with your ~/.cpan, the configuration for CPAN. You can try

    # 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