man ConfHelper () - Configuration file management

NAME

ConfHelper - Configuration file management

SYNOPSIS

  use ConfHelper;
  $file = new ConfHelper('myprogram', '/etc/myprogram.conf');

DESCRIPTION

ConfHelper is a module that is designed to help you edit configuration files in an automated way without trampling on the toes of users or other programs. It does this by using chunking; that is, your program modifies a certain chunk of the config file and does not touch everything else. While this approach is not appropriate everywhere, it can be remarkably useful anyway.

The methods that return a chunk of data (an entire configuration area) return an array. Each element in the array is a single line that has been run through chomp(). When passed back to set() functions, the newline character is added back on before being written to disk.

METHODS

Creates a new object. The package parameter declares the name of your program or package, and the filename parameter specifies the name of the configuration file.

getversion
Returns the version of the ConfHelper module that created the object. Sets a configuration variable. The following are valid configuration variables:
startline
Specifies the complete text of the line that is used to identify the start of the ConfHelper section of your config file.
endline
Specifies the complete text of the line that is used to identify the end of the ConfHelper section of your config file.
hasconfarea
Returns 1 if the file has a configuration area, and 0 otherwise.
getconfarea
Returns your configuration area from the configuration file as a large array. If there is none, it returns undef.
getotherareas
Returns an array that represents all non-ConfHelper areas of your configuration file.
setconfarea(@confarea)
This method will set the configuration area to the value of the string passed as a parameter. ConfHelper will automatically rotate the file, saving backups of it.
setotherarea_DANGEROUS(@otherarea)
Sets the non-confarea portion of the file to the value specified. NOTE: THIS FUNCTION IS DANGEROUS AND SHOULD NOT BE USED UNLESS ABSOLUTELY NECESSARY! The configuration file is NOT rotated when this call is used.

AUTHOR

John Goerzen <jgoerzen@progenylinux.com> of Progeny Linux Systems http://www.progeny.com.

COPYRIGHT

Copyright (C) 2000 Progeny Linux Systems, Inc. Written by John Goerzen <jgoerzen@progenylinux.com>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

SEE ALSO