3.22. DirConfig

DirConfig allows you to batch-set a bunch of variables from files. The syntax:

DirConfig directive-name directory-glob

directive-name is usually Variable, but could be any hash-based directive. (No other standard directives currently make sense to set this way.)

directory-glob is a filespec that could encompass multiple directories. Files are ignored.

The directories are read for file *names* that contain only word characters, i.e. something that would be a valid Variable. (This alone might make it not suitable for other uses, but picking up the junk from the in-directory-backup-file people would be intolerable.)

Then the contents of the file is used to set the variable of the file name.

The source file name is kept in $Vend::Cfg->{DirConfig}{Variable}{VARNAME}, for use if dynamic_variables Pragma is set.

Pragma dynamic_variables enables dynamic updating of variables from files. Pragma dynamic_variables_files_only restricts dynamic variables to files only -- otherwise variables are dynamically read from the VarDatabase definition as well.

With dynamic variables, all @_VARIABLE_@ and __VARIABLE__ settings are checked first to see if the source file is defined. If there is a key present, even if its contents are blank, it is returned. Example -- in the case of this catalog.cfg entry:

        DirConfig Variable templates/foundation/regions

If the file NOLEFT_TOP is present at catalog config time, __NOLEFT_TOP__ will equal [include templates/foundation/regions/NOLEFT_TOP].