Libconf::Conf2XML - Config file to XML module
Libconf::Conf2XML is a class that implements the connection between configuration structure and XML. It provides simple methods to get XML from a config file, or to get a config file from an XML string.
Note that this package is not really intended to be used directly. It's there mainly for the C binding. If you want to interact with configuration files and XML, see the Libconf::Glueconf manpage, it has built-in XML bindings.
use Libconf::Conf2XML; $xml_string = Libconf::Conf2XML::conf2xml('/etc/password'); $xml_string = Libconf::Conf2XML::conf2xml('/etc/conf.d/pure-ftpd', 'Generic/Shell'); $xml_string = Libconf::Conf2XML::conf2xml('/etc/make.conf', 'Generic/Shell', 'shell_style:true_bash,shell_command:/bin/bash');
This method returns the xml_string from a filename of a config file. The second and third arguments are optional, they represents the template and the options to pass to the template. These arguments are useful if the filename is not referenced in the internal database.
use Libconf::Conf2XML; $xml_string = Libconf::Conf2XML::xml2conf($filename, $xml_string); $xml_string = Libconf::Conf2XML::xml2conf($filename, $xml_string, 'Generic/Shell'); $xml_string = Libconf::Conf2XML::xml2conf($filename, $xml_string, 'Generic/Shell', 'shell_style:true_bash,shell_command:/bin/bash');
This method takes the xml_string in a XML::Dumper format, generates the configuration file and saves it to $filename. See conf2xml for explanation on the other arguments.