Text::Wigwam::Config
Text::Wigwam::Config - This module manages the configuration tag settings
All supported options classes must be specified during the construction
phase. This is done by calling the new
method with a list of class names
each followed by the desired preset parameters in the form of a hash
reference, or undef if no such parameters are required. References to
class names that were not declared during object construction will be
quietly ignored by all object methods.
my $Config = Text::Wigwam::Config->new(
class1 => { parm => 1 },
class2 => { parm => 2 },
class3 => undef,
)
inherit( class1, class2, ... )
-
The
inherit
method is used to set user-specified parameters for each class.
$Config->inherit (
class1 => \%class_1_parms,
class2 => \%class_2_parms,
class3 => \%class_3_parms,
)
confine( class1, class2, ... )
-
The confine method is used to confine classes' parameters to the current
Config object only. This method affects the way spawn works on a given
class. If a class has been confined, then that class' parameters are not
pass to child objects via the spawn method.
concede( class1, class2, ... )
-
By invoking the concede method, a class can be programmed to ignore any
preset parameters (as opposed to merging them) when inherited parameters
are defined.
promote( class1, class2, ... )
-
The promote method gives the specified classes' inherited settings
priority over config tag settings.
exclude ( class1 class2, ... )
-
The exclude method forces the parameters defined within the config
tag for the specified classes to be ignored when generating an options
hash via the get/store methods.
crank( class1, class2, ... )
-
The crank method is used to crank out an options hash from an ordered
list of classes arranged highest priority first. The resulting hash is
returned.
cache( name, class1, class2, ... )
-
The cache method functions much like crank except that the first
argument is used as a key for storing and retrieving the resulting hash.
Subsequent cache requests for the same name will be pulled from the
cache.
If only one parameter is passed to the cache method, that parameter is
used both as the name and class. The following examples are virtually
identical:
$Config->cache qw( name )
$Config->cache( name => qw( name ) )
parse_config( template, open_tag, term_tag )
-
The parse_config method is used to parse a template's configuration tag,
assuming it has one. All parameters of known option classes are stored
within the object's instance data, then the template text is returned
sans the configuration tag. Optionally, the config tag identifiers may
be specified as the second and third arguments.
$template = $Config->parse_config( $template, '<<', '>>' )
spawn
-
The spawn method is used to generate a copy of any given Config object
suitable for use by child templates. The new Config object inherits all
the config classes, attributes, and presets from the parent based on the
parent's preprogrammed rules.
my $child = $Config->spawn
$child->parse_config( $child_template )