gpt4 book ai didi

perl - IO::Prompter echo "stars"未按预期工作

转载 作者:行者123 更新时间:2023-12-02 09:05:18 24 4
gpt4 key购买 nike

我使用了去年在 Ubuntu 18.04 上全新安装时使用过的一些 Perl 代码。由于“某些”原因 IO::Prompter 无法正确回显星星,如示例中所示。

user@host:~$ sudo cpan install IO::Prompter
IO::Prompter is up to date (0.004015).

user@host:~$ perl -MIO::Prompter -E 'say prompt "foo: ", -echo=>"*"'
foo: topSecret
topSecret

user@host:~$ perl --version
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi

我忽略了什么?我在这个新的虚拟机中没有“花哨”的设置。刚刚通过 cpan 安装了缺少的库并使用附带的系统 perl。

任何帮助表示赞赏。还有替代模块建议。

最佳答案

-echo 的文档中,我们发现以下内容:

Note that this option is only available when the Term::ReadKey module is installed. If it is used when that module is not available, a warning will be issued.

因此,只需安装 Term::ReadKey 即可。

并且始终使用use strict;使用警告;!也就是说,警告可能会更好。 警告:下一个输入将以纯文本形式如果它解释了这是什么意思,将会更有用。

关于perl - IO::Prompter echo "stars"未按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59359217/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com