Perl:未知字符名称\N {alpha} [英] Perl: Unknown charname \N{alpha}

查看:194
本文介绍了Perl:未知字符名称\N {alpha}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在AIX 7.2上从CPAN构建Encode 2.88-3。在make测试阶段,我收到有关未知字符的各种错误:

I am trying to build Encode 2.88-3 from CPAN on AIX 7.2. During the make test phase I receive various errors about unknown characters:

Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 499.
Unknown charname 'alpha' at t/Encode.t line 44, within string
BEGIN not safe after errors--compilation aborted at t/Encode.t line 148.
t/Encode.t ................. 
Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 459.
Unknown charname 'LATIN SMALL LETTER SHARP S' at t/encoding.t line 77, within string
BEGIN not safe after errors--compilation aborted at t/encoding.t line 165.
t/encoding.t ............... 

Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 459.
Unknown charname 'POUND SIGN' at t/mime-header.t line 166, within string
Execution of t/mime-header.t aborted due to compilation errors.
# Looks like your test exited with 2 just after 1.
t/mime-header.t ............ 

要测试这是AIX问题还是Encode-Testcase问题,我尝试在linux系统上构建相同版本(Ubuntu 14.04),

To test whether this is an AIX problem or a problem with the Encode-Testcase, I tried to build the same version on my linux system (Ubuntu 14.04), where Encode installs just fine.

选择第一个错误:

is "\N{alpha}",substr($uni,0,1),"alpha does not map to symbol 'a'";

似乎AIX perl无法找到\N {alpha}字符。我在这里有点迷惑-perl通常会在哪里搜索这样的字符?

It seems AIX perl is unable to find the \N{alpha} character. I am a bit lost here - where does perl usually search for characters like this?

我需要提示我必须寻找该问题的方向。有人可以提供一些调试提示吗?

I need a hint into the direction I have to search for with this problem. Can someone provide some debugging tips?

perl -V
Summary of my perl5 (revision 5 version 20 subversion 1) configuration:

  Platform:
    osname=aix, osvers=6.1.0.0, archname=aix-thread-multi
    uname='aix blade08 1 6 00003c3ad100 '
    config_args='-d -Dprefix=/usr/opt/perl5 -Dcc=xlc_r -Duseshrplib -Dusethreads'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='xlc_r -q32', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias -qlanglvl=extc99 -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -q32 -D_LARGE_FILES',
    optimize='-O',
    cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias -qlanglvl=extc99 -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT'
    ccversion='12.1.0.9', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -brtl -bdynamic -b32'
    libpth=/lib /usr/lib /usr/ccs/lib
    libs=-lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lpthreads -lc
    perllibs=-lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc
    libc=, so=a, useshrplib=true, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -bE:/usr/opt/perl5/lib/5.20.1/aix-thread-multi/CORE/perl.exp'
    cccdlflags=' ', lddlflags='-bhalt:4 -G -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -bnoentry -lpthreads -lc -lm'


Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        USE_ITHREADS USE_LARGE_FILES USE_LOCALE
                        USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
                        USE_REENTRANT_API
  Built under aix
  Compiled at Feb  6 2015 14:54:29
  %ENV:
    PERL5LIB="/home/perl_ss/perl5/lib/perl5/aix-thread-multi:/home/perl_ss/perl5/lib/perl5:/usr/local/lib/site_perl/5.8.8:/usr/local/site_perl/common"
    PERL5OPT=""
    PERL5_CPANPLUS_IS_RUNNING="9961732"
    PERL5_CPAN_IS_RUNNING="9961732"
    PERL_LOCAL_LIB_ROOT="/home/perl_ss/perl5"
    PERL_MB_OPT="--install_base /home/perl_ss/perl5"
    PERL_MM_OPT="INSTALL_BASE=/home/perl_ss/perl5"
  @INC:
    /home/perl_ss/perl5/lib/perl5/aix-thread-multi
    /home/perl_ss/perl5/lib/perl5/aix-thread-multi
    /home/perl_ss/perl5/lib/perl5
    /usr/local/lib/site_perl/5.8.8/aix-thread-multi
    /usr/local/lib/site_perl/5.8.8
    /usr/local/site_perl/common
    /usr/opt/perl5/lib/site_perl/5.20.1/aix-thread-multi
    /usr/opt/perl5/lib/site_perl/5.20.1
    /usr/opt/perl5/lib/5.20.1/aix-thread-multi
    /usr/opt/perl5/lib/5.20.1
    /usr/opt/perl5/lib/site_perl/5.8.8
    /usr/opt/perl5/lib/site_perl

更新:
对问题的进一步检查使我得出这样的结论:与编码无关。我启动了调试器并执行了一些测试。注意如何在Linux上找到字符\N {greek:alpha},但在AIX上找不到:
AIX 7.2:

UPDATE: Further inspection of the problem leads me to the conclusion that this may not be related to encode. I fired up my Debugger and performed some tests. Notice how the Character \N{greek:alpha} was found on Linux, but not on AIX: AIX 7.2:

 DB<1> use charnames qw(greek)

  DB<2> print "\N{alpha}"
Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 459.
 [...]
Unknown charname 'alpha' at (eval 9)[/usr/opt/perl5/lib/5.20.1/perl5db.pl:732] line 2, within string

  DB<3> print "\N{U+03B1}"
Wide character in print at (eval 10)[/usr/opt/perl5/lib/5.20.1/perl5db.pl:732] line 2.
 [...]

  DB<4> print "\N{greek:alpha}"  
Use of uninitialized value $txt in pattern match (m//) at /usr/opt/perl5/lib/5.20.1/_charnames.pm line 459.
 [...]
Unknown charname 'greek:alpha' at (eval 11)[/usr/opt/perl5/lib/5.20.1/perl5db.pl:732] line 2, within string

Ubuntu 14.04

Ubuntu 14.04

DB<1> use charnames qw(greek)

 DB<2> print "\N{alpha}"
 Unknown charname 'alpha' at (eval 8)[/usr/share/perl/5.18/perl5db.pl:732] line 2, within string

 DB<3> print "\N{U+03B1}"
 Wide character in print at (eval 9)[/usr/share/perl/5.18/perl5db.pl:732] line 2.


 DB<4> print "\N{greek:alpha}"
 Wide character in print at (eval 10)[/usr/share/perl/5.18/perl5db.pl:732] line 2.

猜猜AIX字符表有什么问题吗?

Guess there is something messed up with the AIX character-table?

更新2:
我开始讲究这一点。

UPDATE 2: I am starting to get to the bottom of this.

AIX中缺少Name.pl: p>

Name.pl is missing in AIX:

perl@t72:/usr/opt/perl5/lib/5.20.1/unicore $ ls
Blocks.txt          Decomposition.pl    Name.pm             SpecialCasing.txt   UCD.pl
CombiningClass.pl   Heavy.pl            NamedSequences.txt  To                  lib

与Linux相反:

perl@pod-racer:/usr/share/perl/5.18/unicore $ ls
Blocks.txt         Decomposition.pl  lib                 Name.pl  SpecialCasing.txt  UCD.pl
CombiningClass.pl  Heavy.pl          NamedSequences.txt  Name.pm  To                 version


推荐答案

我想把它冲出来。由于任何原因在AIX 7.2中缺少 unicore / Name.pl ,因此出现了AIX错误。

I figured it out. The errors on AIX came up because unicore/Name.pl was missing in AIX 7.2 for whatever reason.

Name.pl是在perl编译期间生成的,在AIX系统上找不到必需的程序 mktables ,因为我似乎没有打包好的perl来交付它。

As Name.pl is generated during the compilation of perl, the necessary program mktables was not to be found on the AIX System, as I does not seem to be delivered with a packaged perl.

解决方案:
将从CPAN安装的perl版本下载到临时目录中。在AIX 7.2上,我有perl 5.20,因此我从cpan下载了perl 5.20( http://www.cpan.org / src / )。

将其解压缩,然后将cd压缩为 lib / unicore 。在那里您可以找到mktables程序。
然后生成unicode文件:

Extract it, and cd to lib/unicore. There you can find the mktables program. Then generate the unicode files:

chmod 755 mktables
./mktables

这会生成一堆文件,包括Name.pl。我将所有新生成的文件与系统perl中的文件进行了比较,发现没有什么不同,因此我仅将Name.pl复制到了系统unicore-path。错误消失了。

This generates a bunch of files, including Name.pl. I diffed all newly generated files against the ones from my systems perl and found no difference, so I only copied Name.pl to my systems unicore-path. The Errors then vanished.

这篇关于Perl:未知字符名称\N {alpha}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆