Network problems when installing perl dependencies using cpan

Original link: https://blog.251.sh/notes-to-use-cpan-to-install-perl-with-proxy

2.png

Recently, I have been working on the texlive upgrade of openEuler. I saw that they have their own perl bots , and the PRs of several perl packages required for the texlive upgrade have not moved, so I plan to file a PR myself.

The biggest difficulty encountered is actually the network problem, there is a small pit here.

cpan shell does not eat system variables http_proxy and https_proxy . But you can use o conf http_proxy , here comes the pit!

This must be filled in:

 o conf http_proxy http://192.168.251.187:8444

Cannot fill in this:

 o conf http_proxy 192.168.251.187:8444

Otherwise you will encounter this error:

 Fetching with HTTP::Tiny: https://cpan.org/authors/id/O/OA/OALDERS/HTTP-Cookies-6.10.tar.gz Error downloading with HTTP::Tiny: generic proxy URL must be in format http[s]://[auth@]<host>:<port>/ at /usr/share/perl5/vendor_perl/CPAN/HTTP/Client.pm line 35.

After setting, remember to save it by o conf commit , otherwise it is a temporary modification.

If you want to skip asking for proxy username and password every time you install, you can use the command export PERL_MM_USE_DEFAULT=1 to solve it. Or use o conf init /proxy/ to go through the proxy settings completely.


If you like this article, please click the “Applause” button below!

If nothing loads above, you can click here .

This article is reprinted from: https://blog.251.sh/notes-to-use-cpan-to-install-perl-with-proxy
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment