ragulka ragulka - 1 year ago 69
Perl Question

How to install JSON.pm perl module on OSX

I am trying to use the po2json parser/converter from the JS gettext library (http://jsgettext.berlios.de/), but when I try to convert I get this error:

Can't locate JSON.pm in @INC (@INC contains: /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at ./po2json line 23.
BEGIN failed--compilation aborted at ./po2json line 23.

As far as I understand I am missing a perl module, namely JSON.pm, an I think it's this one: http://cpansearch.perl.org/src/MAKAMAKA/JSON-2.53/lib/JSON.pm

Now, how do I install it on OSX? I am using Mountain Lion.

I tried to do
cpan install JSON
, but it doesn't work, I get the following error:

Writing Makefile for JSON
make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible

Answer Source

The output said that make didn't return success. Probably due to some dependency. Try using cpanm http://search.cpan.org/~miyagawa/App-cpanminus-1.5017/bin/cpanm, it's really hassle free and bootstrapped quite well (no need to install other stuff).

Install using this:

curl -L http://cpanmin.us | perl - --sudo App::cpanminus