<?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::Sections - Libconf generic low level template for semantic association rules</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::Sections - Libconf generic low level template for semantic association (SECTION) rules</p> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p>Libconf::Templates::Generic::Sections is a generic template that handles config files that contain semantic informations of type : (SECTION).</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> $template = new Libconf::Templates::Generic::Section({ section_regexp => '^\s*\[([^\]]+)\]\s*$', section_output_function => sub { "[$_->[0]]" }, has_endsection => 0, endsection_regexp => '', endsection_output_function => '', comments_struct => [['#']], }); $template->read_conf(); ... (see L<Libconf::Templates> for transformation methods on $template) ... ... $template->write_conf("output_file");</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::Section({ section_regexp => '^\s*\[([^\]]+)\]\s*$', section_output_function => sub { "[$_->[0]]" }, has_endsection => 0, endsection_regexp => '', endsection_output_function => '', comments_struct => [['#']], });</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>section_regexp [<strong>type</strong> : STRING, <strong>default</strong> : '^\s*\[([^\]]+)\]\s*$'] : the regexp that is applied to determine if a line is a section start. $1 has to be the section name.</p> <p>section_output_function [<strong>type</strong> : FUNCTION_REF, <strong>default</strong> : sub { "[$_->[0]]" } ] : the code to be applied to a section atom, to generate the line to output. It takes in arguments the name of the section, the atom structure, and $parser_env, the parser environment variable. It should return the line to be written</p> <p>has_endsection [<strong>type</strong> : BOOLEAN, <strong>default</strong> : 1] : if true, section have both start and end tag. If false, a section is considered to end where another section begins, or at the end of the file</p> <p>endsection_output_function [<strong>type</strong> : FUNCTION_REF, <strong>default</strong> : sub { '' } ] : the code to be applied to a section atom, to generate the end section line to output. It takes in arguments the name of the section, the atom structure, and $parser_env, the parser environment variable. It should return the line to be written</p> <p>endsection_regexp [<strong>type</strong> : STRING, <strong>default</strong> : ''] : the regexp that is applied to determine if a line is a end of a section.</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. See <a href="./Libconf/Templates/Keyvalue.html">the Libconf::Templates::Keyvalue manpage</a> for additional details on it</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>