mirror of
https://github.com/tuna/mirror-web.git
synced 2025-12-25 20:32:46 +00:00
help: CPAN: disable pushy_https
Ref https://github.com/tuna/mirror-web/issues/330 Cc @XuehaiPan
This commit is contained in:
parent
9e56d40269
commit
4e5585a14f
|
|
@ -9,17 +9,24 @@ CPAN 镜像使用帮助
|
|||
|
||||
[CPAN](https://www.cpan.org/) (The Comprehensive Perl Archive Network) 镜像源的配置文件为 `MyConfig.pm`(一般位于 `~/.cpan/CPAN/MyConfig.pm`),可使用包管理脚本 `cpan` 进行修改。
|
||||
|
||||
首先需确保 MyConfig.pm 配置文件存在,在命令行中执行:
|
||||
### 初次使用
|
||||
|
||||
如果 `MyConfig.pm` 配置文件不存在,在命令行中执行:
|
||||
|
||||
```bash
|
||||
# 确保 MyConfig.pm 配置文件存在,如不存在则自动生成
|
||||
PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'mkmyconfig'
|
||||
# 自动生成 MyConfig.pm
|
||||
## 对于 Perl 5.36 (或 CPAN 2.29)及以上,使用如下命令
|
||||
PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'CPAN::HandleConfig->edit("pushy_https", 0); CPAN::HandleConfig->edit("urllist", "unshift", "https://{{ site.hostname }}/CPAN/"); mkmyconfig'
|
||||
## 对于较久版本,使用如下命令
|
||||
PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'CPAN::HandleConfig->edit("urllist", "unshift", "https://{{ site.hostname }}/CPAN/"); mkmyconfig'
|
||||
|
||||
# 不使用默认配置,手动确认各个配置选项
|
||||
# 或不使用默认配置,手动确认各个配置选项
|
||||
perl -MCPAN -e 'mkmyconfig'
|
||||
```
|
||||
|
||||
### 在 CPAN Shell 中手动设置镜像
|
||||
### 已有配置
|
||||
|
||||
#### 在 CPAN Shell 中手动设置镜像
|
||||
|
||||
在命令行中执行 `cpan` 进入 cpan shell:
|
||||
|
||||
|
|
@ -41,14 +48,17 @@ cpan[3]> o conf urllist push https://{{ site.hostname }}/CPAN/
|
|||
# 或清空镜像列表,仅保留本站
|
||||
cpan[4]> o conf urllist https://{{ site.hostname }}/CPAN/
|
||||
|
||||
# Perl 5.36 及以上用户需要关闭 pushy_https 以使用镜像站
|
||||
cpan[5]> o conf pushy_https 0
|
||||
|
||||
# 保存修改后的配置至 MyConfig.pm
|
||||
cpan[5]> o conf commit
|
||||
cpan[6]> o conf commit
|
||||
|
||||
# 退出 cpan shell
|
||||
cpan[6]> quit
|
||||
cpan[7]> quit
|
||||
```
|
||||
|
||||
### 在命令行中使用脚本设置
|
||||
#### 在命令行中使用脚本设置
|
||||
|
||||
在命令行中执行:
|
||||
|
||||
|
|
@ -63,4 +73,9 @@ if ! (
|
|||
-e 'CPAN::HandleConfig->edit("urllist", "unshift", "https://{{ site.hostname }}/CPAN/");' \
|
||||
-e 'CPAN::HandleConfig->commit()'
|
||||
fi
|
||||
|
||||
# Perl 5.36 及以上用户还需要关闭 pushy_https
|
||||
perl -MCPAN -e 'CPAN::HandleConfig->load();' \
|
||||
-e 'CPAN::HandleConfig->edit("pushy_https", 0);' \
|
||||
-e 'CPAN::HandleConfig->commit()'
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue