Libconf::Templates::Generic::List - Libconf generic low level template for semantic association (VALUE0, VALUE1, ... VALUEn) styles config files
Libconf::Templates::Generic::List is a generic template that handles config files that contain semantic informations of type : (VALUE0, VALUE1, ... VALUEn).
my $template = new Libconf::Templates::Generic::List({ filename => 'some_file', comments_struct => [['#']], regexp => '^\s*(\S+?):(\S*?):(\S*?):(.*?)\s*$', output_function => sub { join(':', @{$atom->{list}} ) } }) $template->read_conf(); ... (see L<Libconf::Templates> for transformation methods on $template) ... $template_write_conf();
creates the template
$template = new Libconf::Templates::Generic::List({ filename => 'some_file', comments_struct => [['#']], regexp => '^\s*(\S+?):(\S*?):(\S*?):(.*?)\s*$', output_function => sub { join(':', @{$atom->{list}} ) } })
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 : undef ] : defines the type and the characters of comments. See the Libconf::Templates::Generic::Keyvalue manpage for more details
regexp [type : STRING, default : ''] : the regexp that is applied to each line
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.
_input_function [type : FUNCTION_REF, default : 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
See the Libconf::Templates manpage for the general list of methods you can call on this template.
There is no specific methods