How to get CPAN to use Http Proxy?

Discussion in 'Perl Misc' started by Rhugga, Oct 24, 2005.

  1. Rhugga

    Rhugga Guest

    How can I force CPAN to use an http proxy for all it's downloads? When
    configuring CPAN, I specified only an http proxy (thus leaving ftp
    proxy blank). However, it is still trying to use ftp to grab it's
    files.

    log:
    Trying with "/usr/bin/wget -O -" to get
    ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
    --11:45:00-- ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
    => `-'
    Resolving ftp.perl.org... done.
    Connecting to ftp.perl.org[207.45.221.24]:21... failed: Connection
    timed out.
    Connecting to ftp.perl.org[153.106.5.70]:21... failed: Connection timed
    out.
    Retrying.

    --11:51:19-- ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
    (try: 2) => `-'
    Connecting to ftp.perl.org[207.45.221.24]:21... failed: Connection
    timed out.
    Connecting to ftp.perl.org[153.106.5.70]:21...
    failed: Connection timed out.
    Retrying.

    --11:57:39-- ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
    (try: 3) => `-'
    Connecting to ftp.perl.org[207.45.221.24]:21... failed: Connection
    timed out.
    Connecting to ftp.perl.org[153.106.5.70]:21...


    Thanks,
    CC
     
    Rhugga, Oct 24, 2005
    #1
    1. Advertising

  2. Rhugga

    Guest

    Rhugga wrote:
    > When configuring CPAN, I specified only an http proxy (thus leaving
    > ftp proxy blank).


    Even if you don't type anything, it will propose the default ftp in
    your path (such as /usr/bin/ftp). If you just hit ENTER, this will
    become the default value. You can edit your CPAN/Config.pm file to
    make sure the value is blank.

    FWIW, I have messed with CPAN a LOT at my place of employment. I'm
    behind an authenticating proxy server, and I was not able to get ANY of
    the available CPAN methods to work. I was able to use a KLUDGE
    (warning: this is a KLUDGE) which I described in a posting here:
    http://tinyurl.com/dug5y (did I mention this is a KLUDGE?). But it
    works great (though it's a KLUDGE).
     
    , Oct 24, 2005
    #2
    1. Advertising

  3. Rhugga

    Rhugga Guest

    I am able to get CPAN working fine using a proxy on our SLES 9
    machines, however, on AS3U4 systems it won't.

    However, our custom AS3 iso doesn't come with CPAN so I'm not sure
    where to configure this. I will try the config.pm file.

    Thx,
    CC
     
    Rhugga, Oct 24, 2005
    #3
  4. Rhugga

    Rhugga Guest

    Yea, that doesn't work. Each time I execute 'perl -MCPAN -e shell' it
    tries to configure itself, which hangs here:

    Your proxy user id?
    You have no /root/.cpan/sources/MIRRORED.BY
    I'm trying to fetch one
    CPAN: LWP::UserAgent loaded ok
    Fetching with LWP:
    ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY


    I need to get past this configure phase, so I can manu8ally edit the
    Config.pm file, and the hopefully it will work. Any ideas how I can get
    it to get past this point?
    Thx,
    CC
     
    Rhugga, Oct 24, 2005
    #4
  5. Rhugga

    Guest

    Rhugga wrote:
    > I need to get past this configure phase


    Not really. Your CPAN module directory has a Config.pm file in it
    already. Edit that directly.
     
    , Oct 24, 2005
    #5
  6. Rhugga

    Rhugga Guest

    yea, I edited that file directly, however, each time I execute 'perl
    -MCPAN -e shell' it forces manual configuration.

    Here is the Config.pm file:
    $CPAN::Config = {
    'build_cache' => q[10],
    'build_dir' => q[/var/spool/cpan/build],
    'cache_metadata' => q[1],
    'cpan_home' => q[/var/spool/cpan],
    'ftp' => q[ ],
    'ftp_proxy' => q[ ],
    'getcwd' => q[cwd],
    'gpg' => q[/usr/bin/gpg],
    'gzip' => q[/bin/gzip],
    'histfile' => q[/var/spool/cpan/histfile],
    'histsize' => q[100],
    'http_proxy' => q[http://www-proxy.us.oracle.com:80/],
    'inactivity_timeout' => q[0],
    'index_expire' => q[1],
    'inhibit_startup_message' => q[0],
    'keep_source_where' => q[/var/spool/cpan/sources],
    'lynx' => q[/usr/bin/lynx],
    'make' => q[/usr/bin/make],
    'make_arg' => q[],
    'make_install_arg' => q[UNINST=1],
    'makepl_arg' => q[],
    'ncftp' => q[ ],
    'ncftpget' => q[ ],
    'no_proxy' => q[],
    'pager' => q[/usr/bin/less],
    'prerequisites_policy' => q[follow],
    'proxy_user' => q[],
    'scan_cache' => q[atstart],
    'shell' => q[/bin/bash],
    'tar' => q[/bin/tar],
    'term_is_latin' => q[1],
    'unzip' => q[/usr/bin/unzip],
    'urllist' => [q[http://www.perl.com/CPAN/],
    q[http://cpan.belfry.net/], q[http://www.binarycode.org/cpan]],
    'wget' => q[/usr/local/git/bin/wget],
    };
    1;
    __END__


    Thx,
    CC
     
    Rhugga, Oct 24, 2005
    #6
  7. Rhugga

    Guest

    Rhugga wrote:
    > Here is the Config.pm file:


    Hmmm. That's odd.

    CPAN.pm checks the config file thus:

    sub missing_config_data {
    my(@miss);
    for (
    "cpan_home", "keep_source_where", "build_dir", "build_cache",
    "scan_cache", "index_expire", "gzip", "tar", "unzip", "make",
    "pager",
    "makepl_arg", "make_arg", "make_install_arg", "urllist",
    "inhibit_startup_message", "ftp_proxy", "http_proxy",
    "no_proxy",
    "prerequisites_policy",
    "cache_metadata",
    ) {
    push @miss, $_ unless defined $CPAN::Config->{$_};
    }
    return @miss;
    }

    Since all is defined in your config file, it seems that this check
    should return an empty array.

    What happens if you edit CPAN.pm and comment-out the return statement?
    I'm wondering if you have more than one copy of the CPAN module and
    you're hacking on one version but @INC is finding another???
     
    , Oct 24, 2005
    #7
  8. Rhugga

    Rhugga Guest

    When I do a find on Config.pm I get the following:
    [root@adcinfops02 root]# find / -name Config.pm -print
    /usr/lib/perl5/5.8.0/Net/Config.pm
    /usr/lib/perl5/5.8.0/i386-linux-thread-multi/Config.pm
    /usr/lib/perl5/5.8.0/i386-linux-thread-multi/Encode/Config.pm
    /usr/lib/perl5/5.8.0/CPAN/Config.pm
    /usr/local/oracle/perl/5.8.1/lib/CPAN/Config.pm
    /usr/local/oracle/perl/5.8.1/lib/Encode/Config.pm
    /usr/local/oracle/perl/5.8.1/lib/Config.pm
    /usr/local/oracle/perl/5.8.1/lib/Net/Config.pm
    /u01/app/oracle/product/10.2/inventory/Templates/perl/lib/5.8.3/i686-linux-thread-multi/Config.pm
    /u01/app/oracle/product/10.2/perl/lib/5.8.3/Net/Config.pm
    /u01/app/oracle/product/10.2/perl/lib/5.8.3/i686-linux-thread-multi/Encode/Config.pm
    /u01/app/oracle/product/10.2/perl/lib/5.8.3/i686-linux-thread-multi/Config.pm

    The stuff under /usr/local/oracle is for a version of perl in a
    different location. I am trying to install CPAN for the perl in
    /usr/bin. I believe the output I posted before was from the wrong
    Config.pm. I just looked at /usr/lib/perl5/5.8.0/CPAN/Config.pm and all
    it contains is a single line:
    1;

    i'm gonna try copying a Config.pm from another location and try using
    it.

    Thx,
    CC
     
    Rhugga, Oct 24, 2005
    #8
  9. Rhugga

    Guest

    Rhugga wrote:
    > I just looked at /usr/lib/perl5/5.8.0/CPAN/Config.pm and all
    > it contains is a single line:
    > 1;


    Thought so. Yeah, that would cause it to wanna run the config script.
     
    , Oct 24, 2005
    #9
  10. Rhugga

    Harry Guest

    Rhugga wrote...
    >
    >How can I force CPAN to use an http proxy for all it's downloads? When
    >configuring CPAN, I specified only an http proxy (thus leaving ftp
    >proxy blank). However, it is still trying to use ftp to grab it's
    >files.



    On my Windows command prompt, I can set the following to let
    wget to go through my company's proxy server.

    set http_proxy=http://my.proxy.server.com:80/
    set ftp_proxy=http://my.proxy.server.com:80/

    I believe it will work in a similar on *nix.
    Check out the man page of wget.
     
    Harry, Oct 25, 2005
    #10
  11. Rhugga

    Guest

    Rhugga wrote:
    > How can I force CPAN to use an http proxy for all it's downloads? When
    > configuring CPAN, I specified only an http proxy (thus leaving ftp
    > proxy blank). However, it is still trying to use ftp to grab it's
    > files.
    > ...



    In a thread long ago someone suggested:

    perl -MCPAN -e 'delete $INC{"Net/FTP.pm"};sub Net::FTP::new {}; shell'

    (CPAN.pm also uses a 'dontload' which can be used as well.)

    but I believe this can be shortened to just:

    perl -MCPAN -e 'delete $INC{"Net/FTP.pm"}; shell'

    or setting this up as a function, I use:

    cpan () {
    /ots/perl/bin/perl-5.8.7 -MCPAN -e \
    'delete $INC{"Net/FTP.pm"}; shell'
    }

    hth,
    --
    Charles DeRykus
     
    , Oct 25, 2005
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. carl d.
    Replies:
    1
    Views:
    386
    A. Sinan Unur
    May 10, 2005
  2. Replies:
    5
    Views:
    205
    Randy Kobes
    Oct 12, 2005
  3. Ben Bullock
    Replies:
    12
    Views:
    286
    Ben Bullock
    Jul 8, 2008
  4. SVCitian
    Replies:
    1
    Views:
    939
    SVCitian
    Oct 22, 2010
  5. PerlFAQ Server
    Replies:
    0
    Views:
    168
    PerlFAQ Server
    Jan 24, 2011
Loading...

Share This Page