Zonemaster::Engine::Util(3p)

NAME
Zonemaster::Engine::Util - utility functions for other Zonemaster modules

SYNOPSIS
    use Zonemaster::Engine::Util;
    info(TAG => { some => 'argument'});
    my $ns = ns($name, $address);
    my $name = name('whatever.example.org');

EXPORTED FUNCTIONS

info($tag, $href)
    Creates and returns a Zonemaster::Engine::Logger::Entry object. The object is also added to the global logger object's list of entries.

ns($name, $address)
    Creates and returns a nameserver object with the given name and address.

name($string_name_or_zone)
    Creates and returns a Zonemaster::Engine::DNSName object for the given argument.

zone($name)
    Returns a Zonemaster::Engine::Zone object for the given name.

parse_hints($string)
    Parses a string in the root hints format into the format expected by Zonemaster::Engine::Resolver->add_fake_addresses().

    Returns a hashref with domain names as keys and arrayrefs to IP addresses as values.

    Throws an exception if the inputs is not valid root hints text.

    A root hints file is a valid RFC 1035 zone file of the same type IANA publishes to be used as hint file for name servers <https://www.internic.net/domain/named.root>.

    In addition to being valid zone file the following restrictions are imposed on the root hints format:

    •   The file must not contain any $TTL, $ORIGIN, $INCLUDE or $GENERATE directives.

    •   The class field of all records must be "IN" or absent. If class is absent, IN is assumed.

    •   The TTL field may be absent or present. The TTL value is ignored.

    •   The RR type of all DNS records must be NS, A or AAAA.

    •   The file must contain at least one NS record.

    •   The owner name of all NS records must be ".".

    •   For every NS record there must be at least one address record (A or AAAA) whose owner name is identical to the domain name in the RDATA of the NS record.

    •   All address records (A or AAAA) must have an owner name that is identical to the domain name in the RDATA of some NS record in the zone.

serial_gt($serial_a, $serial_b) Checks if serial_a is greater than serial_b, according to serial number arithmetic as defined in RFC1982, section 3.2.
    Return a boolean.

scramble_case
    This routine provides a special effect: sCraMBliNg tHe CaSe

should_run_test
    Check if a test is blacklisted and should run or not.

ipversion_ok
    Check if IP version operations are permitted. Tests are done against Zonemaster::Engine::Profile->effective content.

escape_unprintable
    Replaces all non-ASCII characters and control characters in a byte string with decimal escape codes. The resulting string only contains printable ASCII characters, which makes it safer for display on a terminal or for storage in a database.

    For example, "hello \x1B[34mworld!\x1B[0m\\\xFF" is turned into 'hello \027[34mworld!\027[0m\\\255'.

    Do not use this function on character strings, or it might produce invalid results. Only use it on byte strings, e.g. UTF-8 encoded text returned by calling Encode::encode() on a character string, or raw data received from Zonemaster-LDNS.

    Space (ASCII 0x20) characters are left as they are, but all other ASCII whitespace characters, i.e. HORIZONTAL TAB (ASCII 0x09), LINE FEED (ASCII 0x0A), VERTICAL TAB (ASCII 0x0B), FORM FEED (ASCII 0x0C) and CARRIAGE RETURN (ASCII 0x0D) will be replaced by their equivalent decimal escapes.

    Beware that the resulting string might still contain sequences of characters that can be dangerous in other contexts, requiring further escaping. For example, if the string is meant to be displayed on an HTML GUI, the result must have angle brackets and ampersand characters escaped in a second pass.

test_levels
    WIP, here to please Pod::Coverage.