Unicode::Precis::Preparation - RFC 7564 PRECIS Framework - Preparation
use Unicode::Precis::Preparation qw(prepare IdentifierClass); $result = prepare($string, IdentifierClass); %result = prepare($string, IdentifierClass);
Unicode::Precis::Preparation prepares Unicode string or UTF-8 bytestring according to PRECIS framework.
Note that the word "UTF-8" in this document is used in its proper meaning.
Check if a string conforms to specified string class.
Parameters:
A string to be checked, Unicode string or bytestring.
Note that bytestring won't be upgraded to Unicode string but will be treated as UTF-8 sequence.
One of the constants ValidUTF8 (default), IdentifierClass (see RFC 7564) or FreeFormClass (ditto).
ValidUTF8
IdentifierClass
FreeFormClass
If a version of Unicode is given, repertoire is restricted according to it. By default, repertoire of Unicode version supported by Perl using this module is available.
Returns:
In scalar context: True value if the string conforms to specified string class. Otherwise false value.
In array context: A list of pairs describing detail of result with these keys:
result
One of property values described in "Constants".
offset
If the check fails, offset from beginning of string. If succeeds, length of string.
Offset or length is based on byte for bytestring, and based on character for Unicode string.
length
When the check fails, length of disallowed character. Length is 1 to 4 for bytestring, always 1 for Unicode string and undefined for invalid sequence.
1
4
ord
Unicode scalar value of character, when length item is set.
String classes. ValidUTF8 is the extension by this module.
Property values to represent results. PVALID means successful result.
PVALID
None are exported by default. prepare() and constants may be exported by :all tag.
:all
prepare() can not check Unicode string on EBCDIC platforms.
Unicode::Precis - coming late.
RFC 7564 PRECIS Framework: Preparation, Enforcement, and Comparison of Internationalized Strings in Application Protocols. https://tools.ietf.org/html/rfc7564.
Hatuka*nezumi - IKEDA Soji, <hatuka@nezumi.nu>
Copyright (C) 2015 by 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::Preparation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Unicode::Precis::Preparation
CPAN shell
perl -MCPAN -e shell install Unicode::Precis::Preparation
For more information on module installation, please visit the detailed CPAN module installation guide.