{
    "mode": "perldoc",
    "parameter": "Net::DNS::Question",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3ADNS%3A%3AQuestion/json",
    "generated": "2026-06-13T00:21:06Z",
    "synopsis": "use Net::DNS::Question;\n$question = Net::DNS::Question->new('example.com', 'AAAA', 'IN');",
    "sections": {
        "NAME": {
            "content": "Net::DNS::Question - DNS question record\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Net::DNS::Question;\n\n$question = Net::DNS::Question->new('example.com', 'AAAA', 'IN');\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "A Net::DNS::Question object represents a record in the question section of a DNS packet.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "new\n$question = Net::DNS::Question->new('example.com', 'AAAA', 'IN');\n$question = Net::DNS::Question->new('example.com', 'A', 'IN');\n$question = Net::DNS::Question->new('example.com');\n\n$question = Net::DNS::Question->new('2001::DB8::dead:beef', 'PTR', 'IN');\n$question = Net::DNS::Question->new('2001::DB8::dead:beef');\n\nCreates a question object from the domain, type, and class passed as arguments. One or both type\nand class arguments may be omitted and will assume the default values shown above.\n\nRFC4291 and RFC4632 IP address/prefix notation is supported for queries in both in-addr.arpa and\nip6.arpa namespaces.\n\ndecode\n$question = Net::DNS::Question->decode(\\$data, $offset);\n\n($question, $offset) = Net::DNS::Question->decode(\\$data, $offset);\n\nDecodes the question record at the specified location within a DNS wire-format packet. The first\nargument is a reference to the buffer containing the packet data. The second argument is the\noffset of the start of the question record.\n\nReturns a Net::DNS::Question object and the offset of the next location in the packet.\n\nAn exception is raised if the object cannot be created (e.g., corrupt or insufficient data).\n\nencode\n$data = $question->encode( $offset, $hash );\n\nReturns the Net::DNS::Question in binary format suitable for inclusion in a DNS packet buffer.\n\nThe optional arguments are the offset within the packet data where the Net::DNS::Question is to\nbe stored and a reference to a hash table used to index compressed names within the packet.\n\nstring\nprint \"string = \", $question->string, \"\\n\";\n\nReturns a string representation of the question record.\n\nprint\n$object->print;\n\nPrints the record to the standard output. Calls the string() method to get the string\nrepresentation.\n\nname\n$name = $question->name;\n\nInternationalised domain name corresponding to the qname attribute.\n\nDecoding non-ASCII domain names is computationally expensive and undesirable for names which are\nlikely to be used to construct further queries.\n\nWhen required to communicate with humans, the 'proper' domain name should be extracted from a\nquery or reply packet.\n\n$query = Net::DNS::Packet->new( $example, 'SOA' );\n$reply = $resolver->send($query) or die;\n($question) = $reply->question;\n$name = $question->name;\n\nqname, zname\n$qname = $question->qname;\n$zname = $question->zname;\n\nFully qualified domain name in the form required for a query transmitted to a nameserver. In\ndynamic update packets, this attribute is known as zname() and refers to the zone name.\n\nqtype, ztype, type\n$qtype = $question->type;\n$qtype = $question->qtype;\n$ztype = $question->ztype;\n\nReturns the question type attribute. In dynamic update packets, this attribute is known as",
            "subsections": [
                {
                    "name": "ztype",
                    "content": "qclass, zclass, class\n$qclass = $question->class;\n$qclass = $question->qclass;\n$zclass = $question->zclass;\n\nReturns the question class attribute. In dynamic update packets, this attribute is known as"
                },
                {
                    "name": "zclass",
                    "content": ""
                }
            ]
        },
        "COPYRIGHT": {
            "content": "Copyright (c)1997-2000 Michael Fuhr.\n\nPortions Copyright (c)2002,2003 Chris Reinhardt.\n\nPortions Copyright (c)2003,2006-2011 Dick Franks.\n\nAll rights reserved.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Permission to use, copy, modify, and distribute this software and its documentation for any\npurpose and without fee is hereby granted, provided that the original copyright notices appear\nin all copies and that both copyright notice and this permission notice appear in supporting\ndocumentation, and that the name of the author not be used in advertising or publicity\npertaining to distribution of the software without specific prior written permission.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING\nBUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "perl, Net::DNS, Net::DNS::DomainName, Net::DNS::Packet, RFC 1035 Section 4.1.2\n",
            "subsections": []
        }
    },
    "summary": "Net::DNS::Question - DNS question record",
    "flags": [],
    "examples": [],
    "see_also": []
}