in reply to cpan build environment

Hi DennisLGolden,

In one of your replies in this thread you wrote "If UID and GID are always 1000:1000 from CPAN, I can live with it." I just downloaded three .tar.gz files from CPAN at random and can verify that it is not the case, I've got varying UID/GIDs.

Tar archives store the UID/GID information, and my understanding is that when extracting tar archives as root, those UID/GIDs will be restored, and when running as a normal user they won't (because they can't). So CPAN may not change the permissions, but untarring as root does.

Modifying the system Perl is a whole nother topic, but one of the reasons not to do so, in short, is that installing modules into the system Perl can go wrong, and then picking apart the mess caused by that can be pretty bad. I now always install a fresh Perl in a different location (you can do this by hand fairly easily or with perlbrew), and install all the modules I want there, and I see doing so recommended often. When I install modules into the system Perl I only use the system's repositories and package manager.

Having said that, it's possible to clean up the situation - as was already said, you could just sudo chown -R the ~/.cpan directory. Another possible solution that hasn't been mentioned yet is to run the build process as a normal user, but configure CPAN to use sudo for only those commands where it is necessary, which is the "install" step. Search the CPAN page for "sudo", and it'll reveal the two config options you need to set: make_install_make_command and mbuild_install_build_command (note I haven't tried this myself but I see it referenced in several articles online).

Hope this helps,
-- Hauke D