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

NAME

Unicode::Precis::Preparation~[ja] - RFC 7564 PRECISフレームワーク - 準備

SYNOPSIS

  use Unicode::Precis::Preparation qw(prepare IdentifierClass);
  $result = prepare($string, IdentifierClass);
  %result = prepare($string, IdentifierClass);

DESCRIPTION

Unicode::Precis::Preparationは、PRECIS フレームワークに従ってユニコード文字列またはUTF-8のバイト文字列の準備を行う。

なお当ドキュメントでは、「UTF-8」という語を本来の意味で用いる。

Function

prepare ( $string, [ $stringclass ], [ UnicodeVersion => $version ] )

文字列が指定した文字列クラスに適合するか検査する。

Parameters:

$string

検査する文字列。ユニコード文字列かバイト文字列。

バイト文字列は、ユニコードへアップグレードされることなく UTF-8列として扱われることに注意。

$stringclass

ValidUTF8 (初期値)、FreeFormClass (RFC 7564参照)、IdentifierClass (同) のいずれか。

UnicodeVersion => $version

ユニコードの版を与えると、それに従ってレパートリを制限する。 初期状態では、当モジュールを使うPerl が対応しているユニコードの版のレパートリが使われる。

Returns:

スカラコンテキストでは、 指定した文字列クラスに適合すれば真値。そうでなければ偽値。

配列コンテキストでは、 次のキーを持つ対によるリストで結果の詳細を返す。

result

"Constants"で述べる特性値のいずれか。

offset

検査が失敗したときは、文字列の先頭からのオフセット。 成功したときは、文字列の長さ。

オフセットや長さは、 バイト文字列ではバイト数、ユニコード文字列では文字数で数える。

length

検査が失敗したときの、認められない文字の長さ。 長さは、バイト文字列では1から4、ユニコード文字列では常に1、 不正な列では未定義となる。

ord

lengthがある場合、文字のユニコードスカラ値。

Constants

FreeFormClass
IdentifierClass
ValidUTF8

文字列クラス。ValidUTF8は当モジュールによる拡張である。

UNASSIGNED
PVALID
CONTEXTJ
CONTEXTO
DISALLOWED

結果を示す特性値。PVALIDは成功を意味する。

Exports

初期状態ではなにもエクスポートしない。 :all タグで prepare()および定数をエクスポートする。

RESTRICTIONS

prepare()はEBCDICプラットフォームでのユニコード文字列を検査できない。

SEE ALSO

Unicode::Precis - coming late.

RFC 7564 PRECIS Framework: Preparation, Enforcement, and Comparison of Internationalized Strings in Application Protocols. https://tools.ietf.org/html/rfc7564.

AUTHOR

Hatuka*nezumi - IKEDA Soji, <hatuka@nezumi.nu>

COPYRIGHT AND LICENSE

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.