WE::Util::Support - support functions for the WE::DB framework
use WE::Util::Support;
Create a folder tree from file or string.
Options are:
The string with the folder information.
A file with the folder information. Either -string or -file have to exist.
The root object id to put the top-most folder in. If missing, then the root obejct of the database will be used.
Add standard arguments for each created object. The standard arguments will be overwritten by the arguments in the folder information string/file.
The file or string should contain a list of attributes, prefixed with a "-" and their values. All keys and values should be separated by spaces. To mask spaces in attribute values, just use double quotes. The folder structure is controlled by indentation, that is, top-level folder are not indented, the second-level folders have one space indentation and so on.
For the Title attribute, there is an exception to handle language dependent strings: the first two letters should form the ISO 638 code for the language, followed by a colon, followed by the language dependent string. You can specify as many language strings as you like. If you do not need language dependent Title strings, then just use this attribute as the others.
Examples for Title:
-Title "language independent string" -Name a_name -Title "en:english" "de:german" "it:italian" -Name b_name
For the parent collection $p_id the children will be sorted according to the array reference @child_ids. Children of $p_id which are not in @child_ids will be put to the back. Throws an error if one of @child_ids is not a child of $p_id.
$p_id
@child_ids
For a given object $obj_id, return an array with the positions of this object in its parent, and the positions of all predecessors.
$obj_id
The following options are recognized for %args:
%args
$base
The positions are by default 0-based, but can be changed with the optional argument $base.
$sub
Specify an optional filter for the recursion process. The filter options should be a reference to a subroutine. This subroutine is called with two arguments: the object database reference and the id of an object to test. If the object should be included into the position counting, then 1 should be returned, otherwise 0.
$bool
If true, then the IndexDoc attribute is used for determining the document position.
Note that only the first parent is used, if there are objects with multiple parents.
Return a WE::DB::Obj::Fsck object with lists of inconsistencies in the WE::DB::Obj database.
WE::DB::Obj::Fsck
WE::DB::Obj
Take a WE::DB::Obj::Fsck object with lists of inconsistencies and tries to repair the WE::DB::Obj database. %args may be:
Be verbose if set to a true value.
Return a WE::DB::Content::Fsck object with lists of inconsistencies in the WE::DB::Content database. The check is done against the WE::DB::Obj database $objdb.
WE::DB::Content::Fsck
WE::DB::Content
$objdb
Take a WE::DB::Content::Fsck object with lists of inconsistencies and tries to repair the WE::DB::Content database. %args may be:
Slaven Rezic - slaven@rezic.de
To install WE::DB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WE::DB
CPAN shell
perl -MCPAN -e shell install WE::DB
For more information on module installation, please visit the detailed CPAN module installation guide.