Zonemaster::Engine::Normalization(3pm)

NAME
Zonemaster::Engine::Normalization - utility functions for names normalization

SYNOPSIS
    use Zonemaster::Engine::Normalization;

    my ($errors, $final_domain) = normalize_name($domain);

EXPORTED FUNCTIONS

normalize_label($label)
    Normalize a single label from a domain name.

    If the label is ASCII only, it is down cased, else it is converted according to IDNA2008.

    Downcasing of upper case non-ASCII characters, normalization to the Unicode NFC format and conversion from U-label to A-label is performed by libidn2 using "to_idn($name, ...)" in Zonemaster::LDNS.

    Returns a tuple "($errors: ArrayRef[Zonemaster::Engine::Normalization::Error], $alabel: String)".

    In case of errors, the returned label will be undefined. If the method succeeded an empty error array is returned.

trim_space($str)
    Trim leading and trailing whitespace.

    Implements the space trimming part of normalization document <https://github.com/zonemaster/zonemaster/blob/master/docs/specifications/tests/RequirementsAndNormalizationOfDomainNames.md>.

    Returns a string.

normalize_name($name)
    Normalize a domain name.

    Implements the normalization process, except the space trimming part, described in normalization document <https://github.com/zonemaster/zonemaster/blob/master/docs/specifications/tests/RequirementsAndNormalizationOfDomainNames.md>.

    Returns a tuple "($errors: ArrayRef[Zonemaster::Engine::Normalization::Error], $name: String)".

    In case of errors, the returned name will be undefined. If the method succeeded an empty error array is returned.