NAME

CCCP::ConfigXML - Load XML config

SYNOPSIS

Load XML file. Example:

<!-- some_config.xml -->
    <name>TestApp</name>
    <component name="Controller::Foo">
        <foo>bar</foo>
    </component>
    <model name="Baz">
        <qux>xyzzy</qux>
    </model>
    
    <foo>
        <bar>x1</bar>
        <bar>x2</bar>
        <bar>x3</bar>
        <bar>x4</bar>
    </foo>

In your code:

use CCCP::ConfigXML;

# like XML::Bare
my $cnf = CCCP::ConfigXML->new( file => 'some_config.xml' );

# or you can:
my $cnf = CCCP::ConfigXML->new( text => $xml_string );

# now, you can read
$cnf->name;                   # TestApp
$cnf->component->foo;         # bar
$cnf->component->_attr->name; # Controller::Foo

# and can set
$cnf->name('NewTestApp');     # 1
$cnf->name;                   # NewTestApp

# loop element
print "$_" for @{$cnf->foo->bar};

DESCRIPTION

Using XML::Bare for parsing and AUTOLOAD to access.

NOTE

Config is the basis of applications and values in it are known in advance. Config values should not be checked for validity or existence. Therefore, this module does not contain any verification of the existence of values. Use only read access.

SEE ALSO

AUTHOR

Ivan Sivirinov <catamoose [at] yandex.ru>