The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

buildconfig - Convert a subsectional configuration to hash strings

SYNOPSIS

 usage: buildconfig.pl [options] file
 

OPTIONS

 -t string            string identifier
 -h                   output usage
 -V                   version info

DATA FORMAT

INPUT

Overall

To gain knowledge on how the configuration principle works, you might have a look at the supplied user configuration. It is vital to understand, that the level (declared by $level) and the identifier (declared by $identifier) are essential factors on the creation of keys within a hash string.

Lines beginning with a leading # and no following $ are not essential for the parsing process, but keep the visual and cognitive structure upright.

Lines beginning with a leading # and a following $ are vital to the process of data parsing.

Lines beginning with alphanumeric characters equal key/value entries.

    # =============================
    # SECTION:          directories
    # =============================
    # INDEX:                    D.1
    # =============================
    #
    # Description:
    # °°°°°°°°°°°°
    # Includes paths concerning
    # your directories.
    #
    ########
    #$level=1
    #$identifier=dir
    #############

    #--------------------
    # Path: log directory
    #--------------------
    log = /var/log

An overall appearance of a section entry and assigned key/value entry.

Structure/Index
    # =============================
    # SECTION:          directories
    # =============================
    # INDEX:                    D.1
    # =============================

Classifies the section level (SECTION, SUBSECTION, SUBSUBSECTION), the identifier of the section, its index level which consists of the first capitalized character of the section identifer and an integer from 1 - 3.

  [ 1 = SECTION,
    2 = SUBSECTION,
    3 = SUBSUBSECTION ]
Section description
    # Description:
    # °°°°°°°°°°°°
    # Includes paths concerning
    # your directories.

A short section description.

Internal flags
    #$level=1
    #$identifier=dir

The flags which are of interest to the build script. $level sets the section level, $identifier sets an alphanumeric identifier.

Entry comment
    #--------------------
    # Path: log directory
    #--------------------
Key/Value
    log = /var/log

The value on the left side functions as key, while the the value on the right functions as value.

OUTPUT

Example

An example hash string will look as following:

    $Data{config}{dir}{log} = '/var/log';
Parsing process

The parsing process follows a sequentiell logic.

The structure tree

    | + Level - 1
    | ++ Level - 2
      --------------
    | + Level - 1
    | ++ Level - 2
    | +++ Level - 3
      --------------
    | + Level - 1

is valid, while

    | + Level - 1
    | +++ Level - 3

proves to be invalid.

Ascending in level deepness allows skipping of levels, whereas descending in level deepness requires that accordingly no level is skipped.

Hash string format

A "level 1" hash string:

    $Data{config}{dir}{log} = '/var/log';

A "level 2" hash string:

    $Data{config}{file}{system}{log} = '/etc/syslog.conf';

A "level 3" hash string:

    $Data{config}{file}{system}{user}{entries} = '/etc/master.passwd';

The last two values, in this case 'entries' & '/etc/master.passwd' correspond to the key & value pair, while the leading parts are determined by an internal CONSTANT ( $Data{config} ) and three subsequent level identifiers.

Classification
 internal CONSTANT:                  $Data{config}
 Level 1 - identifier:               file
 Level 2 - identifier:               system
 Level 3 - identifier:               user
 Key:                                entries
 Value:                              /etc/master.passwd

1 POD Error

The following errors were encountered while parsing the POD:

Around line 143:

Non-ASCII character seen before =encoding in '°°°°°°°°°°°°'. Assuming CP1252