in reply to Problem installing CPAN modules

Most likely (and that's just a raw guess), your user has the HTTP proxy environment variables set up, and these get lost when you issue a command to run as the superuser via sudo. Look at whether there is a difference between:

echo $HTTP_PROXY perl -wle 'print $ENV{HTTP_PROXY}' sudo perl -wle 'print $ENV{HTTP_PROXY}'

Replies are listed 'Best First'.
Re^2: Problem installing CPAN modules
by daverave (Scribe) on Jun 28, 2010 at 09:01 UTC
    the first returns an empty null and the second two throw "Use of uninitialized value".

    So I guess my proxy is not set? This is strange, since I can surf and the previous downloads were seem to be fine. How should I set it?

    p.s.
    Please take a look at the update in my original post.

    Thanks!

    UPDATE

    I export HTTP_PROXY=http://myproxy:8080

    Now I get the correct proxy for the first 2 commands, but the one using sudo still returns "Use of uninitialized value"

      So now you need to set that variable for the superuser as well. I usually do that by starting a shell as the superuser:

      sudo bash export HTTP_PROXY=... ... whatever ... # After leaving the shell, all changes are gone again

      You might want to leave it that way for security reasons, so you only consciously pull in a HTTP proxy. If that proxy needs to be used always anyway, you can also modify the .profile of the superuser to set the proxy by editing /root/.profile or /root/.bashrc or even globally for all users by editing /etc/profile or /etc/bashrc or wherever that resides.

        I can't get it to work on sudo for perl.
        vadmin@ubu1004:~$ sudo bash root@ubu1004:~# export HTTP_PROXY=http://myproxy:8080 root@ubu1004:~# echo $HTTP_PROXY http://myproxy:8080 root@ubu1004:~# sudo echo $HTTP_PROXY http://myproxy:8080 root@ubu1004:~# perl -wle 'print $ENV{HTTP_PROXY}' http://myproxy:8080 root@ubu1004:~# sudo perl -wle 'print $ENV{HTTP_PROXY}' Use of uninitialized value in print at -e line 1.