Install perl-JSON on centos

Noam picture Noam · Aug 1, 2012 · Viewed 58.8k times · Source

When I'm trying to run a perl script (on my centos 6 machine) I get this message:

Can't locate JSON.pm in @INC (@INC contains: 
/usr/local/lib/perl5/5.10.1/x86_64-linux-thread-multi 
/usr/local/lib/perl5/5.10.1 
/usr/local/lib/perl5/site_perl/5.10.1/x86_64-linux-thread-multi 
/usr/local/lib/perl5/site_perl/5.10.1 .)...

After googling a bit, I found out that I need to install that module; But, when I'm typing:

sudo yum install perl-JSON

I get this message:

    ...
Setting up Install Process
Package perl-JSON-2.17-1.el5.noarch already installed and latest version
Nothing to do

What can I do in order to run that script?

My perl version is v5.10.1

Thanks,

Answer

Pavel Vlasov picture Pavel Vlasov · Aug 1, 2012

Try to install it via:

1) CPAN (cpan install)

$ sudo cpan JSON

2) CPAN minus (cpanm)

Install cpan minus

$ wget http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.5017.tar.gz
$ tar -zxvf App-cpanminus-1.5017.tar.gz
$ cd App-cpanminus-1.5017
$ perl make.pl
$ make 
$ make test
$ sudo make install

Then install it via cpanm

$ sudo cpanm JSON

I prefer work with CPAN modules via cpanm, because it's modern and easy way!