http://qs1969.pair.com?node_id=267643


in reply to DNS::ZoneFile

You could try DNS::ZoneParse:

#!/usr/bin/perl -w use strict; use DNS::ZoneParse; my $zone = DNS::ZoneParse->new("../named.master.conf/_dnsmaster"); print $zone->output();

Update: Missed the question -- This won't parse the named.conf file. Looks like BIND::Conf_Parser should do what you want

-- simonflk

Replies are listed 'Best First'.
Re: Re: DNS::ZoneFile^H^H^H^HParse
by naChoZ (Curate) on Jun 21, 2003 at 03:06 UTC
    I gave that one a quick spin. But the one that I actually got working pretty easily is Unix::Conf::Bind8.

    For possible future super searchers, this is all it took:

    #!/usr/bin/perl -w use strict; use Unix::Conf::Bind8; my $namedconf='/path_to/named.conf'; my ($obj, $conf); $conf = Unix::Conf::Bind8->new_conf ( FILE => $namedconf, SECURE_OPEN => 0 ) or $conf->die ('could not open \'named.conf\':' . $!); $obj = $conf->get_zone ('example.com') or $obj->die ("couldn't get zone `example.com'"); print "\n" . $obj->file . "\n";

    ~~
    naChoZ