For security, I like to run CPAN.pm as a normal user so building & testing modules are all performed as a user rather than root, but of course the final installation needs to be done as root so that files can be copied to paths not writeable by normal users.
I always forget the options I need, so for my future reference as well as anyone else who finds it useful:
o conf make_install_make_command 'sudo make' o conf mbuild_install_build_command 'sudo ./Build'
That means that the actual installation gets run via sudo, with everything else just being done as the user you started the CPAN client as.
(Of course, these days, you could also use cpanm (cpanminus) with its –sudo option…)
If you liked that post, then try these...
Several Perl scripts released to Github
you need try cpanm install perl mod
I do use cpanm these days – it’s far faster and easier :)
To make cpanm use sudo as appropriate, and also use my mirror, I have the following in my .profile: