Summary
This article explains how to reduce questions during the installation of CPAN modules. Simply change the cpan configuration:
sudo cpan
o conf prerequisites_policy follow
o conf build_requires_install_policy yes
o conf commit
Discussion
Unattended installation of CPAN modules is unfortunately a utopia. The reason is simple; the interface for module installation is unrestricted, and any module can ask questions of the user during the installation process, eg "Skip network tests [y]?". This is a bother, especially when installing some modules which seem to indirectly depend on half of the modules on CPAN. These questions would be acceptable if all could have been clumped together at the start of the process, since I am not responsible for manually updating any significant number of hosts. Module dependencies are resolved in each individual package's installation process instead of being handled on a higher level, which means that it is not possible to resolve all questions at the start of the process.
Though perl's module installation process is crude, it is also in good company. Even the more modern package manager used by Debian, dpkg, also suffers from the same illness. Configuration questions pops up now and then during installation and upgrade. Ubuntu has made a fine job of minimizing most of these, but changing any system configuration file will always result in required attendance during upgrade: "Do you want to: I) install package maintainer's version..." etc. That's why I prefer configuration directory supported configuration, ie putting local changes in local files which are separate from the file in the package, eg Apache, sudo.
Back to the topic at hand. I have found three types of questions which can appear during perl module installation:
- package dependencies,
- temporary modules required for build or test, and
- package specific configuration or test.
As described in the summary, change the following cpan configuration items:
sudo cpan
o conf prerequisites_policy follow
o conf build_requires_install_policy yes
o conf commit
And there you have it, no more questions about dependencies.
Finally, one may think that solving the last item would be as simple as to tell cpan to always answer "yes" to whatever question the package is throwing in your general direction, perhaps like this:
yes | sudo cpan Some::Module
Unfortunately the world isn't black and white so the above would fail for DBIx::Migration::Directories, which asks for a directory where schemas are stored.
No comments:
Post a Comment