How to build Perl module rpm file with cpanspec on RHEL/CentOS Linux

Originally published at:

I am using CentOS/RHEL 7.x heavily, and many needed CPAN modules missing. I want to distribute Perl modules from CPAN to 100s of VMs and bare metal servers. Unfortunately running cpanm Module::Name OR perl -MCPAN -e ‘install Module::Name’ is not an option. Is there any way to build RPM packages with rpmbuild for specific Perl module on a CentOS/RHEL 7.x server? What’s the easiest way to install a missing Perl module using the ?