|
Project Information
|
NAMENet::DNS::XML - Transforms a Net::DNS::Packet into well formed XML. SYNOPSIS #!/usr/bin/perl
use Net::DNS::Resolver;
use Net::DNS::XML;
# Create Net::DNS::Packet object.
my $resolver = Net::DNS::Resolver->new();
my $answer = $resolver->query('quarg.com', 'A', 'IN');
# Create Net::DNS::XML object.
my $xmlout = Net::DNS::XML->new([<options>]);
my $xml = $xmlout->XMLout($answer [, <options>]);
QUICK STARTA script that takes two arguments, hostname and record type: my $resolver = Net::DNS::Resolver->new();
my $answer = $resolver->query($ARGV[0], $ARGV[1]);
my $xmlout = Net::DNS::XML->new(KeepRoot => 1);
my $xml = $xmlout->XMLout($answer);
print $xml;Would output the following XML (which has been wrapped in this example to fit on screen: <response>
<packet answerfrom="205.234.103.204" answersize="95">
<header id="26002" aa="0" ad="0" ancount="1" arcount="1" cd="0"
nscount="2" opcode="QUERY" qdcount="1" qr="1" ra="1"
rcode="NOERROR" rd="1" tc="0" />
<questions>
<question qclass="IN" qname="quarg.com" qtype="A" />
</questions>
<answers>
<answer name="quarg.com" address="208.113.230.163" class="IN"
rdlength="4" ttl="86400" type="A" />
</answers>
<authorities>
<authority name="quarg.com" class="IN" nsdname="ns2.quarg.com"
rdlength="6" ttl="72051" type="NS" />
<authority name="quarg.com" class="IN" nsdname="ns1.quarg.com"
rdlength="6" ttl="72051" type="NS" />
</authorities>
<additionals>
<additional name="ns1.quarg.com" address="74.200.85.159" class="IN"
rdlength="4" ttl="86400" type="A" />
</additionals>
</packet>
</response>DESCRIPTIONKeep in mindCAVEATSWhile all Net::DNS::RR objects are able to be parsed into XML using this module, some types are not I <fully> parsed. This is primarly because they output binary data. I haven't figured out (honestly I haven't looked at it at all) how to represent binary data in xml. Or if it's even possible. It is my hope that all record types provided by Net::DNS will ultimately be included. The fully parsable record types:
The incomplete record types:
SEE ALSONet::DNS, XML::Simple, and our Web site: http://code.google.com/p/perl-net-dns-xml/. AUTHORMichael De Soto, desoto@cpan.org COPYRIGHT AND LICENSECopyright (C) 2008-2009 Michael De Soto. All rights reserved. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. |