perl 5.18.2 was running fine on my Ubuntu 14.04 system until I needed a package from CPAN which did not exist as an Ubuntu package. I installed it as root and it didn't work but then the installation process seems to have changed permissions of something. Now, I cannot run Perl as a normal user.
As a normal user, "perl -v" works. But "perl -V" gives me this:
$ perl -V
Can't locate Config.pm: Permission denied.
BEGIN failed--compilation aborted.
If I run it under sudo, then it works:
$ sudo perl -V
...
@INC:
/etc/perl
/usr/local/lib/perl/5.18.2
/usr/local/share/perl/5.18.2
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.18
/usr/share/perl/5.18
/usr/local/lib/site_perl
.
Indeed, Config.pm exists in /usr/lib/perl/5.18 and its permissions are readable by normal users. So, something has switched to root and I don't know what has.
Has anyone seen this before and know what I should be looking for? Out of desperation, I even uninstalled perl and reinstalled it back. Didn't work. Though something funny...after uninstalling, I still had a /usr/bin/perl executable. Not sure if that is related...
Any help would be appreciated!
Ray
From some googling (see here) I understand that if one of the directories in the @INC path is inaccessible, the search for Config.pm (or any module) is abandoned. So check whether any of the directories is not readable by "all".
Strangely enough, a non-existent directory name in the @INC path is no problem.
You can try install
local::lib
. But you'll probably have to reinstall some Perl modules.sudo apt-get install cpanminus
cpanm --local-lib=~/perl5 local::lib eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
echo "export PERL5LIB=\"$HOME/perl5/lib/perl5\"">>~/.bashrc && echo "export PERL_MB_OPT=\"--install_base '$HOME/perl5'\">>~/.bashrc && echo "export PERL_LOCAL_LIB_ROOT=$HOME/perl5">>~/.bashrc
Now, open a new terminal(or run
source ~/.bashrc
) and try to install some Perl module.Works for me! Hope works for you too! Otherwise, that means your CPAN installation is broken. In this case, use command
sudo dpkg --list | grep libcpan
to list all cpan's packages, try to upgrade packages at first.If still doesn't work try to remove and reinstall all of them! After that, install
local::lib
again repeating the steps above.