NAME
Zoidberg::PdParse - parses Zoidbergs config files
SYNOPSIS
use Zoidberg::PdParse;
$Zoidberg::PdParse::base_dir = $my_config_dir;
my $config_hash_ref = pd_read('my_config_file.pd');
ABSTRACT
This module parses Zoidbergs config files.
DESCRIPTION
The Zoidberg object and some Zoidberg plugins inherit from this object to read and write config files. The format used is actually output of Data::Dumper. We give these files the extension ".pd" this means "Perl Dump". These files can contain all kinds of code that will be executed in a eval() function. There should be assigned a $VAR1 (as done by Data::Dumper output) preferrably this should be a hash reference.
EXPORT
@EXPORT = qw/pd_read pd_write pd_merge/;
@EXPORT_OK = qw/pd_read_multi pd_forget/;
( This module modifies the global settings of Data::Dumper )
METHODS
- pd_read($file_name, $pre_eval)
-
Returns the contents of single file as a hash ref. $pre_eval can contain perl code as a string, this code will be evalled in the same scope as the config file. This can for example be used to allow variables in the config file.
This function caches read files, use pd_forget to flash cache. Due to this cache loops between files should not be a problem.
- pd_read_multi(@file_names)
-
Returns a merge of the contents of array files as hash ref. Can also be called as pd_read_multi([@file_names], @options) in this case @options is passed on to pd_read
- pd_write($file, $hash_ref)
-
Dump the contents of $hash_ref to $file. Retuns 1 on succes.
- pd_merge(@hash_refs)
-
Merges @hash_refs to single ref. This is for example used to let multiple config files overload each other. The last array element is the last processed, and thus in case of overloading the most specific.
- pd_forget
-
Forget read files.
AUTHOR
R.L. Zwart, <carlos@caremail.nl> Jaap Karssenberg || Pardus [Larus] <j.g.karssenberg@student.utwente.nl>
Copyright (c) 2002 Raoul L. Zwart. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
http://zoidberg.sourceforge.net.