in reply to Cannot install CPAN (or any other modules) as root user!!!

Instead of running the entire process as root, why don't you configure cpan to install as root using one of the following:
o conf make_install_make_command 'su root -c make' o conf mbuild_install_build_command 'su root -c ./Build'
o conf make_install_make_command 'sudo make' o conf mbuild_install_build_command 'sudo ./Build'
o conf make_install_make_command 'sudo -u root make' o conf mbuild_install_build_command 'sudo -u root ./Build'

It won't solve your problem so much as bypass it. And it's safer as a bonus!

Note that the change isn't permanent unless you follow up using the following:

o conf commit

Update: Added instructions to use su/sudo with distros that use Module::Build (Build.PL).
Update: Fixed to use correct configuration option name, as per afauno's reply.

Replies are listed 'Best First'.
Re^2: Cannot install CPAN (or any other modules) as root user!!!
by ARiccela (Novice) on Jul 14, 2009 at 18:22 UTC
    I found my problem... as my user CPAN is pointing as a Metadata file path different than root user is. I've been staring at this terminal screen for too long. I will implement your method so when I forget to switch users I'll be OK. In fact, looks like I won't have to remember to switch users.
Re^2: Cannot install CPAN (or any other modules) as root user!!!
by afauno (Novice) on Aug 31, 2010 at 14:22 UTC

    Thanks for the idea, it never occurred to me...

    Althought for the Module::Build part I suppose you meant mbuild_install_build_command instead of mbuild_arg