Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > a918147e816a04e85f8654f72077e879 > files > 94

perl-Libconf-0.42.10-6.mga4.x86_64.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></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">



<ul id="index">
  <li><a href="#NAME">NAME</a></li>
  <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="#CONSTRUCTOR">CONSTRUCTOR</a></li>
  <li><a href="#GENERAL-METHODS">GENERAL METHODS</a></li>
  <li><a href="#SPECIFIC-METHODS">SPECIFIC METHODS</a></li>
</ul>

<h1 id="NAME">NAME</h1>

<p>Libconf::Templates::Generic::KeyValue - Libconf generic low level template for semantic association (KEY - VALUE) styles config files</p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>Libconf::Templates::Generic::KeyValue is a generic template that handles config files that contain semantic informations of type : (KEY - VALUE).</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code> $template = new Libconf::Templates::Generic::KeyValue({
                                               filename =&gt; &#39;autologin&#39;,
                                               separator_char =&gt; &#39;=&#39;,
                                               allow_space =&gt; 1,
                                               comments_struct =&gt; [[&#39;#&#39;]],
                                               handle_quote =&gt; 1,
                                               handle_multiples_lines =&gt; 0,
                                               handle_backslash =&gt; 1,
                                               backslash_character =&gt; &#39;\\&#39;,
                                               accept_empty_value =&gt; 1,
                                              });
 $template-&gt;read_conf();
 $template-&gt;edit_atom(-1, {key =&gt; &#39;USER&#39; }, { value =&gt; &#39;plop&#39;});
 $template-&gt;edit_atom(-1, {key =&gt; &#39;AUTOLOGIN&#39; }, { value =&gt; &#39;no&#39;});
 $template-&gt;edit_atom(-1, {key =&gt; &#39;EXEC&#39; }, { value =&gt; &#39;startx&#39;});
 ...
 (see L&lt;Libconf::Templates&gt; for transformation methods on $template) ...
 ...
 $template-&gt;write_conf(&quot;output_file&quot;);</code></pre>

<h1 id="CONSTRUCTOR">CONSTRUCTOR</h1>

<dl>

<dt id="new-options"><b>new($options)</b></dt>
<dd>

<p>creates the template</p>

<pre><code>  $template = new Libconf::Templates::Generic::KeyValue({
                                                          filename =&gt; &#39;some_file&#39;,
                                                          separator_char =&gt; &#39;=&#39;,
                                                          output_separator_char =&gt; &quot;\t&quot;,
                                                          allow_space =&gt; 1,
                                                          comments_struct =&gt; [[&#39;#&#39;]],
                                                          handle_quote =&gt; 1,
                                                          simplify_quote =&gt; 0,
                                                          handle_multiples_lines =&gt; 0,
                                                          handle_backslash =&gt; 1,
                                                          backslash_character =&gt; &#39;\\&#39;,
                                                          accept_empty_value =&gt; 0,
                                                        })</code></pre>

<p><b>arguments</b></p>

<p>$options [<b>type</b> : HASH_REF] specifies the options to create the new template instance.</p>

<p><b>options</b></p>

<p>filename [<b>type</b> : STRING, <b>default</b> : &#39;&#39;] : the filename of the config file you want to work on. Can be read and written lately by using set_filename and get_filename.</p>

<p>separator_char [<b>type</b> : STRING, <b>default</b> : &#39;=&#39;] : the separator between key and value</p>

<p>output_separator_char [<b>type</b> : STRING, <b>default</b> : separator_char ] : the separator between key and value used to write the file back</p>

<p>allow_spaces [<b>type</b> : SCALAR, <b>default</b> : 1] : if true, space around <b>separator_char</b> are allowed and ignored if false, they are not allowed.</p>

<p>comments_struct [<b>type</b> : ARRAY_REF of ARRAY_REF of STRING,STRING,SCALAR, <b>default</b> : [[&#39;#&#39;]] ] : defines the type and the characters of comments. The structure is : [ [ comment1_open_char, comment1_close_char, comment1_nested 1], [ comment2_open_char, comment2_close_char, comment2_nested ], ... ]</p>

<ul>

<p>open_char [<b>type</b> : STRING, <b>default</b> : &#39;#&#39;] : the character(s) that delimits the start of a comment</p>

<p>close_char [OPTIONAL, <b>type</b> : STRING] : the character that delimits the end of the comment. If ommited, the comment stops at the end of the line</p>

<p>nested [OPTIONAL, <b>type</b> : SCALAR] : if true, comments of comments are nested.</p>

<p>Example 1, one simple line comment with character # : [[&#39;#&#39;]]</p>

<p>Example 2, one simple line comment with character #, another simple line comment with &#39;;&#39; character, and the common C /* */ comment : [[&#39;#&#39;], [&#39;;&#39;], [&#39;/*&#39;, &#39;*/&#39;]]</p>

<p>Example 3, the common C /* */ comment, the C++ // comment, and the nested ocaml (* *) : [[&#39;/*&#39;, &#39;*/&#39;], [&#39;//&#39;], [&#39;(*&#39;, &#39;*)&#39;, 1]]</p>

</ul>

<p>handle_quote [<b>type</b> : SCALAR, <b>default</b> : true] : if true, quotes are interpreted and removed from the value. When writing to the config file back, quotes are added if needed. if false, quotes are not interpreted, and present in the value.</p>

<p>simplify_quote [<b>type</b> : SCALAR, <b>default</b> : false] : if true, unneeded quotes are removed from the value. If not, they are kept as they were in the original file.</p>

<p>handle_multiples_lines [<b>type</b> : BOOLEAN, <b>default</b> : false] : if true, line that begins with a space character and that doesn&#39;t contain the separator_char, are taken as the continuation of the upper line</p>

<p>handle_backslash [<b>type</b> : BOOLEAN, <b>default</b> : false] : if true, line that ends with [backslash_character] are continued on the next line</p>

<p>backslash_character [<b>type</b> : STRING, <b>default</b> : \ ] : the character that is used by handle_backslash</p>

<p>accept_empty_value [<b>type</b> : BOOLEAN, <b>default</b> : true] : if true, lines where the value is not specified (like ``key=&#39;&#39;) are accepted, and the value is set to empty string. If set to false, such a line will trigger an error.</p>

<p>_input_function [<b>type</b> : FUNCTION_REF, <b>default</b> : undefined ] : if defined, it&#39;s used to parse. This function should behave as _parse_chunk. Don&#39;t use it unless you know it. See the source for more info about _parse_chunk</p>

</dd>
</dl>

<h1 id="GENERAL-METHODS">GENERAL METHODS</h1>

<p>See <a>Libconf::Templates</a> for the general list of methods you can call on this template.</p>

<h1 id="SPECIFIC-METHODS">SPECIFIC METHODS</h1>

<p>There is no specific method</p>


</body>

</html>