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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.