Perl报错you may need to install the Win32::Console module

最后都变了- 提交于 2020-01-07 18:52:37

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

ActivePerl-5.26.3.XXXX.msi安装后,命令行执行cpan,会出现如下提示而无法继续。

Can't locate Win32/Console.pm in @INC (you may need to install the Win32::Console module) (@INC contains: C:\Perl64\site\lib C:\Perl64\lib) at C:\Perl64\lib/ActivePerl/Config.pm line 400.

解决办法,修改C:\Perl64\lib\ActivePerl\Config.pm,大约在400行左右:

# Prevent calling Win32::Console::DESTROY on a STDOUT handle
#my $console;
sub _warn {
#    my($msg) = @_;
#    unless (-t STDOUT) {
#	print "\n$msg\n";
#	return;
#    }
#    require Win32::Console;
#    unless ($console) {
#	$console = Win32::Console->new(Win32::Console::STD_OUTPUT_HANDLE());
#    }
#    my($col,undef) = $console->Size;
#    print "\n";
#    my $attr = $console->Attr;
#    $console->Attr($Win32::Console::FG_RED | $Win32::Console::BG_WHITE);
#    for (split(/\n/, "$msg")) {
#	$_ .= " " while length() < $col-1;
#	print "$_\n";
#    }
#    $console->Attr($attr);
#    print "\n";
}

转载: http://euhat.com/wp/2020/01/03/you-may-need-to-install-the-win32console-module/ 方便其他遇到人的发现

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!