The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Unicode::EastAsianWidth - East Asian Width properties

VERSION

This document describes version 1.10 of Unicode::EastAsianWidth, released October 14, 2007.

SYNOPSIS

    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+)
    }

DESCRIPTION

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.

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).

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.

CAVEATS

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:

    BEGIN { $Unicode::EastAsianWidth::EastAsian = 1 }
    use Unicode::EastAsianWidth;

SEE ALSO

perlunicode, http://www.unicode.org/unicode/reports/tr11/

AUTHORS

Audrey Tang <cpan@audreyt.org>

COPYRIGHT

Copyright 2002, 2003, 2007 by Audrey Tang <cpan@audreyt.org>.

This software is released under the MIT license cited below.

The "MIT" License

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.