Perl報錯you may need to install the Win32::Console module(轉)


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM