Data::Object::Yaml
Data-Object Yaml Class
use Data::Object::Yaml; my $yaml = Data::Object::Yaml->new; my $data = $yaml->from($arg);
Data::Object::Yaml provides methods for reading and writing YAML data.
This package implements the following methods.
dump(HashRef $arg1) : Str
The dump method converts a data structure into a YAML string.
# given $yaml my $string = $yaml->dump($data); # '--- {name: ...}'
file() : Object
The file method returns a Data::Object::Path object for the given file.
# given $yaml my $path = $yaml->file($file); # ...
from(Any $arg1) : Any
The from method calls dump or load based on the give data.
dump
load
# given $yaml my $data = $yaml->from($string); # {,...} my $string = $yaml->from($data); # '--- {foo: ...}'
load(Str $arg1) : HashRef
The load method converts a string into a Perl data structure.
# given $yaml my $data = $yaml->load($string); # {,...}
origin() : Str
The origin method returns the package name of the underlying YAML library used.
# given $yaml my $origin = $yaml->origin(); # YAML::Tiny
read(Str $arg1) : HashRef
The read method reads YAML from the given file and returns a data structure.
# given $yaml my $data = $yaml->read($file); # {,...}
space() : Object
The space method returns a Data::Object::Space object for the origin.
origin
# given $yaml my $space = $yaml->space(); # YAML::Tiny
writes(Str $arg1, HashRef $arg2) : Str
The write method writes the given data structure to a file as a YAML string.
# given $yaml my $string = $yaml->write($file, $data); # ...
To install Data::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Object
CPAN shell
perl -MCPAN -e shell install Data::Object
For more information on module installation, please visit the detailed CPAN module installation guide.