man MDN::ResConf () - Perl interface to domain name conversion methods of libmdn

NAME

MDN::ResConf - Perl interface to domain name conversion methods of libmdn

SYNOPSIS

  use MDN::ResConf;
  $res = MDN::ResConf->new();
  $res->load_file('/usr/local/etc/mdn.conf');

  $idn_domain_name = $res->local_to_idn($local_domain_name);
  $local_domain_name = $res->idn_to_local($idn_domain_name);

DESCRIPTION

CWMDN::ResConf provides a Perl object interface to domain name conversion methods of libmdn, the multilingual domain name library included in the mDNkit.

This module provides low-level conversion interface to the library.

CONSTRUCTOR

new
Creates an object. It returns CWundef if no enough memory is remained.

METHODS

load_file([$filename])
Loads a configuration file. If CW$filename is omitted, the default file (e.g. /usr/local/etc/mdn.conf) is loaded. Sets local encoding. If no encoding name is specified, the library determines it using locale information. The library currently understands two options, CW'delayedopen' and CW'rtcheck'. CW'delayedopen' delays opening the internal iconv converter until the conversion is actually performed. CW'rtcheck' enables round trip check, which is to ensure that the conversion is correctly performed. The method returns 1 upon success, CWundef otherwise. Sets IDN encoding name (e.g. CW'AMC-ACE-Z'). The meaning of CW@options is the same as that of CWset_local_encoding. This method corresponds with CWidn-encoding entry in libmdn configuration file. It returns 1 upon success, CWundef otherwise.
set_nameprep_version($version)
Sets NAMEPREP version (e.g. CW'nameprep-07'). This method corresponds with CWnameprep entry in libmdn configuration file. It returns 1 upon success, CWundef otherwise.
add_delimiter_map(@ucs)
Recoginzes specified UCS code points (e.g. CW0x3002) as domain name delimiter. This method corresponds with CWdelimiter-map entry in libmdn configuration file. It returns 1 upon success, CWundef otherwise. Add elements in CW@names (e.g. CW'filemap:/some/where') to a list of local mapping schemes for the top level domain CW$tld (e.g. CW'jp'). This method corresponds with CWlocal-map entry in libmdn configuration file. It returns 1 upon success, CWundef otherwise.
add_nameprep_map(@names)
Add elements in CW@names (e.g. CW'nameprep-07') to a list of NAMEPREP mapping schemes. This method corresponds with CWnameprep-map entry in libmdn configuration file. It returns 1 upon success, CWundef otherwise.
add_nameprep_normalize(@names)
Add elements in CW@names (e.g. CW'unicode-form-kc') to a list of NAMEPREP normalization schemes. This method corresponds with CWnameprep-normalize entry in libmdn configuration file. It returns 1 upon success, CWundef otherwise.
add_nameprep_prohibit(@names)
Add elements in CW@names (e.g. CW'fileset:/some/where') to a list of NAMEPREP prohibited-character check schemes. This method corresponds with CWnameprep-prohibit entry in libmdn configuration file. It returns 1 upon success, CWundef otherwise.
add_nameprep_unassigned(@names)
Add elements in CW@names (e.g. CW'nameprep-07') to a list of NAMEPREP unassigned-codepoint check schemes. This method corresponds with CWnameprep-unassigned entry in libmdn configuration file. It returns 1 upon success, CWundef otherwise.
unset_local_encoding()
Unsets local encoding name, set by CWset_local_encoding method.
unset_idn_encoding()
Unsets IDN encoding name, set by CWset_idn_encoding method or CWidn-encoding entry in the loaded configuration file.
unset_nameprep_version()
Unsets NAMEPREP version, set by CWset_nameprep_version method or CWnameprep entry in the loaded configuration file. This methods unsets all of the NAMEPREP mapping, normalization, prohibited-character check and unassigned-codepoint check schemes, registered in the object. Therefore,
    $res->unset_nameprep_version();
is equivalent to the following codes:
    $res->unset_nameprep_map();
    $res->unset_nameprep_normalize();
    $res->unset_nameprep_prohibit();
    $res->unset_nameprep_unassigned();
unset_delimiter_map()
Unset delimiters, registered by CWadd_delimiter_map method or CWdelimiter-map entries in the loaded configuration file.
unset_local_map()
Unsets local mapping schemes, registered by CWadd_local_map method or CWlocal-map entries in the loaded configuration file.
unset_nameprep_map()
Unsets NAMEPREP mapping schemes, registered by CWadd_nameprep_map method or CWnameprep-map entries in the loaded configuration file.
unset_nameprep_normalize()
Unsets NAMEPREP normalization schemes, registered by CWadd_nameprep_normalize method or CWnameprep-normalize entries in the loaded configuration file.
unset_nameprep_prohibit()
Unsets NAMEPREP prohibited-codepoint check schemes, registered by CWadd_nameprep_prohibit method or CWnameprep-prohibit entries in the loaded configuration file.
unset_nameprep_unassigned()
Unsets NAMEPREP unassigned-codepoint check schemes, set by CWadd_nameprep_unassigned method or CWnameprep-unassigned entries in the loaded configuration file. Converts a domain name CW$from according with CW$instructions, and returns the result. Similer to CWpack and CWunpack, CW$instructions is a sequence of characters listed below:
    l       convert the local encoding to UTF-8.
    L       convert the UTF-8 to the local encoding.
    d       covnert local delimiters to periods ('.').
    M       perfrom local mapping.
    m       perform the NAMEPREP mapping.
    n       perform NAMEPREP normalization.
    p       check whether the string contains NAMEPREP prohibited
            character.
    u       check whether the string contains NAMEPREP unassigned
            codepoint.
    N       perform NAMEPREP (equivalent to 'mnpu').
    I       convert the UTF-8 string to ACE.
    i       convert the ACE string to UTF-8.
    !m      inspect if NAMEPREP mapping has been performed to the
            string.  If hasn't, convert the string to ACE.
    !n      inspect if NAMEPREP normalizaion has been performed
            to the string.  If hasn't, convert the string to ACE.
    !p      search the string for NAMEPREP prohibited character.
            If found, convert the string to ACE.
    !u      search the string for NAMEPREP unassigned codepoint.
            If found, convert the string to ACE.
    !N      inspect if NAMEPREP has been performed to the string.
            If hasn't, convert the string to ACE. (equivalent to
            `!m!n!p!u').
The characters in CW$instructions are applied left to right.
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. CWnameconv()) simply return a copy of input string as the result of conversion.
local_to_utf8($from)
Is equivalent to CWnameconv('l', $from).
utf8_to_local($from)
Is equivalent to CWnameconv('L', $from).
delimiter_map($from)
Is equivalent to CWnameconv('d', $from).
local_map($from)
Is equivalent to CWnameconv('M', $from).
map($from)
Is equivalent to CWnameconv('m', $from).
normalize($from)
Is equivalent to CWnameconv('n', $from).
prohibit_check($from)
Is equivalent to CWnameconv('p', $from).
unassigned_check($from)
Is equivalent to CWnameconv('u', $from).
nameprep($from)
Is equivalent to CWnameconv('N', $from).
nameprep_check($from)
Is equivalent to CWnameconv('!N', $from).
utf8_to_idn($from)
Is equivalent to CWnameconv('I', $from).
idn_to_utf8($from)
Is equivalent to CWnameconv('i', $from).
local_to_idn($from)
Is equivalent to CWnameconv('ldMNI', $from).
idn_to_local($from)
Is equivalent to CWnameconv('i!NL', $from).

CLASS METHOD

lasterror()
Returns the error message string corresponding to the last error occurred in this module.

COMPATIBILITY

Beginning with version 2.4, the instructions CW'N' and CW'!N' of the CWnameconv() method also perform unassigned codepoint check.

ISSUE OF HANDLING UNICODE CHARACTERS

See the ``ISSUE OF HANDLING UNICODE CHARACTERS'' section in MDN::UTF8.

SEE ALSO

mdn.conf(5), MDN::API, MDN::UTF8

MDN library specification