ANNOUNCE: GraphViz::Data::Structure 0.11

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


    GraphViz::Data::Structure version 0.12 has been uploaded to CPAN.

         use GraphViz::Data::Structure;

         my $gvds = GraphViz:Data::Structure->new($data_structure);
         print $gvds->graph()->as_png;

       This module makes it easy to visualise data structures, even recursive
       or circular ones.

       It is provided as an alternative to GraphViz::Data::Grapher. Differ-

       "GraphViz::Data::Structure" handles structures of arbitrary depth and
       complexity, automatically following links using a standard graph
       traversal algorithm.
       "GraphViz::Data::Grapher" creates graphics of indiividual substructures
       (arrays, scalars, hashes) which keep the substructure type and data
       together; "GraphViz::Data::Structure" does this by shape alone.
       "GraphViz::Data::Structure" encapsulates object info (if any) directly
       into the node  being used to represent the class.
       "GraphViz::Data::Grapher" colors its graphs; "GraphViz::Data::Struc-
       ture" doesn't by default.
       "GraphViz::Data:Structure" can parse out globs and CODE references
       (almost as well as the debugger does).

       "Graphviz::Data::Structure" tries to draw data structure diagrams with
       a minimum of complexity and a maximum of elegance. To this end, the
       following design choices were made:

       Strings, scalars, filehandles, and code references are represented as
       plain text.
       Empty hashes and arrays are represented as Perl represents them in
       code: hashes as "{}", and arrays as "[]", except if they are blessed
       (see below).
       Arrays are laid out as sets of boxes, in the order in which they were
       found in the existing data structure (left-to-right or top-to-bottom,
       depending on overall graph layout).
       Hashes are laid out as pairs of sets of boxes, with the keys in alpha-
       betically-sorted order top-to-bottom or left-to-right.
       Blessed items have a box added to them in parallel, containing the name
       of the class and its type (scalar/array/hash).
       Code references are decoded to determine their fully-qualified package
       name and are output as plaintext nodes.
       Glob pointed to by references are disassembled and their individual
       parts dumped.

       The algorithm is a standard recursive depth-first treewalk; we deter-
       mine how the current node should be added to the current graph, add it,
       and then call ourselves recursively to determine how all nodes below
       this one should be visualized.Edges are added after the subnodes are
       added to the graph.

       Items "within" the current subnode (array and hash elements which are
       not references) are rendered inside a cell in the aggregate correspond-
       ing to their position. References are represented by an edge linking
       the appropriate postion in the aggregate to the appropriate subnode.

       This code does its data-structure unwrapping in a manner very similar
       to that used by "", the code used by the debugger to display
       data structures as text. The initial structure treewalk was written in
       isolation; the "" code was integrated only after it was rec-
       ognized that there was more to life than hashes, arrays, and
       scalars.The "" code to decode globs and code references was
       used almost as-is.

       Code was added to attempt to spot references to array or hash elements,
       but this code still does not work as desired. Array and hash element
       references still appear to be scalars to the current algorithm.
       Cannot catch pointers to individual array or hash elements yet and dis-
       play the containing items, even though it tries.

       Data structures which point directly to themselves will cause "dot" to
       discard all input in some cases. There's currently no fix for this; you
       can call the "was_null()" method for now, which will tell you the graph
       was null and let you decide what to do.

       It isn't possible (in current releases of "dot") to code a record label
       which contains no text (e.g.: ""); this generates a zero-width
       box. This has been worked around by placing a single period in places
       where nothing at all would have been preferable. The "graphviz" devel-
       opers have developed a patch for "dot" that corrects the problem, but
       it is not yet in a released version, though it is in CVS.


       Copyright (C) 2001-2004, Joe McMahon

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

Site Timeline