NAME

Venus::Yaml - Yaml Class

ABSTRACT

Yaml Class for Perl 5

SYNOPSIS

package main;

use Venus::Yaml;

my $yaml = Venus::Yaml->new(
  value => { name => ['Ready', 'Robot'], version => 0.12, stable => !!1, }
);

# $yaml->encode;

DESCRIPTION

This package provides methods for reading and writing YAML data. Note: This package requires that a suitable YAML is installed, currently either YAML::XS 0.67+, YAML::PP::LibYAML 0.004+, or YAML::PP 0.23+.

ATTRIBUTES

This package has the following attributes:

decoder

decoder(CodeRef)

This attribute is read-write, accepts (CodeRef) values, and is optional.

encoder

encoder(CodeRef)

This attribute is read-write, accepts (CodeRef) values, and is optional.

INHERITS

This package inherits behaviors from:

Venus::Kind::Utility

INTEGRATES

This package integrates behaviors from:

Venus::Role::Accessible

Venus::Role::Explainable

METHODS

This package provides the following methods:

decode

decode(Str $yaml) (Any)

The decode method decodes the YAML string, sets the object value, and returns the decoded value.

Since 0.01

decode example 1
# given: synopsis;

my $decode = $yaml->decode("codename: ['Ready','Robot']\nstable: true");

# { codename => ["Ready", "Robot"], stable => 1 }

encode

encode() (Str)

The encode method encodes the objects value as a YAML string and returns the encoded string.

Since 0.01

encode example 1
# given: synopsis;

my $encode = $yaml->encode;

# "---\nname:\n- Ready\n- Robot\nstable: true\nversion: 0.12\n"

AUTHORS

Cpanery, cpanery@cpan.org

LICENSE

Copyright (C) 2021, Cpanery

Read the "license" file.