++ed by:

1 PAUSE user
1 non-PAUSE user.

Author image Felipe Gasper
and 1 contributors




This class represents a DNS query result from DNS::Unbound.


This class includes an accessor for most members of struct ub_result (cf. libunbound(3)).

The following all return scalars:

  • qname(), qtype(), qclass(), ttl()

  • rcode(), nxdomain(), havedata(), canonname()

  • secure(), bogus(), why_bogus(), answer_packet

data() returns an array reference of strings that contain the query result in DNS-native RDATA encoding.


$objs_ar = OBJ->to_net_dns_rrs()

IMPORTANT: This method is DEPRECATED and will be withdrawn in a forthcoming version. Please migrate to the following logic instead (assuming an instance of this class in $result):

    my $packet = Net::DNS::Packet->new( \$result->answer_packet() );

… which will yield a Net::DNS::Packet instance.

The DEPRECATED method’s documentation follows:

The data() accessor’s return values are raw RDATA. Your application likely prefers to work with parsed DNS data, though. This method facilitates that by loading Net::DNS::RR and returning a reference to an array of instances of that class (i.e., probably a subclass of it like Net::DNS::RR::NS).

So, for example, to get a TXT query result’s value as a list of character strings, you could do:

    @cstrings = map { $_->txtdata() } @{ $result->to_net_dns_rrs() }