欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 社会 > perl包安装的CPAN大坑

perl包安装的CPAN大坑

2025/1/8 14:13:06 来源:https://blog.csdn.net/u014210048/article/details/144913862  浏览:    关键词:perl包安装的CPAN大坑

先看一个用cpan安装的例子。

$cpan -i App::cpanminus
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/home/wubin/.cpan/Metadata'Database was generated on Tue, 24 Dec 2024 15:29:01 GMT
Running install for module 'App::cpanminus'Trying with/usr/bin/wget -O "/home/wubin/.cpan/sources/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7048.tar.gz.tmp102266"
to gethttps://cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7048.tar.gz
--2024-12-25 16:27:09--  https://cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7048.tar.gz正在解析主机 cpan,org...151.101.193.55,151.101.1.55,151.101.65.55
正在连接 cpan,orgl151.101.193.551:443...已连接。
错误:无法验证 cpan.org 的由 "/c=Us/o=Let's Encrypt/CN=R11" 颁发的证书:无法本地校验颁发者的权限。
要以不安全的方式连接至 cpan.org,使用:--no-check-certificateFunction system("/usr/bin/wget -O "/home/wubin/.cpan/sources/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7048.tar.gz.tmp102266" "https://cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7048.tar.gz" ")returned status 5 (wstat 1280), left
/home/wubin/.cpan/sources/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7048.tar.gz.tmp102266 with size 0Giving up on '/home/wubin/.cpan/sources/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7048.tar.gz'
Note: Current database in memory was generated on Tue, 24 Dec 2024 15:29:01 GMT
如果是直接用wget 下载,那当然可以直接添加 “--no-check-certificate”,
但我用的不是wget命令,而是cpan命令?
cpan调用了wget来下载, 怎么将 “--no-check-certificate”这个参数传给wget
github上这个帖子有几个解决方式:
https://github.com/miyagawa/cpanminus/issues/634
分别是:
  • 第一种

$ cat ~.wgetrc
check_certificate = off
  • 第二种
setting PERL_LWP_SSL_VERIFY_HOSTNAME to 0 will disable the SSL hostname verification.
https://metacpan.org/pod/LWP#PERL_LWP_SSL_VERIFY_HOSTNAME
CPAN is still available over HTTP. The index pages redirect to HTTPS, but individual files for modules and indexes are available over HTTP.
Try: curl -svo /dev/null http://www.cpan.org/modules/02packages.details.txt.gz and you will see 200 OK, not 301 redirect.

最终是第二种方式管用:

PERL_LWP_SSL_VERIFY_HOSTNAME=0 cpan install Net::SSLeay

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com