XML::Application::Config is a perl module for handling XML based configuration files.


<?xml version="1.0" encoding="utf-8"?>
<!-- Stand: Fri Mar 16 13:36:58 CET 2012 -->
<applicationconfig version="0.2">
           <application name="myApplication">
                        <hostname value="myHost.example.org" />
                                <login    value="johndoe"/>
                                <password value="secret"/>
                                <option name="o1" value="I" />
                                <option name="o2" value="II" />
                                <option name="o3" value="III" />
use strict; 
use XML::Application::Config;
use Data::Dumper;
my $xmlfilename = $ENV{HOME}."/.myApplication.xml";
my $cfg    = XML::Application::Config->new("myApplication",$xmlfilename);
my $login  = $cfg->find('auth/login/@value');
my $passwd = $cfg->find('auth/password/@value');
my $optionscount  = $cfg->find("count(optionlist/option)");
print "Options(#): '$optionscount'\n";
for (my $i=1; $i <= $optionscount; $i++) {
        my $name  = $cfg->find("optionlist/option[$i]/\@name");
        my $value = $cfg->find("optionlist/option[$i]/\@value");
        $options->{$name} = $value;
        print "    Option $i: '$name'='$value'\n";
print Dumper($options);

bugs & wish list

  • Replace XML::XPath by XML::LibXML2 (2015-02-23)
  • The <include/> statement allows only for including stuff from the same <application> namespace. Sometimes access to arbitarary config trees of another application would be nice. Thinking about <import/> or similar. (2015-02-23)
  • Some variable replacement mechanism. Like <basedir value=”/var/lib/app”/> and <workdir value=“${basedir}/work”/> . Testcode currently runs in mkrepo. (2015-02-23)
  • Hierarchical config file processing: /etc/<app> first, ~/.<app> next, ./.<app> each overriding the settings from its predecessors.
  • ~ - expansion for xml-cfg-filename in new() would be nice (2015-09-10)

fixed bugs

  • The .deb-package lacks the dependency of libxml-xpath-perl (2015-02-23) (fixed in
  • manpage: missing like break in SYNOPSIS, (fixed in
  • manpage: broken constructor call in SYNOPSIS (fixed in
  • manpage: xpaths with leading / in SYNOPSIS (fixed in
  • manpage: ~ - expansion is suggested, change examples to $ENV{HOME} (fixed in
project/xml/application/config.txt · Last modified: 2015/09/10 19:04 by
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki