Net::DNS::ZoneFile 1.04 review

Download
by rbytes.net on

Net::DNS::ZoneFile is a Perl extension to convert a zone file to a collection of RRs. SYNOPSIS use Net::DNS::ZoneFile; m

License: Perl Artistic License
File size: 7K
Developer: Luis E. Munoz
0 stars award from rbytes.net

Net::DNS::ZoneFile is a Perl extension to convert a zone file to a collection of RRs.

SYNOPSIS

use Net::DNS::ZoneFile;

my $rrset = Net::DNS::ZoneFile->read($filename[, $root]);

print $_->string . "n" for @$rrset;

my $rrset = Net::DNS::ZoneFile->readfh($fh[, $root]);

# OR

my $rrset = Net::DNS::ZoneFile->parse($ref_to_myzonefiletext[, $root]);

This module parses a zone file and returns a reference to an array of Net::DNS::RR objects containing each of the RRs given in the zone in the case that the whole zone file was succesfully parsed. Otherwise, undef is returned.

The zone file can be specified as a filename, using the ->read() method, or as a file handle, using the ->readfh() method. If you already have a scalar with the contents of your zone file, the most efficient way to parse it is by passing a reference to it to the ->parse() method.
The optional $root parameter, tells the module where to anchor $INCLUDE statements found in the zone data. It defaults to the current directory.

In case of error, undef will be returned.

The primitives $ORIGIN and $GENERATE are understood automatically.

Note that the text passed to ->parse() by reference, is copied inside the function to avoid modifying the original text. If this is not an issue, you can use ->_parse() instead, which will happily spare the performance penalty AND modify the input text.

Requirements:
Perl

Net::DNS::ZoneFile 1.04 search tags