1GraphViz2::Parse::ISA(3U)ser Contributed Perl DocumentatiGornaphViz2::Parse::ISA(3)
2
3
4
6 GraphViz2::Parse::ISA - Visualize N Perl class hierarchies as a graph
7
9 #!/usr/bin/env perl
10
11 use strict;
12 use warnings;
13
14 use File::Spec;
15
16 use GraphViz2;
17 use GraphViz2::Parse::ISA;
18
19 use Log::Handler;
20
21 # ------------------------------------------------
22
23 my($logger) = Log::Handler -> new;
24
25 $logger -> add
26 (
27 screen =>
28 {
29 maxlevel => 'debug',
30 message_layout => '%m',
31 minlevel => 'error',
32 }
33 );
34
35 my($graph) = GraphViz2 -> new
36 (
37 edge => {color => 'grey'},
38 global => {directed => 1},
39 graph => {rankdir => 'BT'},
40 logger => $logger,
41 node => {color => 'blue', shape => 'Mrecord'},
42 );
43 my($parser) = GraphViz2::Parse::ISA -> new(graph => $graph);
44
45 unshift @INC, 't/lib';
46
47 $parser -> add(class => 'Adult::Child::Grandchild', ignore => []);
48 $parser -> add(class => 'Hybrid', ignore => []);
49 $parser -> generate_graph;
50
51 my($format) = shift || 'svg';
52 my($output_file) = shift || File::Spec -> catfile('html', "parse.code.$format");
53
54 $graph -> run(format => $format, output_file => $output_file);
55
56 See scripts/parse.isa.pl ("Scripts Shipped with this Module" in
57 GraphViz2).
58
60 Takes a class name and converts its class hierarchy into a graph. This
61 can be done for N different classes before the graph is generated.
62
63 You can write the result in any format supported by Graphviz
64 <http://www.graphviz.org/>.
65
66 Here is the list of output formats
67 <http://www.graphviz.org/content/output-formats>.
68
70 This module is available as a Unix-style distro (*.tgz).
71
72 See <http://savage.net.au/Perl-modules/html/installing-a-module.html>
73 for help on unpacking and installing distros.
74
76 Install GraphViz2 as you would for any "Perl" module:
77
78 Run:
79
80 cpanm GraphViz2
81
82 or run:
83
84 sudo cpan GraphViz2
85
86 or unpack the distro, and then either:
87
88 perl Build.PL
89 ./Build
90 ./Build test
91 sudo ./Build install
92
93 or:
94
95 perl Makefile.PL
96 make (or dmake or nmake)
97 make test
98 make install
99
101 Calling new()
102 "new()" is called as "my($obj) = GraphViz2::Parse::ISA -> new(k1 => v1,
103 k2 => v2, ...)".
104
105 It returns a new object of type "GraphViz2::Parse::ISA".
106
107 Key-value pairs accepted in the parameter list:
108
109 o graph => $graphviz_object
110 This option specifies the GraphViz2 object to use. This allows you
111 to configure it as desired.
112
113 The default is GraphViz2 -> new. The default attributes are the
114 same as in the synopsis, above, except for the logger of course,
115 which defaults to ''.
116
117 This key is optional.
118
120 add(class => $class[, ignore => $ignore])
121 Adds the class hierarchy of $class to an internal structure.
122
123 $class is the name of the class whose parents are to be found.
124
125 $ignore is an optional arrayref of class names to ignore. The value of
126 $ignore is not preserved between calls to add().
127
128 After all desired calls to add(), you must call "generate_graph()" to
129 actually trigger the call to the GraphViz2 methods add_node() and
130 add_edge().
131
132 Returns $self for method chaining.
133
134 See scripts/parse.isa.pl.
135
136 generate_graph()
137 Processes the internal structure mentioned under add() to add all the
138 nodes and edges to the graph.
139
140 After that you call GraphViz2's run() method on the graph object. See
141 "graph()".
142
143 Returns $self for method chaining.
144
145 See scripts/parse.isa.pl.
146
147 graph()
148 Returns the graph object, either the one supplied to new() or the one
149 created during the call to new().
150
152 See "FAQ" in GraphViz2 and "Scripts Shipped with this Module" in
153 GraphViz2.
154
156 Many thanks are due to the people who chose to make Graphviz
157 <http://www.graphviz.org/> Open Source.
158
159 And thanks to Leon Brocard <http://search.cpan.org/~lbrocard/>, who
160 wrote GraphViz, and kindly gave me co-maint of the module.
161
162 The code in add() was adapted from GraphViz::ISA::Multi by Marcus
163 Thiesen, but that code gobbled up package declarations in comments and
164 POD, so I used Pod::Simple to give me just the source code.
165
167 Version numbers < 1.00 represent development versions. From 1.00 up,
168 they are production versions.
169
171 The file Changes was converted into Changelog.ini by
172 Module::Metadata::Changes.
173
175 Email the author, or log a bug on RT:
176
177 <https://rt.cpan.org/Public/Dist/Display.html?Name=GraphViz2>.
178
180 GraphViz2 was written by Ron Savage <ron@savage.net.au> in 2011.
181
182 Home page: <http://savage.net.au/index.html>.
183
185 Australian copyright (c) 2011, Ron Savage.
186
187 All Programs of mine are 'OSI Certified Open Source Software';
188 you can redistribute them and/or modify them under the terms of
189 The Perl License, a copy of which is available at:
190 http://dev.perl.org/licenses/
191
192
193
194perl v5.32.0 2020-07-28 GraphViz2::Parse::ISA(3)