The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::DNS::ZoneFile - 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]);

DESCRIPTION

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.

EXPORT

None by default.

HISTORY

1.00

Original version; created by h2xs 1.1.1.4 with options

  -ACOXcfkn
        Net::DNS::ZoneFile
        -v
        1.00

This is actually, the second version. The first was trying to use Parse::RecDescent, but the result was a piece of code much more complex than what was really needed. This made me switch the implementation to the current regexp engine, which provide faster and more maintainable code.

1.01

Calin Medianu pointed out that @ can be in the RHS. New tests were written to this end and the code modified to treat this case in a manner consistent with BIND/named. This version was not distributed by mistake.

1.02

Anton Berezin provided patches for some short-sighted assumptions and bugs. Reduced the strictness of the whitespace requirements for parsing SOA RRs.

1.03

Added support for a reentrant $INCLUDE. Funs Kessen added support for AAAA and HINFO.

1.03_1

Funs Kessen submitted patches to make this module behave more like BIND.

1.04

Release of 1.03_1 as stable.

AUTHOR

Luis E. Munoz <luismunoz@cpan.org>

SEE ALSO

perl(1).