GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  BIND::CONFIG::PARSER (3)

.ds Aq ’

NAME

BIND::Config::Parser - Parse BIND Config file.

CONTENTS

SYNOPSIS



 use BIND::Config::Parser;

 # Create the parser
 my $parser = new BIND::Config::Parser;

 my $indent = 0;

 # Set up callback handlers
 $parser->set_open_block_handler( sub {
         print "\t" x $indent, join( " ", @_ ), " {\n";
         $indent++;
 } );
 $parser->set_close_block_handler( sub {
         $indent--;
         print "\t" x $indent, "};\n";
 } );
 $parser->set_statement_handler( sub {
         print "\t" x $indent, join( " ", @_ ), ";\n";
 } );

 # Parse the file
 $parser->parse_file( "named.conf" );



DESCRIPTION

BIND::Config::Parser provides a lightweight parser to the configuration file syntax of BIND v8 and v9 using a Parse::RecDescent grammar.

It is in a similar vein to BIND::Conf_Parser. However, as it has no knowledge of the directives, it doesn’t need to be kept updated as new directives are added, it simply knows how to carve up a BIND configuration file into logical chunks.

CONSTRUCTOR

new( ); Create a new BIND::Config::Parser object.

METHODS

set_open_block_handler( CODE_REF ); Set the code to be called when a configuration block is opened. At least one argument will be passed; the name of that block, for example options or zone, etc. as well as any additional items up to but not including the opening curly brace.
set_close_block_handler( CODE_REF ); Set the code to be called when a configuration block is closed. No arguments are passed.
set_statement_handler( CODE_REF ); Set the code to be called on a single line configuration element. At least one argument will be passed; the name of that element, as well as any additional items up to but not including the ending semi-colon.
parse_file( FILENAME ); Parse FILENAME, triggering the above defined handlers on the relevant sections.

TODO

Probably the odd one or two things. I’m fairly sure the grammar is correct.

COPYRIGHT AND LICENSE

Copyright (c) 2005 Matt Dainty.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Matt Dainty <matt@bodgit-n-scarper.com>.

SEE ALSO

perl, Parse::RecDescent, BIND::Conf_Parser.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 BIND::CONFIG::PARSER (3) 2005-06-26

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.