Perl Encode::Locale未能通过Cygwin中的3/13环境测试

Perl Encode::Locale未能通过Cygwin中的3/13环境测试,perl,cygwin,Perl,Cygwin,我在Cygwin(v1.7.35,64位版本)中安装Encode::Locale时遇到问题,并且在t/env.t中测试失败时出错 $ cpan install Encode::Locale Going to read '/home/agrajag9/.cpan/Metadata' Database was generated on Mon, 23 Mar 2015 12:17:02 GMT Running install for module 'Encode::Locale' Running

我在Cygwin(v1.7.35,64位版本)中安装
Encode::Locale
时遇到问题,并且在
t/env.t
中测试失败时出错

$ cpan install Encode::Locale
Going to read '/home/agrajag9/.cpan/Metadata'
  Database was generated on Mon, 23 Mar 2015 12:17:02 GMT
Running install for module 'Encode::Locale'
Running make for G/GA/GAAS/Encode-Locale-1.04.tar.gz
Checksum for /home/agrajag9/.cpan/sources/authors/id/G/GA/GAAS/Encode-Locale-1.04.tar.gz ok

  CPAN.pm: Going to build G/GA/GAAS/Encode-Locale-1.04.tar.gz

Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Encode::Locale
Writing MYMETA.yml and MYMETA.json
cp lib/Encode/Locale.pm blib/lib/Encode/Locale.pm
Manifying 1 pod document
  GAAS/Encode-Locale-1.04.tar.gz
  make -- OK
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/alias.t ...... ok
t/arg.t ........ # ENCODING_LOCALE is UTF-8
t/arg.t ........ ok
t/env.t ........ Failed 3/13 subtests
t/tain.t ....... ok
t/warn_once.t .. ok

Test Summary Report
-------------------
t/arg.t      (Wstat: 0 Tests: 4 Failed: 0)
  TODO passed:   1-4
t/env.t      (Wstat: 0 Tests: 10 Failed: 0)
  Parse errors: Bad plan.  You planned 13 tests but ran 10.
Files=5, Tests=25,  2 wallclock secs ( 0.05 usr  0.19 sys +  0.29 cusr  0.68 csys =  1.21 CPU)
Result: FAIL
Failed 1/5 test programs. 0/25 subtests failed.
Makefile:856: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 255
  GAAS/Encode-Locale-1.04.tar.gz
  make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports GAAS/Encode-Locale-1.04.tar.gz
Running make install
  make test had returned bad status, won't install without force
手动将编译版本的
Encode/Locale.pm
复制到
/lib/perl5/5.14/
并运行
env.t

$ perl t/env.t
1..13
ok 1 - env read
ok 2 - env write retval old value
ok 3 - env write worked
ok 4 - env affected %ENV
ok 5 - env write retval old value
ok 6 - env write worked
ok 7 - env write undef deletes from %ENV
ok 8 - env write retval encoded
ok 9 - env write worked
ok 10 - env affected %ENV
以下测试似乎失败:

is env("\x{20AC}", 1), undef, 'env write retval old value';
is env("\x{20AC}"), 1, 'env write worked';
is $ENV{"\x80"}, 1, 'env affected %ENV';
perl-v的输出

This is perl 5, version 14, subversion 4 (v5.14.4) built for cygwin-thread-multi
(with 14 registered patches, see perl -V for more detail)

Copyright 1987-2013, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

将Cygwin环境变量的名称设置为7位ASCII之外会导致我使用的每个perl版本都出现分段错误,在python中也是不允许的

import os;
os.environ[chr(126)]="126"
print os.environ[chr(126)]
os.environ[chr(130)]="130"
print os.environ[chr(130)]

$ python env.py
126
Traceback (most recent call last):
  File "env.py", line 4, in <module>
    os.environ[chr(130)]="130"
  File "/usr/lib/python2.7/os.py", line 473, in __setitem__
    putenv(key, item)
OSError: [Errno 14] Bad address
导入操作系统;
操作系统环境[chr(126)]=“126”
打印操作系统环境[chr(126)]
操作系统环境[chr(130)]=“130”
打印操作系统环境[chr(130)]
$python env.py
126
回溯(最近一次呼叫最后一次):
文件“env.py”,第4行,在
操作系统环境[chr(130)]=“130”
文件“/usr/lib/python2.7/os.py”,第473行,在__
putenv(关键,项目)
OSError:[Errno 14]地址错误
强制安装(
cpan-f Encode::Locale
),不要担心。如果您没有使用任何黑暗魔法,那么就不需要这些奇特的环境变量名


(不过,您仍然可以将环境变量值设置为几乎任何值。)

~/.cpan/build
中,它们将是名称以
Encode Local
开头的目录。走进其中一个,并键入
perl-Mblib t/env.t
$perl-Mblib t/env.t 1..13正常1-env read ok 2-env write retval old value ok 3-env write worked ok 4-env受影响的%env ok 5-env write retval old value ok 6-env write worked ok 7-env write unde deletes from%env ok 8-env write retval encoded ok 9-env write worked ok 10-env受影响的%ENV
与上面没有什么不同。希望我能投票两次。理解我们为什么要强迫别人做某事总是好的。