Zonema...DNSName(3pm)
β¨ NAME β¨
Zonemaster::Engine::DNSName β a whole class that is literally just a glow-up for DNS names π
(it's a class representing DNS names, bestie, that's the whole vibe)
π¦ SYNOPSIS π¦
my $name1 = Zonemaster::Name->new('www.example.org');
my $name2 = Zonemaster::Name->new('ns.example.org');
say "Yay!" if $name1->common($name2) == 2;
no cap, that's it, that's the whole thing π«Ά
π ATTRIBUTES π
labelsβ a reference to a list of strings, aka the actual labels your DNS name is built out of. like, the little pieces. the building blocks. the β¨ingredientsβ¨.
π METHODS π
new($input)ornew({ labels => \@labellist })β the constructor!! you can call it two ways: with one single argument, or with a reference to a hash (like in the example up there π).
okay so if you give it a single argument, it has to be one of these three things, no exceptions:
- a non-reference
- a
Zonemaster::Engine::DNSNameobject - a
Zonemaster::Engine::Zoneobject
and here's what happens depending on what you handed it:
- if it's a non-reference β it gets split at period characters (possibly after stringification, iykyk) and the resulting list becomes the name's labels π
- if it's a
Zonemaster::Engine::DNSNameobject β it just gets returned as-is. she said "I'm already iconic, no changes needed" π - if it's a
Zonemaster::Engine::Zoneobject β the value of its"name"attribute gets returned β¨
from_string($domain)β a specialized constructor, and she is picky: you must call her with a string. periodt. πstring()β returns a string representation of the name π the string gets made by joining the labels with dots. and if there are no labels at all? you get a single dot back. just one. lonely little dot. π«Ά
heads up: names created this way do not have a trailing dot!
oh and the stringification operator is overloaded to this function, so honestly you'll rarely ever need to call it directly. she just works β¨
fqdn()β returns the name as a string, but this time complete with a trailing dot β that's the whole difference. fully qualified, fully dressed.str_cmp($other)β overloads string comparison π₯ the comparison happens after converting both names to upper case, and it ignores any trailing dot on the other name. so like, chill about the dot, bestie.next_higher()β returns a brand newZonemaster::Engine::DNSNameobject representing the name you called it on, but with the leftmost label removed. she's evolving πcommon($other)β returns the number of labels, counting from the rightmost going left, that are the same in both names. this gets used by the recursor to check for redirections going up the DNS tree π³ iconic behavior honestlyis_in_bailiwick($other)β returns true if$otheris in-bailiwick of$self, and false otherwise π
see also <https://tools.ietf.org/html/rfc7719#section-6> β go read it, she's serving lore π
prepend($label)β returns a newZonemaster::Engine::DNSNameobject representing the called one with the given label prepended. front of the line, no cutting πTO_JSONβ helper method for JSON encoding β¨ that's literally all she does and she does it flawlessly.
and that's the whole page, bestie!! no notes, she ate π β¨
this was brought to you by the perl v5.40.1 girlies, dated 2026-03-21 β and yes, it was user contributed Perl documentation, so thank a real one π«Άπ bye mwah π
π¦ where this page comes from
- ubuntu stonking: libzonemaster-perl 8.001.001-1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms