|<B>new($unicode_version, B>$mapping_tables<B>, B>$unicode_normalization<B>, B>$prohibited_tables<B>, B>$bidi_check<B>, B>$unassigned_check<B>)B>||
Creates a blessed function reference that implements a stringprep profile.
This function takes the following parameters:
The function returned can be called with a single parameter, the string to be prepared, and returns the prepared string. It will die if the input string cannot be successfully prepared because it would contain invalid output (so use eval if necessary).
For performance reasons, it is strongly recommended to call the new function as few times as possible, i. e. exactly once per stringprep profile. It might also be better not to use this module directly but to use (or write) a module implementing a profile, such as Authen::SASL::SASLprep.
You can easily implement a stringprep profile without subclassing:
package ACME::ExamplePrep; use Unicode::Stringprep; use Unicode::Stringprep::Mapping; use Unicode::Stringprep::Prohibited; *exampleprep = Unicode::Stringprep->new( 3.2, [ \@Unicode::Stringprep::Mapping::B1, ], , [ \@Unicode::Stringprep::Prohibited::C12, \@Unicode::Stringprep::Prohibited::C22, ], 1, );
This binds ACME::ExamplePrep::exampleprep to the function created by Unicode::Stringprep->new.
Usually, it is not necessary to subclass this module. Sublassing this module is not recommended.
The following modules contain the data tables from RFC 3454. These modules are automatically loaded when loading Unicode::Stringprep.
@Unicode::Stringprep::Unassigned::A1 # Appendix A.1
o Unicode::Stringprep::Mapping o Unicode::Stringprep::Prohibited
@Unicode::Stringprep::Prohibited::C11 # Appendix C.1.1 @Unicode::Stringprep::Prohibited::C12 # Appendix C.1.2 @Unicode::Stringprep::Prohibited::C21 # Appendix C.2.1 @Unicode::Stringprep::Prohibited::C22 # Appendix C.2.2 @Unicode::Stringprep::Prohibited::C3 # Appendix C.3 @Unicode::Stringprep::Prohibited::C4 # Appendix C.4 @Unicode::Stringprep::Prohibited::C5 # Appendix C.5 @Unicode::Stringprep::Prohibited::C6 # Appendix C.6 @Unicode::Stringprep::Prohibited::C7 # Appendix C.7 @Unicode::Stringprep::Prohibited::C8 # Appendix C.8 @Unicode::Stringprep::Prohibited::C9 # Appendix C.9
In Unicode 3.2 to 4.0.1, the specification of UAX #15: Unicode Normalization Forms for forms NFC and NFKC is not logically self-consistent. This has been fixed in Corrigendum #5 (<http://unicode.org/versions/corrigendum5.html>).
Unfortunately, this yields two ways to implement NFC and NFKC in Unicode 3.2, on which the Stringprep standard is based: one based on a literal interpretation of the original specification and one based on the corrected specification. The output of these implementations differs for a small class of strings, all of which cant appear in meaningful text. See UAX #15, section 19 <http://unicode.org/reports/tr15/#Stability_Prior_to_Unicode41> for details.
This module will check for these strings and, if normalization is done, prohibit them in output as it is not possible to interoperate under these circumstandes.
Please note that due to this, the normalization step may cause the preparation to fail. That is, the preparation function may die even if there are no prohibited characters and no checks for bidi sequences and unassigned characters, which may be surprising.
Claus Faerber <CFAERBER@cpan.org>
Copyright 2007-2009 Claus Faerber.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Unicode::Normalize, RFC 3454 (<http://www.ietf.org/rfc/rfc3454.txt>)
|perl v5.20.3||UNICODE::STRINGPREP (3)||2014-09-03|