GT::MetaInfo - keep various meta informations
This object is used to gather meta informations of different kinds applying to various objects (state of a trading system, history of order, support & resistance of prices, top & bottom prices on a period, lines drawn on a graph, ...). It stores various informations in an internal XML structure that can be stored in a file and reloaded later.
Informations are stored on a key/value basis. Key is a path in an XML DOM tree (/ is the separator like for xpath expressions). Several values can be stored in a single key if you use attributes to distinguish them.
my $info = GT::MetaInfo->new;
Create a new empty GT::MetaInfo object.
$info->set($key, $value, { "attrname" => "attrvalue" });
Stores $value corresponding to $key with an attribute ``attrname'' (whose value is ``attrvalue''). The third parameter is optional if you don't need attributes for this key.
If the key already existed, then the value is replaced.
$info->get($key, { "attrname" => "attrvalue" });
Get the value corresponding the $key and the attributes indicated in the second optional argument.
my @list = $info->list($key, { "attrname" => "attrvalue" });
List all the set of attributes available for elements corresponding to the $key. You can eventually restrict the list to a subset og them by specifying one or more attributes.
Each element of @list is a hash describing the attributes. If you want the value of that node you have to use $info->get(...).
$info->save("/path/to/file.xml")
Save the current GT::MetaInfo object in the given XML file. All values previously set can be reloaded later with $info->load(...).
$info->dump
Output the current internal XML file to the standard output. Useful for debug purposes.