NAME

MetadataCollection - A class to convert a collection of metadata that belongs together from/to hashes, metadata and templates.

SYNOPSIS

use MetadataCollection;

# instantiate
my $mc=MetadataCollection->new();

# get metadata hash from hash
my $md=$mc->hash2Metadata($hash);

# get hash from metadata
my $hash=$mc->metadata2Hash($metadata);

# get hash from template
my $hash=$mc->template2Hash($template);

# merge/inherit values from several hashes
my $result=$mc->mergeHash($hash1,$hash2,$hash3...$hashn);

DESCRIPTION

A class to convert a collection of AURORA database metadata that belongs together from/to hashes, metadata and templates.

Please see the AURORA-system documentation for information on metadata format.

CONSTRUCTOR

new()

Instantiates the StoreCollection-class.

It takes the following parameters

Returns the instantiated class.

METHODS

hash2Metadata()

This method turns the hash-format version of AURORA database metadata (see DESCRIPTION).

Input is a hash reference to the structure to convert into a metadata structure. Optional second input is the "depth"-parameter that specifies the maximum depth that the method will allow in the HASH (everything below is ignored in the conversion).

When converting the HASH into metadata, the base specified to the class is added to the keys.

It returns a metadata hash reference upon success, undef upon failure. Please check the error()-method for more information on a potential error.

metadata2Hash()

This method converts an AURORA metadata hash into a HASH structure (see DESCRIPTION).

It takes a AURORA metadata hash reference as input.

When converting the metadata into a HASH, the base specified to the class is removed from the keys first.

The method returns the hash-format reference upon success, undef upon failure. Please check the error()-method upon any failure.

template2Hash()

This method converts a template metadata as returned from AuroraDB into a hash-format structure.

It takes the template hash-reference from AuroraDB as input.

The method works similarily to the metadata2Hash()-method. See that method for more information. Instead of that method it takes the "default"-setting of the template and sets it as values for the keys.

It returns the finished converted hash or undef upon failure. Please check the error()-method upon failure.

mergeHash()

This method merges two or more hash-format references into one hash.

It takes any number of hash-reference as input in the form of a hash reference LIST.

It returns a resulting hash-reference to a hash-format structure upon success, undef upon failure. Please check the error()-method for more information upon failure.

base()

This method returns or sets the AURORA database metadata base namespace for the metadata-collection used by this module for conversion. See the "base" option in the new()-method for more information.

Upon set takes the base namespace as parameter (SCALAR). Upon get it takes no parameters.

Returns the base namespace as a SCALAR.

depth()

Get or set the depth setting of the instance.

If input is specified it is assumed to be as set and if the value specified is a number it is saved as the new depth-setting for the instance.

If no input is specified it is assumed to be a get-operation and the current depth- setting of the instance is returned.

error()

Returns the last error, if any.

No input taken.

Returns a SCALAR with the error message if any (blank if none).