NAME

Libconf::Templates::Shell - Libconf low level template for shell styles config files


DESCRIPTION

Libconf::Templates::Shell is a template that handles the files that contain 'shell like' informations.


SYNOPSIS

 my $template = new Libconf::Templates::Shell({ filename => 'some_file' });
 $template->read_conf();
 ...
 (see L<Libconf::Templates> for transformation methods on $template)
 ...
 $template_write_conf();


CONSTRUCTOR

new($options)

creates the template

  $template = new Libconf::Templates::Shell({
                                                filename => 'some_file',
                                           })
  $template = new Libconf::Templates::Shell({
                                                filename => 'some_file',
                                                shell_style => 'true_bash',
                                                shell_command => '/bin/bash',
                                                export_line => 1,
                                                export_only_defined => 1,
                                           })

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.

shell_style [type : STRING, default : 'sh', values: 'sh', 'csh','true_bash'] : specifies the shell type syntax to use. If 'sh' is used, the key=value is used, if 'csh' is used, the setenv key value is used. An example to transform a sh style config file to a csh one :

 my $template = new Libconf::Templates::Shell({ filename => 'some_file' });
 $template->read_conf();
 $template->{shell_style} = 'csh';
 $template_write_conf();

If 'true_bash' is used, then the template will call the shell binary to interpret the values. If 'true_bash' is set, then 'shell_command' has to be set also

shell_command [type : STRING] : required if shell_style is set to true_bash. This will be used to call the shell binary. Examples : shell_command => '/bin/bash'. It will be used to interpret the values. It is useful when the values uses special bash command (like variable evaluation)

export_line [type : BOOLEAN, default : 0 ] : if true, and if applicable (shell_style = sh), a line will be added at the beginning of the file to export the defined variables in the file, like :

 export http_proxy ftp_proxy

export_only_defined [type : BOOLEAN, default : 1 ] : if true, and if export_line is true, the added line will export only non void variables. If false, the added line will export all variables, even if they are void.


GENERAL METHODS

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


SPECIFIC METHODS

There is no specific method