need to install the Win32::Console module

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

Can't locate Win32/Console.pm in @INC (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行左右:

392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# 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";
}