Zonemaster::Engine::DNSName - class representing DNS names
my $name1 = Zonemaster::Name->new('www.example.org'); my $name2 = Zonemaster::Name->new('ns.example.org'); say "Yay!" if $name1->common($name2) == 2;
A reference to a list of strings, being the labels the DNS name is made up from.
The constructor can be called with either a single argument or with a reference to a hash as in the example above.
If there is a single argument, it must be either a non-reference, a Zonemaster::Engine::DNSName object or a Zonemaster::Engine::Zone object.
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.
If it's a Zonemaster::Engine::DNSName object it will simply be returned.
If it's a Zonemaster::Engine::Zone object, the value of its name attribute will be returned.
name
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.
Returns the name as a string complete with a trailing dot.
Overloads string comparison. Comparison is made after converting the names to upper case, and ignores any trailing dot on the other name.
Returns a new Zonemaster::Engine::DNSName object, representing the name of the called one with the leftmost label removed.
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.
Returns a new Zonemaster::Engine::DNSName object, representing the called one with the given label prepended.
Helper method for JSON encoding.
To install Zonemaster::Engine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zonemaster::Engine
CPAN shell
perl -MCPAN -e shell install Zonemaster::Engine
For more information on module installation, please visit the detailed CPAN module installation guide.