1Net::DNS::Question(3) User Contributed Perl DocumentationNet::DNS::Question(3)
2
3
4
6 Net::DNS::Question - DNS question record
7
9 use Net::DNS::Question;
10
11 $question = Net::DNS::Question->new('example.com', 'AAAA', 'IN');
12
14 A Net::DNS::Question object represents a record in the question section
15 of a DNS packet.
16
18 new
19 $question = Net::DNS::Question->new('example.com', 'AAAA', 'IN');
20 $question = Net::DNS::Question->new('example.com', 'A', 'IN');
21 $question = Net::DNS::Question->new('example.com');
22
23 $question = Net::DNS::Question->new('2001::DB8::dead:beef', 'PTR', 'IN');
24 $question = Net::DNS::Question->new('2001::DB8::dead:beef');
25
26 Creates a question object from the domain, type, and class passed as
27 arguments. One or both type and class arguments may be omitted and will
28 assume the default values shown above.
29
30 RFC4291 and RFC4632 IP address/prefix notation is supported for queries
31 in both in-addr.arpa and ip6.arpa namespaces.
32
33 decode
34 $question = Net::DNS::Question->decode(\$data, $offset);
35
36 ($question, $offset) = Net::DNS::Question->decode(\$data, $offset);
37
38 Decodes the question record at the specified location within a DNS
39 wire-format packet. The first argument is a reference to the buffer
40 containing the packet data. The second argument is the offset of the
41 start of the question record.
42
43 Returns a Net::DNS::Question object and the offset of the next location
44 in the packet.
45
46 An exception is raised if the object cannot be created (e.g., corrupt
47 or insufficient data).
48
49 encode
50 $data = $question->encode( $offset, $hash );
51
52 Returns the Net::DNS::Question in binary format suitable for inclusion
53 in a DNS packet buffer.
54
55 The optional arguments are the offset within the packet data where the
56 Net::DNS::Question is to be stored and a reference to a hash table used
57 to index compressed names within the packet.
58
59 string
60 print "string = ", $question->string, "\n";
61
62 Returns a string representation of the question record.
63
64 print
65 $object->print;
66
67 Prints the record to the standard output. Calls the string() method to
68 get the string representation.
69
70 name
71 $name = $question->name;
72
73 Internationalised domain name corresponding to the qname attribute.
74
75 Decoding non-ASCII domain names is computationally expensive and
76 undesirable for names which are likely to be used to construct further
77 queries.
78
79 When required to communicate with humans, the 'proper' domain name
80 should be extracted from a query or reply packet.
81
82 $query = Net::DNS::Packet->new( $example, 'SOA' );
83 $reply = $resolver->send($query) or die;
84 ($question) = $reply->question;
85 $name = $question->name;
86
87 qname, zname
88 $qname = $question->qname;
89 $zname = $question->zname;
90
91 Fully qualified domain name in the form required for a query
92 transmitted to a nameserver. In dynamic update packets, this attribute
93 is known as zname() and refers to the zone name.
94
95 qtype, ztype, type
96 $qtype = $question->type;
97 $qtype = $question->qtype;
98 $ztype = $question->ztype;
99
100 Returns the question type attribute. In dynamic update packets, this
101 attribute is known as ztype() and refers to the zone type.
102
103 qclass, zclass, class
104 $qclass = $question->class;
105 $qclass = $question->qclass;
106 $zclass = $question->zclass;
107
108 Returns the question class attribute. In dynamic update packets, this
109 attribute is known as zclass() and refers to the zone class.
110
112 Copyright (c)1997-2000 Michael Fuhr.
113
114 Portions Copyright (c)2002,2003 Chris Reinhardt.
115
116 Portions Copyright (c)2003,2006-2011 Dick Franks.
117
118 All rights reserved.
119
121 Permission to use, copy, modify, and distribute this software and its
122 documentation for any purpose and without fee is hereby granted,
123 provided that the above copyright notice appear in all copies and that
124 both that copyright notice and this permission notice appear in
125 supporting documentation, and that the name of the author not be used
126 in advertising or publicity pertaining to distribution of the software
127 without specific prior written permission.
128
129 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
130 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
131 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
132 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
133 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
134 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
135 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
136
138 perl, Net::DNS, Net::DNS::DomainName, Net::DNS::Packet, RFC 1035
139 Section 4.1.2
140
141
142
143perl v5.32.1 2021-01-27 Net::DNS::Question(3)