Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > d1bd68ea67b363532151ebe62cd98305 > files > 59

perl-Libconf-0.42.10-3.mga1.i586.rpm

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Libconf - Set of abstraction layers to the linux/unix configuration</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<ul>

		<li><a href="#perl">PERL</a></li>
		<li><a href="#c">C</a></li>
		<li><a href="#python">PYTHON</a></li>
		<li><a href="#ruby">RUBY</a></li>
		<li><a href="#templates">TEMPLATES</a></li>
	</ul>

</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<pre>
  Libconf - Set of abstraction layers to the linux/unix configuration</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>
</p>
<h2><a name="perl">PERL</a></h2>
<dl>
<dt><strong><a name="high_level" class="item"><strong>High level</strong></a></strong></dt>

<dd>
<p>This high level layer provides a hierarchical structure representing the
configuration file informations. It's very simple to use, and it uses a
&quot;semantic&quot; approach to structure the informations. You should use this layer.</p>
<pre>
  use Libconf::Glueconf::Networking::Resolv;
  my $resolv = new Libconf::Glueconf::Networking::Resolv({filename =&gt; '/etc/resolv.conf' });
  push(@{$resolv-&gt;{nameserver}}, '192.168.76.7');
  $resolv-&gt;{search}-&gt;[1] = 'foo';
  $resolv-&gt;write_conf('/etc/resolv_modified');</pre>
<p>See <a href="./Libconf/Glueconf.html">the Libconf::Glueconf manpage</a></p>
</dd>
<dt><strong><a name="low_level" class="item"><strong>Low level</strong></a></strong></dt>

<dd>
<p>This is the core layer and templates of Libconf, don't use it unless you know
what you do, or if there is no high level templates for your needs. But you
better contact us so that we add a tempalte. See <a href="./Libconf/Templates.html">the Libconf::Templates manpage</a>.</p>
</dd>
</dl>
<p>
</p>
<h2><a name="c">C</a></h2>
<pre>
  #include &lt;stdio.h&gt;
  #include &quot;conf2xml.h&quot;
  #include &lt;string.h&gt;
  int main (int argc, char **argv, char **env)
  {
      char *xml_string;
      conf2xml_init();
      xml_string = conf2xml(&quot;/etc/rc.conf&quot;, &quot;Generic/Shell&quot;, &quot;shell_style:true_bash,shell_command:/bin/bash&quot;);
      FILE* output = fopen(&quot;/tmp/rc.xml&quot;, &quot;w&quot;);
      fwrite(xml_string, strlen(xml_string), 1, output);
      // ... alter xml_string ...
      xml2conf(xml_string, &quot;./etc/rc.conf&quot;, NULL, NULL);
      conf2xml_free();
      return (0);
  }</pre>
<p>
</p>
<h2><a name="python">PYTHON</a></h2>
<pre>
  from conf2xml import *;
  xml_string=conf2xml(&quot;/etc/passwd&quot;, &quot;System/Passwd&quot;)
  f=open(&quot;/tmp/passwd.xml&quot;, &quot;w&quot;)
  f.write(xml_string)
  f.close
  xml2conf(xml_string, &quot;/tmp/passwd&quot;, &quot;System/Passwd&quot;)</pre>
<p>
</p>
<h2><a name="ruby">RUBY</a></h2>
<pre>
  require conf2xml
  xml=Conf2Xml.conf2xml(&quot;/etc/passwd&quot;, &quot;System/Passwd&quot;);
  Conf2Xml.xml2conf(xml, &quot;/tmp/passwd&quot;, &quot;System/Passwd&quot;);</pre>
<p>
</p>
<h2><a name="templates">TEMPLATES</a></h2>
<p>The template list can be found in <a href="./Libconf/Glueconf.html">the Libconf::Glueconf manpage</a>, or you can have a list by issuing on the command line :</p>
<pre>
  libconf --command 'list_templates'</pre>

</body>

</html>