NAME
Config::DotNetXML::Parser - Parse a .NET XML .config file
SYNOPSIS
use Config::DotNetXML::Parser;
my $parser = Config::DotNetXML::Parser->new(File => $file);
my $config = $parser->data();
DESCRIPTION
This module implements the parsing for Config::DotNetXML it is designed to be used by that module but can be used on its own if the import feature is not required.
THe configuration files are XML documents like:
<configuration>
<appSettings>
<add key="msg" value="Bar" />
</appSettings>
</configuration>
and the configuration is returned as a hash reference of the <add /> elements with the key and value attributes providing respectively the key and value to the hash.
METHODS
- new
-
Returns a new Config::DotNetXML::Parser object - it takes parameters in key => value pairs:
- File
-
The filename containing the configuration. If this is supplied then the configuration will be available via the data() method immediately, otherwise at the minimum parse() will need to be called first.
- parse
-
This causes the configuration file to be parsed, after which the configuration will be available via the data() method. It can be supplied with an optional filename which will remove the need to use the File() method previously.
- data
-
Returns or sets the parsed data - this will be undefined if parse() has not previously been called.
- File
-
Returns or sets the name of the file to be parsed for the configuration.
BUGS
Those familiar with the .NET Framework will realise that this is not a complete implementation of all of the facilities offered by the System.Configuration class: this will come later.
Some may consider the wanton exporting of names into the calling package to be a bad thing.
AUTHOR
Jonathan Stowe <jns@gellyfish.com>
COPYRIGHT
This library is free software - it comes with no warranty whatsoever.
Copyright (c) 2004 Jonathan Stowe
This module can be distributed under the same terms as Perl itself.