Can’t locate CPAN.pm – Fixed
To install Perl modules from CPAN using an interactive shell, we use the command:
perl -MCPAN -e shell
If we type this command in CentOS 6.4, we get an error as shown in Figure-1
[Figure-1]
If we get an error “Can’t locate CPAN.pm”, it means that the module ‘perl-CPAN’ is not installed in CentOS. This package comes pre-bundled with CentOS and we have yum configured correctly in CentOS, we can install this module as shown in Figure-2.
[Figure-2]
When we use yum to install perl-CPAN module, it looks for its dependencies and lists them as shown in Figure-3.
[Figure-3]
Once we press ‘y’ to continue installing the package along with its dependecies, the package is installed in CentOS. After installing the package, when we issue the command again: perl -MCPAN -e shell, we get an interactive shell prompt, as shown in Figure-4 and the problem “Can’t locate CPAN.pm’ is SOLVED.
[Figure-4]
Installing perl-CPAN modules solves the issue ‘Can’t locate CPAN.pm in @INC’.