Harvest::Config - configuration file parsing | |
| |
DESCRIPTION | |
Parse Harvest-NG configuration files. These files provide a means of defining nested key/value pairs, as follows. A key/value pair can be defined in the following ways Url: http://webharvest.sourceforge.net <Url> http://webharvest.sourceforge.net </Url> <Url urllist> <Url |urlprog> In the last two examples, the contents of the ``Url'' key are read from the file ``urllist'', and from STDOUT of urlprog, respectively.
| |
METHODS | |
| |
| $config=new Harvest::Config($format,$arg) | |
Create a new configuration object.
In addition,
| |
| $config->add($key,$value); | |
Add
| |
| $key=$config->key($internalkey) | |
Return the real value of a key given its internal representation
| |
| @keys=$config->keys | |
Returns the list of _internal_ keys stored in the configuration object. To get an external key (such as the one used when the data was originally entered) use the $config->key method described above.
| |
| @vals=$config->allvalues($key) | |
If there were multiple values for
| |
| @vals=$config->arrayvalue($key) | |
Return the value of
| |
| $config->check(@keys) | |
Check that the keys listed in the array are defined, and if not throw a die style exception.
| |
| $value=$config->value($key) | |
Return the data stored for the key $key.
| |
| $config->setdefault($key,@values) | |
Set a default value for a key. That is, the value will only be stored if data does not already exist for that key
| |
| $config->setvalue($key,@values) | |
Set the value of a key. This will overwrite any values already stored for the key, or create the key if no values are stored for it.
| |
| $config->write($file) | |
Write the current configuration information out to a file. Note that the acting of reading, then writing a configuration file is not idempotent, changes will result, especially when dealing with files that include other files.
| |
| $config->merge($cfg) | |
Merge the current Configuration object with the one contained in the Harvest::Config object $cfg. | |