Unicode::Precis - RFC 7564 PRECIS Framework - Enforcement and Comparison
use Unicode::Precis; $precis = Unicode::Precis->new(options...); $string = $precis->enforce($input); $equals = $precis->compare($inputA, $inputB);
Unicode::Precis performs enforcement and comparison of UTF-8 bytestring or Unicode string according to PRECIS Framework.
Note that bytestring will not be upgraded but treated as UTF-8 sequence by this module.
Constructor. Creates new instance of Unicode::Precis class. Following options may be specified.
If specified, maps fullwidth and halfwidth characters to their decomposition mappings using decomposeWidth().
If specified, maps spaces. options... may include any of following words:
MapSpace
Maps non-ASCII space characters to ASCII space using mapSpace().
StripSpace
Removes ASCII space character(s) at the beginning and/or ending of the string.
UnifySpace
Maps sequences of more than one ASCII space character to a single ASCII space character.
If specified, maps uppercase and titlecase characters to lowercase using foldCase().
If specified, normalizes string using given normalization form.
If specifiled and the string contains right-to-left character, checks string against BiDi Rule.
If specified, checks string according to given string class.
If specified, replaces and/or checks string with the result of subroutine referred by $subref.
Instance method. Compares strings. If enforcement on both strings succeeds, compares them using compareExactly() and returns 1 or 0. Otherwise returns undef.
1
0
undef
Arguments $stringA and $stringB are not modified.
Instance method. Performs enforcement on the string. If processing succeeded, modifys argument $string and returns it. Otherwise returns undef.
None are exported.
The repertoire this module can handle is restricted by Unicode database of Perl core: Characters beyond it are considered to be "unassigned" and are disallowed, even if they are available by recent version of Unicode. Table below lists implemented Unicode version by each Perl version.
Perl's version Implemented Unicode version ------------------ --------------------------- 5.8.7, 5.8.8 4.1.0 5.10.0 5.0.0 5.8.9, 5.10.1 5.1.0 5.12.x 5.2.0 5.14.x 6.0.0 5.16.x 6.1.0 5.18.x 6.2.0 5.20.x 6.3.0
This module can not handle Unicode string on EBCDIC platforms.
RFC 7564 PRECIS Framework: Preparation, Enforcement, and Comparison of Internationalized Strings in Application Protocols. https://tools.ietf.org/html/rfc7564.
Unicode::BiDiRule, Unicode::Normalize, Unicode::Precis::Preparation, Unicode::Precis::Utils.
Hatuka*nezumi - IKEDA Soji, <hatuka@nezumi.nu>
(C) 2015, 2016 Hatuka*nezumi - IKEDA Soji
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. For more details, see the full text of the licenses at <http://dev.perl.org/licenses/>.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
To install Unicode::Precis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Unicode::Precis
CPAN shell
perl -MCPAN -e shell install Unicode::Precis
For more information on module installation, please visit the detailed CPAN module installation guide.