DNS::Unbound::Result
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)).
struct ub_result
The following all return scalars:
qname(), qtype(), qclass(), ttl()
qname()
qtype()
qclass()
ttl()
rcode(), nxdomain(), havedata(), canonname()
rcode()
nxdomain()
havedata()
canonname()
secure(), bogus(), why_bogus(), answer_packet
secure()
bogus()
why_bogus()
answer_packet
data() returns an array reference of strings that contain the query result in DNS-native RDATA encoding.
data()
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):
$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() }
To install DNS::Unbound, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DNS::Unbound
CPAN shell
perl -MCPAN -e shell install DNS::Unbound
For more information on module installation, please visit the detailed CPAN module installation guide.