Sophie

Sophie

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

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::Templates::Generic::KeyValue - Libconf generic low level template for semantic association styles config files</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>
	<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>

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

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Libconf::Templates::Generic::KeyValue - Libconf generic low level template for semantic association (KEY - VALUE) styles config files</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>Libconf::Templates::Generic::KeyValue is a generic template that handles config files that contain semantic informations of type : (KEY - VALUE).</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
 $template = new Libconf::Templates::Generic::KeyValue({
                                               filename =&gt; 'autologin',
                                               separator_char =&gt; '=',
                                               allow_space =&gt; 1,
                                               comments_struct =&gt; [['#']],
                                               handle_quote =&gt; 1,
                                               handle_multiples_lines =&gt; 0,
                                               handle_backslash =&gt; 1,
                                               backslash_character =&gt; '\\',
                                               accept_empty_value =&gt; 1,
                                              });
 $template-&gt;read_conf();
 $template-&gt;edit_atom(-1, {key =&gt; 'USER' }, { value =&gt; 'plop'});
 $template-&gt;edit_atom(-1, {key =&gt; 'AUTOLOGIN' }, { value =&gt; 'no'});
 $template-&gt;edit_atom(-1, {key =&gt; 'EXEC' }, { value =&gt; 'startx'});
 ...
 (see L&lt;Libconf::Templates&gt; for transformation methods on $template) ...
 ...
 $template-&gt;write_conf(&quot;output_file&quot;);</pre>
<p>
</p>
<hr />
<h1><a name="constructor">CONSTRUCTOR</a></h1>
<dl>
<dt><strong><a name="new" class="item"><strong>new($options)</strong></a></strong></dt>

<dd>
<p>creates the template</p>
<pre>
  $template = new Libconf::Templates::Generic::KeyValue({
                                                          filename =&gt; 'some_file',
                                                          separator_char =&gt; '=',
                                                          output_separator_char =&gt; &quot;\t&quot;,
                                                          allow_space =&gt; 1,
                                                          comments_struct =&gt; [['#']],
                                                          handle_quote =&gt; 1,
                                                          simplify_quote =&gt; 0,
                                                          handle_multiples_lines =&gt; 0,
                                                          handle_backslash =&gt; 1,
                                                          backslash_character =&gt; '\\',
                                                          accept_empty_value =&gt; 0,
                                                        })</pre>
<p><strong>arguments</strong></p>
<p>$options [<strong>type</strong> : HASH_REF] specifies the options to create the new template instance.</p>
<p><strong>options</strong></p>
<p>filename [<strong>type</strong> : STRING, <strong>default</strong> : ''] : 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 [<strong>type</strong> : STRING, <strong>default</strong> : '='] : the separator between key and value</p>
<p>output_separator_char [<strong>type</strong> : STRING, <strong>default</strong> : separator_char ] : the
separator between key and value used to write the file back</p>
<p>allow_spaces [<strong>type</strong> : SCALAR, <strong>default</strong> : 1] : if true, space around
<strong>separator_char</strong> are allowed and ignored if false, they are not allowed.</p>
<p>comments_struct [<strong>type</strong> : ARRAY_REF of ARRAY_REF of STRING,STRING,SCALAR,
<strong>default</strong> : [['#']] ] : 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>
<p>open_char [<strong>type</strong> : STRING, <strong>default</strong> : '#'] : the character(s) that delimits the start of a comment</p>
<p>close_char [OPTIONAL, <strong>type</strong> : 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, <strong>type</strong> : SCALAR] : if true, comments of comments are nested.</p>
<p>Example 1, one simple line comment with character # :
 [['#']]</p>
<p>Example 2, one simple line comment with character #, another simple line comment with ';' character, and the common C /* */ comment :
 [['#'], [';'], ['/*', '*/']]</p>
<p>Example 3, the common C /* */ comment, the C++ // comment, and the nested ocaml (* *) :
 [['/*', '*/'], ['//'], ['(*', '*)', 1]]</p>
<p>handle_quote [<strong>type</strong> : SCALAR, <strong>default</strong> : 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 [<strong>type</strong> : SCALAR, <strong>default</strong> : 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 [<strong>type</strong> : BOOLEAN, <strong>default</strong> : false] : if true, line
that begins with a space character and that doesn't contain the separator_char,
are taken as the continuation of the upper line</p>
<p>handle_backslash [<strong>type</strong> : BOOLEAN, <strong>default</strong> : false] : if true, line
that ends with [backslash_character] are continued on the next line</p>
<p>backslash_character [<strong>type</strong> : STRING, <strong>default</strong> : \ ] : the character that is
used by handle_backslash</p>
<p>accept_empty_value [<strong>type</strong> : BOOLEAN, <strong>default</strong> : true] : if true, lines
where the value is not specified (like ``key='') 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 [<strong>type</strong> : FUNCTION_REF, <strong>default</strong> : undefined ] : if defined,
it's used to parse. This function should behave as _parse_chunk. Don't
use it unless you know it. See the source for more info about _parse_chunk</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="general_methods">GENERAL METHODS</a></h1>
<p>See <a href="./Libconf/Templates.html">the Libconf::Templates manpage</a> for the general list of methods you can call on this
template.</p>
<p>
</p>
<hr />
<h1><a name="specific_methods">SPECIFIC METHODS</a></h1>
<p>There is no specific method</p>

</body>

</html>