none
[openafs-wiki.git] / TWiki / TWikiConfigureLoadDotPm.mdwn
1 # <a name="Package &lt;code&gt;TWiki::Configure::Load="></a> Package =TWiki::Configure::Load
2
3 ## <a name="Purpose"></a> Purpose
4
5 This module consists of just a single subroutine `readConfig`. It allows to safely modify configuration variables _for one single run_ without affecting normal TWiki operation.
6
7 <div>
8   <ul>
9     <li><a href="#Package =TWiki::Configure::Load="> Package TWiki::Configure::Load</a><ul>
10         <li><a href="#Purpose"> Purpose</a></li>
11         <li><a href="#StaticMethod <strong>readConfig</strong> ()"> StaticMethod readConfig <tt>()</tt></a></li>
12         <li><a href="#StaticMethod <strong>expandValue</strong> ($str"> StaticMethod expandValue <tt>($string) -&gt; $boolean</tt></a></li>
13         <li><a href="#StaticMethod <strong>readDefaults</strong> () -"> StaticMethod readDefaults <tt>() -&gt; \@errors</tt></a></li>
14       </ul>
15     </li>
16   </ul>
17 </div>
18
19 ## <a name="StaticMethod &lt;strong&gt;readConfig&lt;/strong&gt; ()"></a> [[StaticMethod]] **readConfig** `()`
20
21 In normal TWiki operations as a web server this routine is called by the `BEGIN` block of `TWiki.pm`. However, when benchmarking/debugging it can be replaced by custom code which sets the configuration hash. To prevent us from overriding the custom code again, we use an "unconfigurable" key `$cfg{ConfigurationFinished}` as an indicator.
22
23 Note that this method is called by TWiki and configure, and **only** reads TWiki.spec= to get defaults. Other spec files (those for extensions) are **not** read.
24
25 The assumption is that `configure` will be run when an extension is installed, and that will add the config values to [[LocalSite]].cfg, so no defaults are needed. TWiki.spec is still read because so much of the core code doesn't provide defaults, and it would be silly to have them in two places anyway.
26
27 ## <a name="StaticMethod &lt;strong&gt;expandValue&lt;/strong&gt; ($str"></a> [[StaticMethod]] **expandValue** `($string) -> $boolean`
28
29 Expands references to TWiki configuration items which occur in the value of other configuration items. Use expand($hashref) if the item is not a plain scalar.
30
31 Happens to return true if something has been expanded, though I don't know whether you would want that. The replacement is done in-place,
32
33 ## <a name="StaticMethod &lt;strong&gt;readDefaults&lt;/strong&gt; () -"></a> [[StaticMethod]] **readDefaults** `() -> \@errors`
34
35 This is only called by `configure` to initialise the TWiki config hash with default values from the .spec files.
36
37 Normally all configuration values come from [[LocalSite]].cfg. However when `configure` runs it has to get default values for config vars that have not yet been saved to `LocalSite.cfg`.
38
39 Returns a reference to a list of the errors it saw.
40
41 SEE ALSO: TWiki::Configure::TWikiCfg::load