Unicode::EastAsianWidth - East Asian Width properties
This document describes version 1.10 of Unicode::EastAsianWidth, released October 14, 2007.
use Unicode::EastAsianWidth; $_ = chr(0x2010); # HYPHEN, an ambiguous-width character /\p{InEastAsianAmbiguous}/; # True /\p{InFullwidth}/; # False { local $Unicode::EastAsianWidth::EastAsian = 1; /\p{InFullwidth}/; # True (this only works on Perl 5.8+) }
This module provide user-defined Unicode properties that deal with East Asian characters' width status, as specified in http://www.unicode.org/unicode/reports/tr11/.
It exports the following functions to the caller's scope, to be used by Perl's Unicode matching system: InEastAsianFullwidth, InEastAsianHalfwidth, InEastAsianAmbiguous, InEastAsianNarrow InEastAsianWide, InEastAsianNeutral.
InEastAsianFullwidth
InEastAsianHalfwidth
InEastAsianAmbiguous
InEastAsianNarrow
InEastAsianWide
InEastAsianNeutral
In accord to TR11 cited above, two additional context-sensitive properties are exported: InFullwidth (union of Fullwidth and Wide) and InHalfwidth (union of Halfwidth, Narrow and Neutral).
InFullwidth
Fullwidth
Wide
InHalfwidth
Halfwidth
Narrow
Neutral
Ambiguous characters are treated by default as part of InHalfwidth, but you can modify this behaviour by assigning a true value to $Unicode::EastAsianWidth::EastAsian.
$Unicode::EastAsianWidth::EastAsian
Setting $Unicode::EastAsianWidth::EastAsian at run-time only works on Perl version 5.8 or above. Perl 5.6 users must use a BEGIN block to set it before the use statement:
use
BEGIN { $Unicode::EastAsianWidth::EastAsian = 1 } use Unicode::EastAsianWidth;
perlunicode, http://www.unicode.org/unicode/reports/tr11/
Audrey Tang <cpan@audreyt.org>
Copyright 2002, 2003, 2007, 2008 by Audrey Tang <cpan@audreyt.org>.
This software is released under the MIT license cited below.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
To install Unicode::EastAsianWidth, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Unicode::EastAsianWidth
CPAN shell
perl -MCPAN -e shell install Unicode::EastAsianWidth
For more information on module installation, please visit the detailed CPAN module installation guide.