I’ve just published a new Ansible module called
perlmod_install_info whose purpose is to help you install Perl modules on systems in the most portable way possible.
Specifically, this module knows how to search for Perl modules in
apt repositories as well as in
cpanm. It prefers the OS repositories over CPAN because generally speaking you’re better off going with the OS-packaged versions of modules when they’re available, both because that’s more robust and because the OS packages install much faster than CPAN. CPAN is needed as a backstop because the OS distributions don’t include all Perl modules.
What’s especially clever about this module is that when it does need to resort to CPAN to find a module that isn’t available in the OS repository, it recursively determines all of the dependencies of that module and checks for them in the OS repository. It then returns lists of modules you can install from the OS and modules you need to install from CPAN, so you can minimize the number of modules that end up coming from CPAN.
If this sounds useful to you, you can check it out on GitHub.