PerlDoc

26 August 2025 - 17:41 | Version 1 |
See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview


Parent package: Foswiki::Configure
Child packages:

    internal package Foswiki::Configure::Query

    Methods used to query and manipulate the configuration spec.

    Contract

    All the methods take two parameters; a parameter hash, and a reporter. The parameter hash is described for each method, as is the return value, which is always a perl reference.

    All methods return undef if they fail badly. $reporter→ERROR is used to describe fatal errors to the caller.

    The $reporter should be clear before calling any of these methods, as existing errors in the reporter will be detected as fatal errors and cause the method to fail.

    StaticMethod getcfg(\%params, $reporter) → \%response

    Retrieve for the value of one or more keys. \%params may include If there isn't at least one key parameter, returns the entire configuration hash. Values are returned unexpanded (with embedded $Foswiki::cfg references intact.)

    The result is a hash containing that subsection of %Foswiki::cfg that has the keys requested.

    Search headlines and keys for a fragment of text. The response gives the path(s) to the item(s) matched in an array of arrays, where each entry is a single path.

    Searches are case-sensitive.

    StaticMethod getspec(\%params, $reporter) → \%response

    Use a search to find a configuration item spec. \%params may include: Only exact matches are supported.

    For example, { 'get': {'headline':'Store'}} will retrieve the entire spec subtree for the section called 'Store'.

    { 'get' : {'keys' : '{Store}{Implementation}'}} will retrieve the spec for that one entry. You cannot pass a list; if you require the spec for a subsection, retrieve the section title.

    { 'get' : { 'parent' : {'headline' : 'Something'}, 'depth' : 0} will return all specs within the section named Something.

    The response is a reference to the spec subtree. Note that this will contained blessed hashes.

    StaticMethod check_current_value(\%params, $reporter) → \@response

    Runs the server-side check-current_value checkers on a set of keys. The keys to be checked are passed in as key-value pairs. You can also pass in candidate values that will be set before any keys are checked.

    The results of the check are reported in an array where each entry is a hash with fields keys and reports. reports is an array of reports, each being a hash with keys level (e.g. warnings, errors), and message.

    NOTE check_dependencies will look into the values of other keys for $Foswiki::cfg references, for example into the entries in a PERL hash. If a dependency is found, the closest checkable entity (i.e. the PERL key) will be checked, and not the subkey.

    StaticMethod wizard(\%params, $reporter) → \%response

    Call a configuration wizard.

    Configuration wizards are modules that support complex operations on configuration data; for example, auto-configuration of email and complex and time-consuming integrity checks.

    If the wizard method returns an object, that will be passed back as the result of the call. If the wizard method returns undef, the return result is a hash containing the following keys: * report - Error/Warning etc messages, formatted as HTML. Each entry in this array is a hash with keys 'level' (e.g. error, warning) and 'message'.