NAME

Libconf::Templates::Generic::Value - Libconf generic low level template for semantic (VALUE) styles config files

DESCRIPTION

Libconf::Templates::Generic::Value is a generic template that handles config files that contain semantic informations of type : (VALUE).

SYNOPSIS

$template = new Libconf::Templates::Generic::Value({
                                              filename => 'some_filename',
                                              regexp => '^\s*(\S+)\s*$',
                                              comments_struct => [['#']],
                                              output_function => sub { my ($atom) = @_; 'val : ' . $atom->{value} }
                                             });
$template->read_conf();
$template->edit_atom(-1, { value => 'foo' }, { value => 'foo' });
$template->edit_atom(5, { value => 'some value' });
...
(see L<Libconf::Templates> for transformation methods on $template) ...
...
$template->write_conf("output_file");

CONSTRUCTOR

new($options)

creates the template

$template = new Libconf::Templates::Generic::Value({
                                                    filename => 'some_file',
                                                    regexp => '^\s*(\S+)\s*$',
                                                    comments_struct => [['#']],
                                                    output_function => sub { my ($atom) = @_; 'val : ' . $atom->{value} }
                                                   })

arguments

$options [type : HASH_REF] specifies the options to create the new template instance.

options

filename [type : STRING, default : ''] : the filename of the config file you want to work on. Can be read and written lately by using set_filename and get_filename.

comments_struct [type : ARRAY_REF of ARRAY_REF of STRING,STRING,SCALAR, default : [['#']] ] : defines the type and the characters of comments. See Libconf::Templates::Keyvalue for additional details on it

regexp [type : STRING, default : ''] : the regexp that is applied to each line. It should catch something, that will be stored as the value

output_function [type : FUNCTION_REF, default : sub {} ] : the code to be applied to an atom, to generate the line to output. It takes in arguments the atom

GENERAL METHODS

See Libconf::Templates for the general list of methods you can call on this template.

SPECIFIC METHODS

There is no specific method