Miserable Variable Miserable Variable - 1 year ago 75
Perl Question

How to prevent cpan fron using proxy?

My knowledge of perl is limited to running commands. I have managed to come up with a shell script to output the gav of a pom.xml, using xpath as follows:

xpath pom.xml '//project/artifactId/text()'

On a new machine right now, this does not work because I do not have the XPath.pm installed:

Can't locate XML/XPath.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.14/x86_64-cygwin-threads /usr/lib/perl5/site_perl/5.14 /usr/lib/perl5/vendor_perl/5.14/x86_64-cygwin-threads /usr/lib/perl5/vendor_perl/5.14 /usr/lib/perl5/5.14/x86_64-cygwin-threads /usr/lib/perl5/5.14 .)

I seem to remember installing XPath using cpan so I tried the following command, blindly:

cpan XPath

This is probably not the correct command to use, but I think that is unrelated to the issue I am facing. The command gives following error:

Going to read '/home/****/.cpan/Metadata'
Database was generated on Mon, 25 Aug 2014 00:41:02 GMT
Fetching with HTTP::Tiny:
HTTP::Tiny failed with an internal error: Could not connect to 'proxy:8080': IO::Socket::INET: Bad hostname 'proxy' at /usr/lib/perl5/5.14/HTTP/Tiny.pm line 139

Proxy authentication needed!
(Note: to permanently configure username and password run
o conf proxy_user your_username
o conf proxy_pass your_password
Username: C-c C-c

Why is
looking for host proxy? We do have a corporate proxy with hostname proxy but that is needed only when I am on corporate network or VPN, neither of which is case right now.

How do I convince
to connect directly to internet? I do not have an envvar named

Answer Source

While the environment variable is used, cpan first checks its configuration.

To view: o conf http_proxy
To clear: o conf http_proxy ''

Don't forget to use o conf commit to make the change permanent.