NAME
CAD::Firemen::Load - Module to parse files from Firemen (like pro and cdb files)
VERSION
version 0.5.0
METHODS
loadConfig
Loads the given config file and returns an array as described below. As parameter it expacts the URL to the config file which should be loaded.
$results = { "OPTION_ONE" => { "1" => "VALUE_OF_OPTION_ONE_IN_LINE_1", "2" => "VALUE_OF_OPTION_ONE_IN_LINE_2" }, "OPTION_TWO" => { "12" => "VALUE_OF_OPTION_TWO_IN_LINE_12" } };
$errors = {
"1" => "Error description for line 1",
"12" => "Error description for line 12"
};
return ($results, $errors, PARSED_LINES);
loadCDB
The function loads a CDB file and returns the result as a hash like shown below.
Expacts the URL to the cdb file which should be loaded as first parameter.
Result:
# since in cdb, the option should be present ones, the line number
# is only mentioned to be compatible to the output format of
# loadConfig()
$results = {
"OPTION_ONE" => {
1 => {
"YES" => 0,
"NO" => 1
}
},
"OPTION_WITHOUT_DEFAULT_VALUE" => {
2 => {
"VALUE1" => 0,
"VALUE2" => 0,
"VALUE3" => 0
}
}
};
$errors = {
"1" => "Error description for line 1",
"12" => "Error description for line 12"
};
return ($results, $errors)
loadDatabase
Loads the options from given database and returns the same structure as descriped at loadCDB(). But it adds a third hash reference to the return vector, which contains descriptions (values) for the options (keys).
It needs the database handle as first parameter and the SQL query string, which should be used to find options as second parameter.
__extractParameters FOR INTERNAL USE ONLY!
Returns an array with possible values for the actual option. Requires a valied file handler as first parameter.
AUTHOR
Joachim Langenbach <langenbach@imw.tu-clausthal.de>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 by TU Clausthal, Institut fuer Maschinenwesen.
This is free software, licensed under:
The GNU General Public License, Version 2, June 1991