1GraphViz::Data::GrapherU(s3e)r Contributed Perl DocumentaGtriaopnhViz::Data::Grapher(3)
2
3
4
6 GraphViz::Data::Grapher - Visualise data structures as a graph
7
9 use GraphViz::Data::Grapher;
10
11 my $graph = GraphViz::Data::Grapher->new($structure);
12 print $graph->as_png;
13
15 This module makes it easy to visualise Perl data structures. Data
16 structures can grow quite large and it can be hard to understand the
17 quite how the structure fits together.
18
19 Data::Dumper can help by representing the structure as a text
20 hierarchy, but GraphViz::Data::Grapher goes a step further and
21 visualises the structure by drawing a graph which represents the data
22 structure.
23
24 Arrays are represented by records. Scalars are represented by
25 themselves. Array references are represented by a '@' symbol, which is
26 linked to the array. Hash references are represented by a '%' symbol,
27 which is linked to an array of keys, which each link to their value.
28 Object references are represented by 'Object', which then links to the
29 type of the object. Undef is represented by 'undef'.
30
32 new
33 This is the constructor. It takes a list, which is the data structure
34 to be visualised. A GraphViz object is returned.
35
36 my $graph = GraphViz::Data::Grapher->new([3, 4, 5], "Hello");
37
38 as_*
39 The data structure can be visualised in a number of different graphical
40 formats. Methods include as_ps, as_hpgl, as_pcl, as_mif, as_pic, as_gd,
41 as_gd2, as_gif, as_jpeg, as_png, as_wbmp, as_ismap, as_imap, as_vrml,
42 as_vtx, as_mp, as_fig, as_svg. See the GraphViz documentation for more
43 information. The two most common methods are:
44
45 # Print out a PNG-format file
46 print $graph->as_png;
47
48 # Print out a PostScript-format file
49 print $graph->as_ps;
50
52 Leon Brocard <acme@astray.com>
53
55 Copyright (C) 2000-1, Leon Brocard
56
57 This module is free software; you can redistribute it or modify it
58 under the Perl License, a copy of which is available at
59 <http://dev.perl.org/licenses/>.
60
61
62
63perl v5.34.0 2021-07-22 GraphViz::Data::Grapher(3)