Version: 0.1
$Id: Config.pm,v 1.2 2000/05/21 23:41:03 matt Exp $
use XML::Config;
my $cfg = new XML::Config; my %CONF = $cfg->load_conf("path/to/file.xml");
-OR-
my %CONF = $cfg->load_conf("path/to/file.xml",\%your_local_config_hash);
my %CONF = $cfg->load_conf("path/to/file.xml",\%your_local_config_hash, \@do_not_overide_these);
XML::Config is a simple shallow XML to hash converter. Given a configuration file in the form:
<goxml_config process="spider"> <foo>Bar</foo> <bar>Foo</bar> </goxml_config>
... XML::Config->load_conf returns:
{ foo => 'bar', bar => 'foo' }
XML::Config will also try to load "path/to/file.xml.bak" in the case of a non-file not found parse error. if it does this, it will set the err_str to "WARN: Loaded backup configuration\n";
The second way of calling load_conf() with the hash reference allows you to set defaults to your config hash, and have the XML overide some of them.
The third way makes it possible to disallow overwrites of certain variables. This is a good security measure. =head1 METHODS
load_conf($conf_file_path) err_str()
XML Global Technologies, Inc (Matthew MacKenzie)
(c)2000 XML Global Technologies, Inc.
1 POD Error
The following errors were encountered while parsing the POD:
=pod directives shouldn't be over one line long! Ignoring all 4 lines of content
To install XML::Config, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Config
CPAN shell
perl -MCPAN -e shell install XML::Config
For more information on module installation, please visit the detailed CPAN module installation guide.