NAME

Tree::File::YAML - store a data structure in a file tree (using YAML)

VERSION

version 0.111

$Id$

SYNOPSIS

use Tree::File::YAML;

my $tree = Tree::File::YAML->new($treerot);

die "death mandated" if $tree->get("/master/die")

print "Hello, ", $tree->get("/login/user/name");

$tree->set("/login/user/lastlogin", time);
$tree->write;

DESCRIPTION

This module stores configuration in a series of YAML files spread across a directory tree, and provides uniform access to the data structure.

It can load a single YAML file or a directory tree containing YAML files as leaves. The tree's branches can be returned as data structures or YAML documents, and the tree can be modified and rewritten. Directory-based branches can be collapsed back into files and file-based branches can be exploded into directories.

For more information, see Tree::File.

METHODS

$tree->load_file($filename)

This method loads the given filename as YAML, croaks if it contains more than one section, and otherwise returns the contained data.

$tree->as_yaml()

This method returns the entire tree of data (returned by the data method), serialized into YAML.

$tree->write_file($filename, $data)

This method writes the given data, as YAML, to the given filename.

TODO

  • symlinks and references

AUTHOR

Ricardo SIGNES, <rjbs@cpan.org>

BUGS

Please report any bugs or feature requests to bug-tree-file@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT

Copyright 2005 Ricardo Signes, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.