在Windows 8.1 PC上干净安装Active Perl(64位版本,版本5.24.3)后,我需要添加Spreadsheet :: Read Perl模块。但是,其CPAN安装失败。
对控制台报告的分析表明,失败的根本原因是IO :: InnerFile模块,它未安装。或者 - 更好地说 - 该模块的所有七个自动测试都失败了。测试脚本名为IO_InnerFile.t(在我的例子中)它位于C:\ Perl64 \ cpan \ build \ IO-stringy-2.111-0 \ t目录中。
jmasa的方法对我不起作用,但是这样做了:
在IO_InnerFile.t中,将# Create a test file
后面的块更改为:
# Create a test file
do {
open(OUT, '>t/dummy-test-file') || die("Cannot write t/dummy-test-file: $!");
local $\ = "\n"; ## Use `print` vs. `say` to avoid extra blank lines.
binmode OUT, ':raw'; ## Force output of UNIX line terminators.
print OUT <<'EOF';
Here is some dummy content.
Here is some more dummy content
Here is yet more dummy content.
And finally another line.
EOF
close(OUT);
};
这将更改本地化为$/
(更改为UNIX单字符行终止符)并使用它将测试文本输出到虚拟文件。
然后跑
dmake test
dmake install
很快我意识到(因为寻找)测试脚本IO_InnerFile.t只能用于行终止符是单字节的平台上。在M $ Windows的情况下,行终止符由两个字节\ r \ n序列组成,寻求绝对位置不起作用 - 只是测试本身不可移植。
可能的解决方法是添加PerlIO层“:crlf”:
my $fh = IO::File->new('<t/dummy-test-file');
并将其更改为:
my $fh = IO::File->new('<:crlf t/dummy-test-file');
注意“<:crlf”和“t / dummy-test-file”之间的空格dmake test
dmake install
注意:我不打扰正确的PATH设置和绝对文件位置,这可能会有所不同。