.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Zonemaster::DNSName 3pm" .TH Zonemaster::DNSName 3pm "2022-06-28" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Zonemaster::DNSName \- class representing DNS names .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& my $name1 = Zonemaster::Name\->new(\*(Aqwww.example.org\*(Aq); \& my $name2 = Zonemaster::Name\->new(\*(Aqns.example.org\*(Aq); \& say "Yay!" if $name1\->common($name2) == 2; .Ve .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .IP "labels" 4 .IX Item "labels" A reference to a list of strings, being the labels the \s-1DNS\s0 name is made up from. .SH "METHODS" .IX Header "METHODS" .IP "new($input) _or_ new({ labels => \e@labellist})" 4 .IX Item "new($input) _or_ new({ labels => @labellist})" The constructor can be called with either a single argument or with a reference to a hash as in the example above. .Sp If there is a single argument, it must be either a non-reference, a Zonemaster::DNSName object or a Zonemaster::Zone object. .Sp If it's a non-reference, it will be split at period characters (possibly after stringification) and the resulting list used as the name's labels. .Sp If it's a Zonemaster::DNSName object it will simply be returned. .Sp If it's a Zonemaster::Zone object, the value of its \f(CW\*(C`name\*(C'\fR attribute will be returned. .IP "\fBstring()\fR" 4 .IX Item "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. .Sp The stringification operator is overloaded to this function, so it should rarely be necessary to call it directly. .IP "\fBfqdn()\fR" 4 .IX Item "fqdn()" Returns the name as a string complete with a trailing dot. .IP "str_cmp($other)" 4 .IX Item "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. .IP "\fBnext_higher()\fR" 4 .IX Item "next_higher()" Returns a new Zonemaster::DNSName object, representing the name of the called one with the leftmost label removed. .IP "common($other)" 4 .IX Item "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 \s-1DNS\s0 tree. .IP "prepend($label)" 4 .IX Item "prepend($label)" Returns a new Zonemaster::DNSName object, representing the called one with the given label prepended. .IP "\s-1TO_JSON\s0" 4 .IX Item "TO_JSON" Helper method for \s-1JSON\s0 encoding.