man MDN::API () - Perl interface to domain name conversion methods of libmdn
NAME
MDN::API - Perl interface to domain name conversion methods of libmdn
SYNOPSIS
use MDN::API;
$idn_domain_name = MDN::API->encode_name($local_domain_name); $local_domain_name = MDN::API->decode_name($idn_domain_name);
DESCRIPTION
CWMDN::API provides a Perl object interface to domain name conversion methods of libmdn, the multilingual domain name library included in the mDNkit.
This module provides high-level conversion interface to the library. It can encode or decode a domain name according with libmdn configuration (e.g. CW/usr/local/etc/mdn.conf).
CLASS METHODS
Although this module does not provide object interface, all the functions should be called as class methods, in order to be consistent with other modules in CWMDN::.
MDN::API->encode_name($domain_name); # OK MDN::API::encode_name($domain_name); # NGEncodes domain name of CW$from according with CW@actions, and returns the result. Each element in CW@actions is a string as follows:
'localconv' convert the local encoding string to UTF-8. 'delimmap' covnert local delimiters to periods ('.'). 'localmap' perfrom local mapping. 'nameprep' perform NAMEPREP (mapping, normalization, prohibit character check and unassigned codepoint check). 'idnconv' convert the UTF-8 string to ACE.
'encode_app' perform 'localconv', 'delimmap', 'localmap', 'nameprep' and 'idnconv'. This is the default value of @actions.Regardless of the order of elements in CW@actions, the actions are always performed in the following order; CW'localconv', CW'delimmap', CW'localmap', CW'nameprep' and CW'idnconv'. If an error occurs, this method returns CWundef. Decodes domain name of CW$from according with CW@actions, and returns the result. This is the reverse of CWencode_name. Each element in CW@actions is a string as follows:
'idnconv' convert the ACE string to UTF-8. 'nameprep' inspect if NAMEPREP has been performed to the string. If hasn't, convert the string to ACE. 'localconv' convert the UTF-8 string to the local encoding.
'decode_app' perform 'idnconv', 'nameprep' and 'localconv'. This is the default value of @actions.Regardless of the order of elements in CW@actions, those actions are always performed in the following order; CW'idnconv', CW'nameprep' and CW'localconv'. If an error occurs, this method returns CWundef.
- enable($on_off)
- Enable or disable mulitilingual domain name support provided by libmdn. If CW$on_off is zero, the support is disabled, otherwise enabled. If this method has not been called, the CWMDN_DISABLE environment variabe is used to determine whether mulitilingual domain name support is enabled. The support is disabled if that variable is defined, In disabled condition, conversion methods (e.g. CWencode_name() and CWdecode_name()) simply return a copy of input string as the result of conversion.
- lasterror()
- Returns the error message string corresponding to the last error occurred in this module.
- local_to_utf8($from)
- Is equivalent to CWencode_name($from, 'localconv').
- utf8_to_local($from)
- Is equivalent to CWdecode_name($from, 'localconv').
- delimiter_map($from)
- Is equivalent to CWencode_name($from, 'delimmap').
- local_map($from)
- Is equivalent to CWencode_name($from, 'localmap').
- nameprep($from)
- Is equivalent to CWencode_name($from, 'nameprep').
- nameprep_check($from)
- Is equivalent to CWdecode_name($from, 'nameprep').
- utf8_to_idn($from)
- Is equivalent to CWencode_name($from, 'idnconv').
- idn_to_utf8($from)
- Is equivalent to CWdecode_name($from, 'idnconv').
- local_to_idn($from)
- Is equivalent to CWencode_name($from).
- idn_to_local($from)
- Is equivalent to CWdecode_name($from).
COMPATIBILITY
Beginning with version 2.4, the action CW'nameprep' of CWencode_name() and CWdecode_name() also performs unassigned codepoint check. The CW'unascheck' action and the CWunassigned_check() method are no longer supported.
ISSUE OF HANDLING UNICODE CHARACTERS
See the ``ISSUE OF HANDLING UNICODE CHARACTERS'' section in MDN::UTF8.