Good day all,
I have been trying for the last few
days to get the PM Net::DNS::ZoneFile to work and am having some issues that
I can not get around.
I was wondering if
any of the monks have used this before or could help me with the specfic
erros I am recieving. Following is my code and then the specfic errors I
am recieving. Please forgive my ignorance as I am very new to the perl world.
#!/usr/bin/perl -w
$| = 1;
use strict;
use File::Find;
use FileHandle;
use Net::DNS::ZoneFile;
# use DNS::ZoneParse;
use Data::Dumper;
my $base = "/chroot/named/master/arpa/in-addr/68/168";
my $out_dir = "/var/tmp/ptr";
find(\&wanted, $base);
exit;
sub wanted {
return unless ( -f "$File::Find::name" and $File::Find::name !~ m!/
+com/! );
return unless ( -f "$File::Find::name" and $File::Find::name !~ m!/
+net/! );
my $zone = $File::Find::name;
my $out = join('.', ( split('/', $zone) )[-1,-2,-3]);
my $rrset = Net::DNS::ZoneFile->readfh($zone[, $root]);
# my $dns = DNS::ZoneParse->new("$zone");
open(OUT, ">$out_dir/$out") or die "Cant create $out_dir/$out: $!\n
+";
print $_->string . "\n" for @$rrset;
# print OUT Data::Dumper->Dump([$dns->ptr]) . "\n";
close(OUT);
}
Error message:
[root@steve tmp] 738# perl -cwTM-strict ./ptr.pl
Multidimensional syntax $zone[, $root] not supported at ./ptr.pl line
+24.
Global symbol "@zone" requires explicit package name at ./ptr.pl line
+24.
syntax error at ./ptr.pl line 24, near "[,"
Global symbol "$root" requires explicit package name at ./ptr.pl line
+24.
./ptr.pl had compilation errors.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.