Net::Z3950::DBIServer::Config - Configuration file parser for DBIServer
use Net::Z3950::DBIServer::Config; $config = new Net::Z3950::DBIServer::Config($configFile);
This module parses configuration files for the
Net::Z3950::DBIServer
module. I can't begin to imagine why anyone
who's not doing DBIServer development would be remotely interested in
the technical details of how that's done, and those people will be
reading the source rather than the documentation, so I don't propose
to write much.
The parser's a simple one-token-lookahead recursive descent parser, similar to the one that's explained in some detail in pretty much the first chapter of Aho, Sethi & Ullman's ``New Dragon Book'', Compilers: Principles, Techniques and Tools. If you want to write parsers of any substance, you have to have this book. It is the absolute bible of compilers.
It was a pleasure writing the parser in Perl - it took about a tenth as long as similar ones that I've written in C in the past (i.e. a couple of hours) and that includes the lexer which, to my delight, turned out to be thirty (count 'em!) lines of code.
I'm not going to insult your intelligence by documenting the public
methods, since the only one is the constructor, whose synopsis above
tells you all you need to know except that the $configFile
parameter is a filename, not a filehandle. The object that it
returns is pretty much self-documenting. Print it with
Data::Dumper
if you don't believe me.
Mike Taylor <mike@miketaylor.org.uk>
First version Sunday 3rd February 2002.
Net::Z3950::DBIServer
is the module that uses this, and the only one that would ever want
to, I'm sure.
You might like to look at the
Parse::RecDescent
module, but I didn't :-)
Return a list of strings, each of which is the name of one column that should be included in SELECT statements for the database on whose configuration object it is invoked. It gathers these from the information about all configured record syntaxes, and discards ``constant columns'' whose names begin with ``*''.