Config-DotNetXML
view release on metacpan or search on metacpan
lib/Config/DotNetXML.pm view on Meta::CPAN
package Config::DotNetXML;
=head1 NAME
Config::DotNetXML - Get config in the manner of .NET Framework
=head1 ABSTRACT
This module allows the transparent import of .NET Framework style config.
=head1 SYNOPSIS
use Config::DotNetXML;
our %appSettings;
my $foo = $appSettings{Foo};
=head1 DESCRIPTION
This module attempts to provide a configuration facility similar to that
provided by System.Configuration.ConfigurationSettings class in the .NET
framework, the intent is that .NET programs and Perl programs can share the
same configuration file.
When the modules import() method is called (either implicitly via use or
explicitly) it will read and parse and XML file (by default called $0.config)
in the same directory as the script and import the settings specified in
that file into the %appSettings hash in the current package.
The XML file is of the format:
<configuration>
<appSettings>
<add key="msg" value="Bar" />
</appSettings>
</configuration>
The E<lt>addE<gt>elements are the ones that contain the configuration, with
the 'key' attribute becoming the key in %appSettings and 'value' becoming
the value.
The default behaviour of the module can be altered by the following parameters
that are supplied via the import list of the module:
=over 2
=item Package
Alter the package into which the settings are imported. The default is the
package in which C<use Config::DotNetXML> is called.
=item VarName
Use a different name for the variable into which the settings are placed.
The default is C<%appSettings>, the name should not have the type specifier.
=item File
Use a different filename from which to get the settings. The default is the
program name with '.config' appended.
=item Section
By default the configuration is taken from the 'appSettings' section of the
file - however this can be changed by this parameter.
See L<Config::DotNetXML::Parser> for details on named sections.
=back
( run in 1.664 second using v1.01-cache-2.11-cpan-39bf76dae61 )