GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Tangram::Type::Dump(3) User Contributed Perl Documentation Tangram::Type::Dump(3)

Tangram::Type::Dump - Handy functions for Pixie-like dumping of data

  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'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);

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.

flatten($storage, $structure)
Traverses the structure $structure, and replaces all the known (ie, already inserted) Tangram objects with references to them
unflatten($storage, $structure)
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 :).

Should this module just be an extension to Tangram::Storage ?

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.
2015-10-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.