cs::Hier - manipulate data hierachies
use cs::Hier;
This module transcribes and manipulates data structures.
Return a textual representation of a data structure references by ref. useindent is an optional parameter indicating whether to generate multiline indented text or single line text, defaulting to 1.
Transcribe the data structure references by ref to the cs::Sink sink. useindent is an optional parameter indicating whether to generate multiline indented text or single line text, defaulting to 1.
Prepend the supplied logline string to the CHANGELOG field of the hash referenced by hashref. The optional argument fieldname may be supplied to override the default ``CHANGELOG'' field name.
Set the specified field of the hash referenced by hashref to the new value newvalue. If the field is not the changelog and the old value and the new value differ, prepend a changelog entry to the field ``CHANGELOG''. The optional argument fieldname may be supplied to override the default ``CHANGELOG'' field name.
Read a single key-value entry from the cs::Source source, returning a reference to an array of (key, value). noparse indicates whether to defer parsing the value, defaulting to 0. If noparse is set then the textual representation of the value is returned as value, otherwise the line is parsed and the actual value returned. If trace is supplied, lines are printed to stderr as they are read; trace defaults to 0. On EOF or error returns the string EOF or ERROR, respectively, instead of the arrayref.
Transcribe key and value to the cs::Sink as a multiline indented transcription.
Convert the text to a reference to a data structure. Return the reference in a scalar context, or an array of the reference and any unparsed text in an array context.
Load a hash from a cs::Source source. If source is not an object reference consider it a filename and open it. Return a hashref.
Write the hashref to the cs::Sink sink. if sink is not an object reference consider it a filename and try to open it. Returns undef on error or the number of keys written (which may be zero) on success.
Transcribe the hash to a file, run an editor, return the modified hash.
Recursively remove empty hashes and arrays from a data structure.
Compare two data structures for equality by value. Returns 0 if they are identical and a signed value to indicate difference (for use with the sort operator).
Return a complete duplicate of some value. Note that any class blessing is lost.
Compare two hashrefs at the top level and return a hashref loosely describing the differences. The resulting hashref has undef for fields which were in old and are not in new and the value from new for fields which are in new and not in old or in new and differ from the value in old.
Apply the changes returned from diff above to the record old.
cs::Source(3), cs::Sink(3)
Cameron Simpson <cs@zip.com.au>