Config::Constants::XML - Configuration loader for Config::Constants


NAME

Config::Constants::XML - Configuration loader for Config::Constants


SYNOPSIS


  use Config::Constants::XML;


DESCRIPTION

This module reads and parses XML files as configuration files that look like this:

  <config>
      <module name='Foo::Bar'>
          <constant name='BAZ' value='the coolest module ever' />
      </module>
  </config>  
  
It is also possible to do more complex constant value types, like this:
  <config>
      <module name='Foo::Bar2'>
            <constant name='BAZ' type='ARRAY'>
              [ 1, 2, 3 ]
            </constant>
      </module>
      <module name='Bar::Baz2'>
          <constant name='FOO' type='HASH'>
              { test => 'this', out => 10 }
          </constant>
          <constant name='BAR' type='My::Object'>
              My::Object->new()
          </constant>        
      </module>
  </config>
  
  The C<type> parameter much match the value returned after C<eval>-ing the text.

You can also include other configurations into the current one like this:

  <config> 
      <include path='conf/base_conf.xml' />
      <module name='Foo::Bar'>
          <constant name='BAZ' value='the coolest module ever' />
      </module>
  </config>

The configurations are processed in order, so in this example, anything set in conf/base_conf.xml will be shadowed by anything set in the current xml.


METHODS

new ($file)

This takes the file, loads, parses and stores the resulting configuration.

modules

This will return an array of modules in this configuration.

constants ($module_name)

Given a $module_name, this will return an array of hash references for each constant specified.


TO DO


BUGS

None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it.


CODE COVERAGE

I use Devel::Cover to test the code coverage of my tests, see the the Config::Constants manpage module for more information.


SEE ALSO

the XML::SAX manpage


AUTHOR

stevan little, <stevan@iinteractive.com>


COPYRIGHT AND LICENSE

Copyright 2005 by Infinity Interactive, Inc.

http://www.iinteractive.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.