The first time you run cpan from the command line, you are prompted for answers to various questions. How do you automate cpan and install modules non-interactively from the beginning?
"cpan" splits this variable on whitespace and prepends that list to @ARGV before it processes the command-line arguments. For instance, if you always want to use "local:lib", you can set "CPAN_OPTS" to "-I".
The main difference between the two is that if you have Perl you should already have the cpan command. Whereas you won't have cpanm unless/until you install it.
CPAN doesn't actually install files. It runs the install script embedded in each distribution, which then performs the actual install. For distributions using ExtUtils::MakeMaker, the defaults are documented here: https://metacpan.org/pod/ExtUtils::MakeMaker#make-install (and the default value of INSTALLDIRS is site ).
Since it hasn't been mentioned yet, cpanminus is a zero-conf cpan installer. And you can download a self-contained executable if it isn't available for your version control.
The cpanm executable is easily installed (as documented in the executable itself) with:
curl -L http://cpanmin.us | perl - --self-upgrade # or wget -O - http://cpanmin.us | perl - --self-upgrade
I was looking for an easy solution for this as well and found that this works:
(echo y;echo o conf prerequisites_policy follow;echo o conf commit)|cpan
Just thought I would post it here in case anyone else comes along.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With