NAME

Content::YAML - Class to encode and decode YAML data to and from a HASH.

SYNOPSIS

Used in the same way as the placeholder class Content. See Content-class for more information.

DESCRIPTION

Class to encode and decode YAML data to and from a HASH. It uses the YAML::XS module to decode and encode to and from YAML data.

CONSTRUCTOR

new()

same as for the Content placeholder-class. See the Content-class for more information.

In addition it has the following parameter(s):

Returns an instance of the class if successful.

METHODS

encode()

Inherited from the Content-class, but in this case encodes a HASH into YAML data and returns the YAML data.

Input is the optional HASH reference to be encoded. If no HASH-reference is given, it will use the one internally to the Content-class and that are set by the set()-method.

It will return the YAML data upon success, undef upon failure. Please check the error()-method for more information.

decode()

Inherited from the Content-class, but in this case decodes YAML data into a Perl HASH. It sets the internal HASH to the decoded result upon success.

Input is a SCALAR with the YAML data. If no input is specified it will default to a blank string.

It returns a blank string upon success, undef upon failure. Check the error()-method for more information on the failure.