YAML::Node (3)
Leading comments
Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) Standard preamble: ========================================================================
NAME
YAML::Node - A generic data node that encapsulates YAML informationSYNOPSIS
use YAML; use YAML::Node; my $ynode = YAML::Node->new({}, 'ingerson.com/fruit'); %$ynode = qw(orange orange apple red grape green); print Dump $ynode;
yields:
--- !ingerson.com/fruit orange: orange apple: red grape: green
DESCRIPTION
A generic node inYAML::Node is a class for generating and manipulating these containers. A
YAML::Node has a class method call new() that will return a ynode. You pass it a regular node and an optional type tag. After that you can use it like a normal Perl node, but when you YAML::Dump it, the magical properties will be honored.
This is how you can control the sort order of hash keys during a
YAML::Node exports a function called ynode(). This function returns the tied object so that you can call special methods on it like ->keys().
keys() works like this:
use YAML; use YAML::Node; %$node = qw(orange orange apple red grape green); $ynode = YAML::Node->new($node); ynode($ynode)->keys(['grape', 'apple']); print Dump $ynode;
produces:
--- grape: green apple: red
It tells the ynode which keys and what order to use.
ynodes will play a very important role in how programs use
The upcoming versions of
AUTHOR
Ingy do.t Net <ingy@cpan.org>COPYRIGHT
Copyright 2001-2014. Ingy do.t NetThis program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.