非root用户没有权限写/usr/lib/perl5,所以编译Perl模块时必须将PREFIX设置到自己的主目录下。使用CPAN时可以这样设置:

第一次启动CPAN,执行设置时,以下问题回答 PREFIX=~/perl

Parameters for the 'perl Makefile.PL' command?
Typical frequently used settings:

    PREFIX=~/perl       non-root users (please see manual for more hints)

Your choice:  [INSTALLDIRS=site] PREFIX=~/perl

然后编辑~/.bashrc,添加这样一行,然后重新登录或直接执行source ~/.bashrc。否则CPAN中的make test会出错。

export PERL5LIB=`echo ~/perl/*/perl/* | sed 's/ /:/g'`