NAME
GraphViz2::Marpa::Renderer::Graphviz
- A renderer for GraphViz2::Marpa-style dot
files
Synopsis
See "Synopsis" in GraphViz2::Marpa.
Description
GraphViz2::Marpa::Renderer::Graphviz provides a renderer for Graphviz (dot) graph definitions parsed by GraphViz2::Marpa.
It outputs a string to the output file, which (ideally) exactly matches the graph definition input to the paser, although there might be small differences in the line-by-line formatting.
This module is the default rendering engine for GraphViz2::Marpa.
Installation
Install GraphViz2::Marpa as you would for any Perl
module:
Run:
cpanm GraphViz2::Marpa
or run:
sudo cpan GraphViz2::Marpa
or unpack the distro, and then either:
perl Build.PL
./Build
./Build test
sudo ./Build install
or:
perl Makefile.PL
make (or dmake or nmake)
make test
make install
Constructor and Initialization
new()
is called as my($renderer) = GraphViz2::Marpa::Renderer::Graphviz -> new(k1 => v1, k2 => v2, ...)
.
It returns a new object of type GraphViz2::Marpa::Renderer::Graphviz
.
Key-value pairs accepted in the parameter list (see corresponding methods for details [e.g. maxlevel()]):
- o logger => $logger_object
-
Specify a logger object.
To disable logging, just set logger to the empty string.
Default: An object of type Log::Handler.
- o maxlevel => $level
-
This option is only used if this module creates an object of type Log::Handler. See Log::Handler::Levels.
Default: 'notice'.
- o minlevel => $level
-
This option is only used if this module creates an object of type Log::Handler. See Log::Handler::Levels.
Default: 'error'.
No lower levels are used.
- o output_file => $file_name
-
Specify the name of the output file to write. This will contain the text string of the rendered graph.
Default: ''.
The default means the output file is not written. Use the "output_string()" method to retrieve the string.
- o tree => anObjectOfTypeTreeDAG_Node
-
Specify the tree tokens output by the parser.
This option is mandatory.
The tree is output from GraphViz2::Marpa.
Default: ''.
Methods
format_node($node, $opts)
$node is an object of type Tree::DAG_Node.
$opts is the same hashref of options as passed in to the call to walk_down()
in run()
.
format_node()
is called to generate a string representation of $node, using $opts.
Examine the default implementation of format_node()
, above, for more details.
log($level, $s)
Calls $self -> logger -> $level($s) if ($self -> logger).
logger([$logger_object])
Here, the [] indicate an optional parameter.
Get or set the logger object.
To disable logging, just set 'logger' to the empty string (not undef), in the call to "new()".
'logger' is a parameter to "new()". See "Constructor and Initialization" for details.
maxlevel([$string])
Here, the [] indicate an optional parameter.
Get or set the value used by the logger object.
This option is only used if GraphViz2::Marpa:::Lexer or GraphViz2::Marpa::Parser create an object of type Log::Handler. See Log::Handler::Levels.
'maxlevel' is a parameter to "new()". See "Constructor and Initialization" for details.
minlevel([$string])
Here, the [] indicate an optional parameter.
Get or set the value used by the logger object.
This option is only used if GraphViz2::Marpa:::Lexer or GraphViz2::Marpa::Parser create an object of type Log::Handler. See Log::Handler::Levels.
'minlevel' is a parameter to "new()". See "Constructor and Initialization" for details.
output_file([$file_name])
Here, the [] indicate an optional parameter.
Get or set the name of the output file. This will contain the text string of the rendered graph.
If the output file name is not set, use the "output_string()" method to retrieve the string.
'output_file' is a parameter to "new()". See "Constructor and Initialization" for details.
run()
Renders the tree of parsed tokens as a string and, optionally, writes that string to the output file.
Returns 0 for success and 1 for failure.
tree()
Gets or sets the tree of tokens to be rendered.
'tree' is a parameter to "new()". See "Constructor and Initialization" for details.
FAQ
See "FAQ" in GraphViz2::Marpa.
Machine-Readable Change Log
The file Changes was converted into Changelog.ini by Module::Metadata::Changes.
Version Numbers
Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions.
Repository
https://github.com/ronsavage/GraphViz2-Marpa
Support
Email the author, or log a bug on RT:
https://rt.cpan.org/Public/Dist/Display.html?Name=GraphViz2::Marpa.
Author
GraphViz2::Marpa was written by Ron Savage <ron@savage.net.au> in 2012.
Home page: http://savage.net.au/index.html.
Copyright
Australian copyright (c) 2012, Ron Savage.
All Programs of mine are 'OSI Certified Open Source Software';
you can redistribute them and/or modify them under the terms of
The Artistic License 2.0, a copy of which is available at:
http://opensource.org/licenses/alphabetical.