CPAN error please check the validity of the index file
To install a module from CPAN in CentOS, we need to install perl-CPAN module. After it is installed, we may use interactive shell by using the command: “perl -MCPAN -e shell”, or we can also use ‘CPAN’ command to install a cpan module. When I tried to install a CPAN module, I got an error: ‘Please check the validity of the index file by comparing it to more than one CPAN mirror’, as shown in Figure-1.
It looks as if the something got corrupted in cpan installation, I tried to remove the ‘.cpan’ directory from inside root, as shown in Figure-2.
After deleting ~/.cpan directory, I uninstalled perl-CPAN module from CentOS, using the command: ‘yum remove perl-CPAN’, as shown in Figure-3.
After uninstalling perl-CPAN module, I did a re-install of this module using yum, as shown in Figure-4.
Yum searched for its dependencies that are not installed and listed it as shown in Figure-5. In this case, only the package needs to be installed as all dependencies are already installed. Press ‘y’ to continue installing all packages.
It installs the perl-CPAN module along with all of its dependencies as shown in Figure-6.
Now, if I try to install CPAN modules with ‘cpan’ command or try an interactive shell using ‘perl -MCPAN -e shell’, it all worked fine and the problem ‘Please check the validity of the index file by comparing it to more than one CPAN mirror’, got FIXED.