Net::DNS::Question(3)
β¨ Net::DNS::Question β DNS question record β¨
Okay so bestie, this is literally the module that represents a record in the question section of a DNS packet. No cap, it's giving core DNS energy. π
πΈ SYNOPSIS πΈ
Here's the vibe check β how you actually summon this thing:
use Net::DNS::Question;
$question = Net::DNS::Question->new('example.com', 'AAAA', 'IN');
π¦ DESCRIPTION π¦
A Net::DNS::Question object represents a record in the question section of a DNS packet. That's it. That's the whole vibe. It's the "hey DNS, can you tell me about this?" part of the packet. π
π METHODS π
π new
$question = Net::DNS::Question->new('example.com', 'AAAA', 'IN');
$question = Net::DNS::Question->new('example.com', 'A', 'IN');
$question = Net::DNS::Question->new('example.com');
$question = Net::DNS::Question->new('2001::DB8::dead:beef', 'PTR', 'IN');
$question = Net::DNS::Question->new('2001::DB8::dead:beef');
Creates a question object from the domain, type, and class passed as arguments. One or both type and class arguments may be omitted and will assume the default values shown above. Slay. β¨
RFC4291 and RFC4632 IP address/prefix notation is supported for queries in both in-addr.arpa and ip6.arpa namespaces. Highkey iconic behavior. π
π decode
$question = Net::DNS::Question->decode(\$data, $offset);
($question, $offset) = Net::DNS::Question->decode(\$data, $offset);
Decodes the question record at the specified location within a DNS wire-format packet. The first argument is a reference to the buffer containing the packet data. The second argument is the offset of the start of the question record. π«Ά
Returns a Net::DNS::Question object and the offset of the next location in the packet. Two-for-one, we love to see it. π
An exception is raised if the object cannot be created (e.g., corrupt or insufficient data). So like, if the data is a mess, it's gonna throw hands. π
π¦ encode
$data = $question->encode( $offset, $hash );
Returns the Net::DNS::Question in binary format suitable for inclusion in a DNS packet buffer. It's giving "ready for the group chat" energy. π₯
The optional arguments are the offset within the packet data where the Net::DNS::Question is to be stored and a reference to a hash table used to index compressed names within the packet. Compression is the moment. π
π string
print "string = ", $question->string, "\n";
Returns a string representation of the question record. Cute, readable, useful. The trifecta. β¨
πΈ print
$object->print;
Prints the record to the standard output. Calls the string() method to get the string representation. Lowkey just does the thing for you. π«Ά
π name
$name = $question->name;
Internationalised domain name corresponding to the qname attribute. Fancy. π
Decoding non-ASCII domain names is computationally expensive and undesirable for names which are likely to be used to construct further queries. So like, don't do it unless you actually need to, bestie. It's giving "expensive taste." πΈ
When required to communicate with humans, the 'proper' domain name should be extracted from a query or reply packet. Because humans deserve the cute version. π₯°
$query = Net::DNS::Packet->new( $example, 'SOA' );
$reply = $resolver->send($query) or die;
($question) = $reply->question;
$name = $question->name;
π qname, zname
$qname = $question->qname;
$zname = $question->zname;
Fully qualified domain name in the form required for a query transmitted to a nameserver. In dynamic update packets, this attribute is known as zname() and refers to the zone name. Two names, one vibe. π
π₯ qtype, ztype, type
$qtype = $question->type;
$qtype = $question->qtype;
$ztype = $question->ztype;
Returns the question type attribute. In dynamic update packets, this attribute is known as ztype() and refers to the zone type. Type type type. We stan a flexible API. π
π qclass, zclass, class
$qclass = $question->class;
$qclass = $question->qclass;
$zclass = $question->zclass;
Returns the question class attribute. In dynamic update packets, this attribute is known as zclass() and refers to the zone class. Class is in session and it's slaying. πβ¨
π COPYRIGHT π
Copyright (c)1997-2000 Michael Fuhr.
Portions Copyright (c)2002,2003 Chris Reinhardt.
Portions Copyright (c)2003,2006-2011 Dick Franks.
All rights reserved.
π§ LICENSE π§
Okay so legal moment β here's the whole thing, bestie, because you can't vibe-check a license:
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the original copyright notices appear in all copies and that both copyright notice and this permission notice appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
π SEE ALSO π
perl Net::DNS Net::DNS::DomainName Net::DNS::Packet RFC1035(4.1.2) <https://iana.org/go/rfc1035#section-4.1.2>
That's the whole page, bestie. And for the record β this was Net::DNS::Question(3) from perl v5.42.0, dated 2026-09-02. Periodt. π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Net-DNS 1.570.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms