代码之家  ›  专栏  ›  技术社区  ›  ffejrekaburb

cpanm如何检索需要用户名和密码的代理的设置

  •  1
  • ffejrekaburb  · 技术社区  · 7 年前

    我的问题如下:

    1. CPANM如何与任何环境变量交互?他们会是什么?

    2. 是否有相关的代码区域可以帮助我们消除歧义,我认为CPANM内部有一个LWP接口? https://github.com/miyagawa/cpanminus/blob/devel/App-cpanminus/cpanm

    ####:/mnt/c/Projects$ sudo cpanm install Catalyst::Helper -v
    cpanm (App::cpanminus) 1.7040 on perl 5.022001 built for x86_64-linux-gnu-thread-multi
    Work directory is /home/####/.cpanm/work/1543605706.124
    You have make /usr/bin/make
    You have LWP 6.36
    You have /bin/tar: tar (GNU tar) 1.28
    Copyright (C) 2014 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Written by John Gilmore and Jay Fenlason.
    Searching install () on cpanmetadb ...
    
    ########:/mnt/c/Projects$ env | grep HTTP_proxy
    HTTP_proxy=http://####:###
    
    1 回复  |  直到 7 年前
        1
  •  2
  •   GMB    7 年前

    据我所知,cpanm(实际上 App::Cpanminus 依赖HTTP::Tiny来运行HTTP请求。

    the docs of HTTP::Tiny :

    Tiny可以代理HTTP和https请求。仅支持基本代理授权,并且必须作为代理URL的一部分提供: http://user:pass@proxy.example.com/

    因此,您应该尝试将代理用户名和密码指定为url的一部分,如:

    $ export HTTP_PROXY=http://<user>:<password>@<url>:<port>
    $ export HTTPS_PROXY=http://<user>:<password>@<url>:<port>
    

    the LWP::UserAgent docs the curl docs .