Hi,
When I run the below script, it produces the zone file.
However if I try to read the variable $rr (eg "
foreach my $rr (@zone) {
print("var \n$rr\n");
$rr->print;
}
, it produces something like Net::DNS::RR::A=HASH(0x855c45c)
How can I process this data further in an array, string or whatever??
Sample zonefile output
test.net. 300 IN SOA ns1.test.net.
domainmaster.test.net. (
81541426 ; Serial
14400 ; Refresh
1800 ; Retry
3628800 ; Expire
7200 ) ; Minimum TTL
test.net. 300 IN A 195.172.54.90
test.net. 300 IN NS ns1.test.net.
test.net. 300 IN NS ns2.test.net.
test.net. 300 IN MX 0 mail.test.net.
test.net. 300 IN MX 10 mail1.test.net.
aktie.test.net. 300 IN A 3.160.219.41
......
Sample script.
#!/usr/bin/perl
#
my $optie1 = $ARGV[0];
use strict;
use Net::DNS;
my $res = Net::DNS::Resolver->new;
$res->tcp_timeout(10);
my @zone = $res->axfr($optie1);
if (@zone) {
foreach my $rr (@zone) {
$rr->print;
}
} else {
print 'Zone transfer failed: ', $res->errorstring, "\n";
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/