.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Tangram::Type::Dump 3pm" .TH Tangram::Type::Dump 3pm "2022-10-16" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Tangram::Type::Dump \- Handy functions for Pixie\-like dumping of data .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Tangram::Type::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\*(Aqt 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\*(Aqs cache will \& # prevent unnecessary DB access. \& unflatten($storage, $structure); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module contains functions for traversing data structures which are \fInot\fR Tangram-registered objects, and replacing all the Tangram objects found with `Mementos'. .PP When a similar data structure is fed back into the reversal function, the mementos are filled with on-demand references to the real objects. .PP All these functions operate \fBin place\fR for maximum efficiency. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .IP "\fBflatten($storage, \f(CB$structure\fB)\fR" 4 .IX Item "flatten($storage, $structure)" Traverses the structure \fB\f(CB$structure\fB\fR, and replaces all the known (ie, already inserted) Tangram objects with references to them .IP "\fBunflatten($storage, \f(CB$structure\fB)\fR" 4 .IX Item "unflatten($storage, $structure)" Performs the logical opposite of \fBflatten\fR, 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 :). .SH "BUGS" .IX Header "BUGS" Should this module just be an extension to Tangram::Storage ? .SH "AUTHOR" .IX Header "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.