NAME

Config::Maker::Eval - Environment to run user-code in Config::Maker

SYNOPSIS

# In perl-code in metaconfig, config or template

Get($path)
Get($path, $default)
Get1($path)
Get1($path, $default)
Value($path_or_option)
Type($path_or_option)
Exists($path)
Unique($path)
One($path)

DESCRIPTION

All user code executed by Config::Maker, whether read from metaconfig, config or template, is executed in Config::Maker::Eval package. In that package, following convenience functions are available. Note, that when relative path is specified to any of them, it is resolved relative to the current topic ($_). Thus it must contain a config element.

Get($path, [$default])

Resolves $path and returns list of results, or the first result in scalar context. If $default is given, and the path does not match, $default is returned.

Get1($path, [$default])

Resolves path and returns the result. If there is more than one result, or if the path does not match and no default is given, throws an error.

Value($path_or_option)

Returns value of config element or matching path (exactly one must match). If no arguments given, returns value of $_.

Type($path_or_option)

Returns type of config element or matching path (exactly one must match). If no arguments given, returns type of $_.

Exists($path)

Returns true iff $path matches at least one config element.

Unique($path)

Returns true iff $path matches at most one config element.

One($path)

Returns true iff $path matches exactly one config element.

AUTHOR

Jan Hudec <bulb@ucw.cz>

COPYRIGHT AND LICENSE

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.

SEE ALSO

configit(1), perl(1), Config::Maker(3pm).