Silent and scripted install of CPAN and Perl modules?

You might want to look at cpanm for this; it's lightweight, shell scriptable, and much simpler than classic CPAN.


Try setting this environment variable before running CPAN:

export PERL_MM_USE_DEFAULT=1

It makes perl automatically answer "yes" when CPAN asks "Would you like to configure as much as possible automatically? [yes]"

Source


"And how do I launch module installations directly from the command line?"

This should do:

perl -MCPAN -e 'install Your::Package'

If it's a repetitive task, it may pay to spend a few hours with cpan2rpm and turn them into RPM's. In my experience, CPAN runs (even interactive) are too plagued by unexpected events (version quirks, network problems, bogus tests failures) to be relied upon in a (semi-)automatic install.