Wednesday, January 9, 2008

Note to self: Perl Module Installation using CPAN

First approach:
[root@svr rrdtool]# perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.61)
ReadLine support available (try 'install Bundle::CPAN')

cpan> install Time::HiRes
CPAN: Storable loaded ok

Makefile:91: *** missing separator
then set the environment variable LC_ALL to "C" and retry
from scratch (re-run perl "Makefile.PL").
(And consider upgrading your Perl.)
(You got this message because you seem to have
an UTF-8 locale active in your shell environment, this used
to cause broken Makefiles to be created from Makefile.PLs.)
Makefile:91: *** missing separator. Stop.

To search for module while in the shell:
cpan> i /HiRes/
Or if you know the exact name of the modules, can install it straight away:
[root@svr rrdtool]# perl -MCPAN -e install 'Time::HiRes'

To check the installed modules:
[root@svr4 nagios]# perl -e 'use Time::HiRes;'
Can't locate Time/ in @INC -- meaning the modules is not(yet) installed

For manual installation:
Go search for the module at here, then:

[root@svr rrdtool]wget
[root@svr rrdtool] tar -zxvf Time-HiRes-1.9711.tar.gz
[root@svr rrdtool] cd Time-HiRes-1.9711
[root@svr Time-HiRes-1.9711] perl Makefile.PL
[root@svr Time-HiRes-1.9711] make
[root@svr Time-HiRes-1.9711] make test
[root@svr Time-HiRes-1.9711] make install

Back to the error, google brought me to perl monks website

"RH9 caused more than a few problems for me with a number of modules until I edited my /etc/sysconfig/i18n file. Here's mine:



It looks like some modules (like CPAN!) don't like that UTF-8. If you don't want to monkey with your system-wide locale setting, just type "export LANG=en_US" and then try your install again."

So i did just that.
Test the module again:

[root@svr4 Time-HiRes-1.9711]# perl -e 'use Time::HiRes;'
[root@svr4 Time-HiRes-1.9711]#

No error means the modules is there.

No comments: