Config::Maker::Type - describe directive type
use Config::Maker my $type = Config::Maker::Type->new( name => $name, format => [$typespec => @valuespec], children => \@children, contexts => \@parents, checks => [$check => $path, ...], actions => \@actions ) $type->add($othertype); $othertype->addto($type); $type->addchecks(@checks)
Config::Maker::Type describe available types of options (and metaconfig options). Each type has 5 parameters. These are:
The name of the directive. This is the keyword used in config to specify option of this type.
This is a listref, that is passed to the
body production in Config::Maker::Grammar. The first element is either
anon_group, to mean option without block, option with value and block and option with only a block respectively. For the first two, rest of the list is passed to the
value production of the grammar.
This is a list of types, that should be recognized in the body of this type. Parser won't recognize other types when parsing body of this type.
This is a list of keyword-path pairs, that specify how many of different subtypes can appear in an option of this type. The keys may be
any, which mean the following path must have no, at most one, exactly one, at least one and any number of matches respectively. An error is reported when those conditions are not met.
This is a list of perl closures, that shall be invoked when option of this type is parsed. It can do whatever it wants.
The constructor takes these five named arguments and one extra,
contexts. The new element is added to those types as a child.
In addition to constructor, there are three methods,
addchecks. These allow to add children, parents and checks to an already constructed type.
For description how types are constructed from the schema in metaconfig see configit(1).
There are two special types,
*, accessible through class methods
/ special type represents the top-level of a config or metaconfig file. On top-level, only option types added to this special type are recognized.
* special type is a repository of types. It is used in schema to store types for reuse.
Jan Hudec <email@example.com>
Copyright 2004 Jan Hudec. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
configit(1), perl(1), Config::Maker(3pm).