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) or new({ 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::DNSName object
  • a Zonemaster::Engine::Zone object

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::DNSName object β†’ it just gets returned as-is. she said "I'm already iconic, no changes needed" πŸ’…
  • if it's a Zonemaster::Engine::Zone object β†’ 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 new Zonemaster::Engine::DNSName object 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 honestly
  • is_in_bailiwick($other) β€” returns true if $other is 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 new Zonemaster::Engine::DNSName object 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