File: //usr/local/ssl/local/share/man/man3/Net::DNS::ZoneFile.3
.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.20)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Net::DNS::ZoneFile 3"
.TH Net::DNS::ZoneFile 3 "2012-12-06" "perl v5.8.8" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Net::DNS::ZoneFile \- DNS zone file
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use Net::DNS::ZoneFile;
\&
\& $zonefile = new Net::DNS::ZoneFile( \*(Aqdb.example\*(Aq );
\&
\& while ( $rr = $zonefile\->read ) {
\& $rr\->print;
\& }
\&
\& @zone = $zonefile\->read;
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Each Net::DNS::ZoneFile object instance represents a zone file
together with any subordinate files nominated using \f(CW$INCLUDE\fR
directives. Zone file syntax is defined by \s-1RFC1035\s0.
.PP
A program can have multiple zone file objects, each maintaining
its own independent parser state information.
.PP
The parser supports both the \f(CW$TTL\fR directive defined by \s-1RFC2308\s0
and the \s-1BIND\s0 \f(CW$GENERATE\fR syntax extension.
.PP
All RRs in a zone file must have the same class, which may be
specified for the first \s-1RR\s0 encountered and is then propagated
automatically to all subsequent records.
.SH "METHODS"
.IX Header "METHODS"
.SS "new"
.IX Subsection "new"
.Vb 1
\& $zonefile = new Net::DNS::ZoneFile( \*(Aqdb.example\*(Aq, [\*(Aqexample.com\*(Aq] );
.Ve
.PP
Returns a Net::DNS::ZoneFile object which represents the zone
file specified in the argument list.
.PP
The file is opened for reading and remains open until exhausted
or all references to the ZoneFile object cease to exist.
.PP
The optional second argument specifies \f(CW$ORIGIN\fR for the zone file.
.SS "read"
.IX Subsection "read"
.Vb 1
\& $rr = $zonefile\->read;
.Ve
.PP
When invoked in scalar context, returns the next \s-1RR\s0 encountered
in the zone file, or undefined if end of data has been reached.
.PP
Comments and blank lines are silently disregarded.
.PP
\&\f(CW$INCLUDE\fR, \f(CW$ORIGIN\fR, \f(CW$TTL\fR and \f(CW$GENERATE\fR directives are processed
transparently.
.PP
.Vb 1
\& @rr = $zonefile\->read;
.Ve
.PP
When invoked in list context, returns the list of all \s-1RR\s0 objects
in the zone file.
.SS "name"
.IX Subsection "name"
.Vb 1
\& $filename = $zonefile\->name;
.Ve
.PP
Returns the name of the zone file from which RRs will be read.
\&\f(CW$INCLUDE\fR directives will cause this to differ from the filename
argument supplied when the object was created.
.SS "line"
.IX Subsection "line"
.Vb 1
\& $line = $zonefile\->line;
.Ve
.PP
Returns the line number of the last non-continuation line encountered
in the current zone file.
.SS "origin"
.IX Subsection "origin"
.Vb 1
\& $origin = $zonefile\->origin;
.Ve
.PP
Returns the fully qualified name of the current origin within the
zone file.
.SS "ttl"
.IX Subsection "ttl"
.Vb 1
\& $ttl = $zonefile\->ttl;
.Ve
.PP
Returns the default \s-1TTL\s0 as specified by the \f(CW$TTL\fR directive.
.SH "COMPATIBILITY WITH Net::DNS::ZoneFile 1.04"
.IX Header "COMPATIBILITY WITH Net::DNS::ZoneFile 1.04"
Applications which depended on the Net::DNS::ZoneFile 1.04 package
will continue to operate with minimal change using compatibility
interface described below.
.PP
.Vb 1
\& use Net::DNS::ZoneFile;
\&
\& $listref = Net::DNS::ZoneFile\->read( $filename, $include_dir );
\&
\& $listref = Net::DNS::ZoneFile\->readfh( $handle, $include_dir );
\&
\& $listref = Net::DNS::ZoneFile\->parse( $string, $include_dir );
\& $listref = Net::DNS::ZoneFile\->parse( \e$string, $include_dir );
\&
\& $_\->print for @$listref;
.Ve
.PP
The optional second argument specifies the default path for filenames.
The current working directory is used by default.
.PP
Although not available in the original implementation, the \s-1RR\s0 list
can be obtained directly by calling in list context.
.PP
.Vb 1
\& @rr = Net::DNS::ZoneFile\->read( $filename, $include_dir );
.Ve
.SS "read"
.IX Subsection "read"
.Vb 1
\& $listref = Net::DNS::ZoneFile\->read( $filename, $include_dir );
.Ve
.PP
\&\fIread()\fR parses the specified zone file and returns a reference to the
list of Net::DNS::RR objects representing the RRs in the file.
The return value is undefined if the zone data can not be parsed.
.SS "readfh"
.IX Subsection "readfh"
.Vb 1
\& $listref = Net::DNS::ZoneFile\->readfh( $handle, $include_dir );
.Ve
.PP
\&\fIread()\fR parses data from the specified file handle and returns a
reference to the list of Net::DNS::RR objects representing the RRs
in the file.
The return value is undefined if the zone data can not be parsed.
.SS "parse"
.IX Subsection "parse"
.Vb 2
\& $listref = Net::DNS::ZoneFile\->parse( $string, $include_dir );
\& $listref = Net::DNS::ZoneFile\->parse( \e$string, $include_dir );
.Ve
.PP
\&\fIparse()\fR interprets the argument string and returns a reference to
the list of Net::DNS::RR objects representing the RRs.
The return value is undefined if the zone data can not be parsed.
.SH "ACKNOWLEDGEMENTS"
.IX Header "ACKNOWLEDGEMENTS"
This package is designed as an improved and compatible replacement
for Net::DNS::ZoneFile 1.04 which was created by Luis Munoz in 2002
as a separate \s-1CPAN\s0 module.
.PP
The present implementation is the result of an agreement to merge our
two different approaches into one package integrated into Net::DNS.
The contribution of Luis Munoz is gratefully acknowledged.
.PP
Thanks are also due to Willem Toorop for his constructive criticism
of the initial version and invaluable assistance during testing.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (c)2011\-2012 Dick Franks
.PP
All rights reserved.
.PP
This program is free software; you may redistribute it and/or
modify it under the same terms as Perl itself.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
perl, Net::DNS, Net::DNS::Domain, Net::DNS::RR,
\&\s-1RFC1035\s0 Section 5.1, \s-1RFC2308\s0, \s-1BIND\s0 9 Administrator Reference Manual