man Tangram::Dump () - Handy functions for Pixie-like dumping of data
NAME
Tangram::Dump - Handy functions for Pixie-like dumping of data
SYNOPSIS
use Tangram::Dump qw(flatten unflatten UNflatten nuke);
use YAML qw(freeze thaw); # for instance
my $frozen = freeze flatten($storage, $structure);
# optional - remove circular references from flattened # structure so that it is freed up properly. nuke $frozen;
# save frozen somewhere...
# restore, but don't load objects straight away my $reconstituted = unflatten($storage, thaw $frozen);
# restore, loading objects immediately my $original = UNflatten($storage, $frozen);
# Alternative, quickly marshall a structure for saving my $structure; flatten($storage, $structure); # ... do something with it ...
# restore to former glory; note that Tangram's cache will # prevent unnecessary DB access. unflatten($storage, $structure);
DESCRIPTION
This module contains functions for traversing data structures which are not Tangram-registered objects, and replacing all the Tangram objects found with `Mementos'.
When a similar data structure is fed back into the reversal function, the mementos are filled with on-demand references to the real objects.
All these functions operate in place for maximum efficiency.
FUNCTIONS
Traverses the structure $structure, and replaces all the known (ie, already inserted) Tangram objects with references to them Performs the logical opposite of flatten, but only insofar as a `normal' user is concerned. `Normal' users, of course, don't care that the data structure is being loaded from the database as they use it :).
BUGS
Should this module just be an extension to Tangram::Storage ?
AUTHOR
Sam Vilain, samv@cpan.org. All rights reserved. This code is free software; you can use and/or modify it under the same terms as Perl itself.