How to get CPAN to use Http Proxy?

How to get CPAN to use Http Proxy?

am 24.10.2005 19:02:28 von Chuck Carson

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

Re: How to get CPAN to use Http Proxy?

am 24.10.2005 19:24:41 von usenet

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).

Re: How to get CPAN to use Http Proxy?

am 24.10.2005 19:27:14 von Chuck Carson

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

Re: How to get CPAN to use Http Proxy?

am 24.10.2005 19:32:17 von Chuck Carson

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

Re: How to get CPAN to use Http Proxy?

am 24.10.2005 19:44:14 von usenet

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.

Re: How to get CPAN to use Http Proxy?

am 24.10.2005 19:47:51 von Chuck Carson

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

Re: How to get CPAN to use Http Proxy?

am 24.10.2005 20:04:15 von usenet

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???

Re: How to get CPAN to use Http Proxy?

am 24.10.2005 21:01:22 von Chuck Carson

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.p m
/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-threa d-multi/Encode/Config.pm
/u01/app/oracle/product/10.2/perl/lib/5.8.3/i686-linux-threa d-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

Re: How to get CPAN to use Http Proxy?

am 25.10.2005 00:04:11 von usenet

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.

Re: How to get CPAN to use Http Proxy?

am 25.10.2005 09:05:15 von harryooopotter

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.

Re: How to get CPAN to use Http Proxy?

am 25.10.2005 10:39:19 von Villy Kruse

On 24 Oct 2005 10:02:28 -0700,
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.
>

If you do set the ftp proxy and you do have LWP installed then LWP
will use the ftp proxy to access a remote ftp server. The ftp proxy
is just a normal web proxy specified as "http://proxyserver".

Villy

Re: How to get CPAN to use Http Proxy?

am 25.10.2005 11:21:43 von ced

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