http://www.perlmonks.org?node_id=759227

BJ_Covert_Action has asked for the wisdom of the Perl Monks concerning the following question:

Howdy All, I have been working for a few hours now on getting some stuff configured on my home box which is running Ubuntu 8.04 right now. Basically, I have troubleshot a lot of the problems down to this:

I typically use the CPAN.pm shell to install any modules I need/want/so eagerly desire from the CPAN. In order to get a successful make test and install, I usually have to access the CPAN shell via the root account. I have been doing so by using:

sudo perl -MCPAN -e shell

Once in the CPAN shell I go through the entire get, make, test, and install command set with whatever perl module I want (this time I was trying to get Pod::Simple downloaded). Interestingly enough, the install seems to work without a hitch as I would hope. However, when I then exit the CPAN shell I test to ensure that the new module is, indeed, accessible to me via:

sudo perl -MPod::Simple

...at which point I am consistently notified that the module does not exist in my @INC variable which includes:

/etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .

I started reviewing my CPAN module install command output and found that my modules were actually installing to: /root/perl. Which, as you can see, is not in my @INC variable. So I have been digging now for a couple hours for a workaround and have come up dry.

Ideas I have had for fixing this bug were:

1) Reconfigure my CPAN module to install to a different directory

2) Reconfigure my @INC variable to contain the /root/perl directory (could cause permission issues?)

3) Install modules with the CPAN shell not as root (tried this, almost always results in a permissions error)

So I am kind of at an impasse. I looked for info on how to do 1 or 2, but couldn't find anything solid. I did try adding /root/perl to my /etc/profile file PERLLIB variable (yes, I included the export command) and nothing seemed to happen. Any ideas?

Thanks for all help ahead of time,

Brady