1GraphViz2::Parse::RegexUps(e3r)Contributed Perl DocumentGartaipohnViz2::Parse::Regexp(3)
2
3
4
6 GraphViz2::Parse::Regexp - Visualize a Perl regular expression as a
7 graph
8
10 #!/usr/bin/env perl
11
12 use strict;
13 use warnings;
14
15 use File::Spec;
16
17 use GraphViz2;
18 use GraphViz2::Parse::Regexp;
19
20 use Log::Handler;
21
22 # ------------------------------------------------
23
24 my($logger) = Log::Handler -> new;
25
26 $logger -> add
27 (
28 screen =>
29 {
30 maxlevel => 'debug',
31 message_layout => '%m',
32 minlevel => 'error',
33 }
34 );
35
36 my($graph) = GraphViz2 -> new
37 (
38 edge => {color => 'grey'},
39 global => {directed => 1},
40 graph => {rankdir => 'TB'},
41 logger => $logger,
42 node => {color => 'blue', shape => 'oval'},
43 );
44 my($g) = GraphViz2::Parse::Regexp -> new(graph => $graph);
45
46 $g -> create(regexp => '(([abcd0-9])|(foo))');
47
48 my($format) = shift || 'svg';
49 my($output_file) = shift || File::Spec -> catfile('html', "parse.regexp.$format");
50
51 $graph -> run(format => $format, output_file => $output_file);
52
53 See scripts/parse.regexp.pl ("Scripts Shipped with this Module" in
54 GraphViz2).
55
57 Takes a Perl regular expression and converts it into a graph.
58
59 You can write the result in any format supported by Graphviz
60 <http://www.graphviz.org/>.
61
62 Here is the list of output formats
63 <http://www.graphviz.org/content/output-formats>.
64
66 This module is available as a Unix-style distro (*.tgz).
67
68 See <http://savage.net.au/Perl-modules/html/installing-a-module.html>
69 for help on unpacking and installing distros.
70
72 Install GraphViz2 as you would for any "Perl" module:
73
74 Run:
75
76 cpanm GraphViz2
77
78 or run:
79
80 sudo cpan GraphViz2
81
82 or unpack the distro, and then either:
83
84 perl Build.PL
85 ./Build
86 ./Build test
87 sudo ./Build install
88
89 or:
90
91 perl Makefile.PL
92 make (or dmake or nmake)
93 make test
94 make install
95
97 Calling new()
98 "new()" is called as "my($obj) = GraphViz2::Parse::Regexp -> new(k1 =>
99 v1, k2 => v2, ...)".
100
101 It returns a new object of type "GraphViz2::Parse::Regexp".
102
103 Key-value pairs accepted in the parameter list:
104
105 o graph => $graphviz_object
106 This option specifies the GraphViz2 object to use. This allows you
107 to configure it as desired.
108
109 The default is GraphViz2 -> new. The default attributes are the
110 same as in the synopsis, above, except for the logger of course,
111 which defaults to ''.
112
113 This key is optional.
114
116 create(regexp => $regexp)
117 Creates the graph, which is accessible via the graph() method, or via
118 the graph object you passed to new().
119
120 Returns $self for method chaining.
121
122 graph()
123 Returns the graph object, either the one supplied to new() or the one
124 created during the call to new().
125
127 See "FAQ" in GraphViz2 and "Scripts Shipped with this Module" in
128 GraphViz2.
129
131 Many thanks are due to the people who chose to make Graphviz
132 <http://www.graphviz.org/> Open Source.
133
134 And thanks to Leon Brocard <http://search.cpan.org/~lbrocard/>, who
135 wrote GraphViz, and kindly gave me co-maint of the module.
136
138 Version numbers < 1.00 represent development versions. From 1.00 up,
139 they are production versions.
140
142 The file Changes was converted into Changelog.ini by
143 Module::Metadata::Changes.
144
146 Email the author, or log a bug on RT:
147
148 <https://rt.cpan.org/Public/Dist/Display.html?Name=GraphViz2>.
149
151 GraphViz2 was written by Ron Savage <ron@savage.net.au> in 2011.
152
153 Home page: <http://savage.net.au/index.html>.
154
156 Australian copyright (c) 2011, Ron Savage.
157
158 All Programs of mine are 'OSI Certified Open Source Software';
159 you can redistribute them and/or modify them under the terms of
160 The Perl License, a copy of which is available at:
161 http://dev.perl.org/licenses/
162
163
164
165perl v5.28.0 2018-02-23 GraphViz2::Parse::Regexp(3)