NAME

Zonemaster::DNSName - class representing DNS names

SYNOPSIS

my $name1 = Zonemaster::Name->new('www.example.org');
my $name2 = Zonemaster::Name->new('ns.example.org');
say "Yay!" if $name1->common($name2) == 2;

ATTRIBUTES

labels

A reference to a list of strings, being the labels the DNS name is made up from.

METHODS

new($string) _or_ new({ labels => \@labellist})

The constructor can be called with either a single non-reference argument, which will be split at dot characters to create the label list, or with a reference to a hash as in the example above.

string()

Returns a string representation of the name. The string representation is created by joining the labels with dots. If there are no labels, a single dot is returned. The names created this way do not have a trailing dot.

The stringification operator is overloaded to this function, so it should rarely be necessary to call it directly.

str_cmp($other)

Overloads string comparison. Comparison is made after converting the names to upper case, and ignores any trailing dot on the other name.

next_higher()

Returns a new Zonemaster::DNSName object, representing the name of the called one with the leftmost label removed.

common($other)

Returns the number of labels from the rightmost going left that are the same in both names. Used by the recursor to check for redirections going up the DNS tree.

prepend($label)

Returns a new Zonemaster::DNSName object, representing the called one with the given label prepended.

TO_JSON

Helper method for JSON encoding.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 121:

=over without closing =back

Around line 156:

=over is the last thing in the document?!