NAME YAML::Object - Use OO to point to a yaml-node VERSION 0.05 SYNOPSIS use YAML::Object; # imports yaml_object() $yo = yaml_object($path_to_yaml_file); $complex = $yo->foo->bar->_2->a; $tmp1 = $yo->does_not_exist; # $tmp1 will be a YAML::Object $tmp2 = $tmp1->try_something; # will die() with message: YAML::Object: ->does_not_exist->try_something does not exist The first will succeed, to enable you to test if $tmp1 is undef: if(defined $tmp1) { ... } $tmp3 = $yo->some_hash; # returns a YAML::Object $tmp3->{'test'}; # will work, returns a "plain value" $tmp3->test; # same, but will returns a YAML::Object Both should behave the same way in your code. $index = 1; $tmp3 = $yo->some_array; # returns a YAML::Object $tmp3->[$index]; # will work, returns a "plain value" $tmp3->$index; # same result, but will return a YAML::Object $tmp3->_1; # same result as above The above should behave the same way in your code. EXPORTED FUNCTIONS yaml_object(string) Object constructor. Takes one argument, which can be either: * A filehandle to read YAML data from * A hash- or array-ref * A path to a file containing valid YAML * A string containing valid YAML Returns a "YAML::Object" object. METHODS All methods called, will map to an element in the YAML-tree or undef / throw error if not. With two exceptions: AUTOLOAD and import are in use in this package. OVERLOADING %{}, @{}, ${}, "", ... The object is overloaded to return the datatype you expect. The datatype returned is NOT an object, so you cannot continue calling methods on that. OBJECT STRUCTURE $self = sub {[ data, parent-object, key ]}; AUTHOR Jan Henning Thorsen, "" BUGS Please report any bugs or feature requests to "bug-yaml-object at rt.cpan.org". I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. COPYRIGHT & LICENSE Copyright 2007 Jan Henning Thorsen, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.