Ron Savage > Graph-Easy-Marpa > Graph::Easy::Marpa::Renderer::GraphViz2

Download:
Graph-Easy-Marpa-2.01.tgz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 2.01   Source  

NAME ^

Graph::Easy::Marpa::Renderer::GraphViz2 - This is the default rendering engine for Graph::Easy::Marpa

Synopsis ^

See "Synopsis" in Graph::Easy::Marpa.

Description ^

This module is the default rendering engine for Graph::Easy::Marpa.

It provides a GraphViz2-based renderer for Graph::Easy::Marpa-style graph definitions.

For more details, see "Description" in Graph::Easy::Marpa.

Installation ^

Install Graph::Easy::Marpa as you would for any Perl module:

Run:

        cpanm Graph::Easy::Marpa

or run:

        sudo cpan Graph::Easy::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($parser) = Graph::Easy::Marpa::Renderer::GraphViz2 -> new(k1 => v1, k2 => v2, ...).

It returns a new object of type Graph::Easy::Marpa::Renderer::GraphViz2.

Key-value pairs accepted in the parameter list (see corresponding methods for details [e.g. maxlevel()]):

o dot_input_file => $file_name

Specify the name of a file that the rendering engine can write to, which will contain the input to dot (or whatever). This is good for debugging.

Default: ''.

If '', the file will not be created.

o format => $format

This is the format of the output file.

The default is 'svg'.

You can also pass this value into "run(%arg)".

The value passed in to run() takes precedence over the value passed in to new().

o logger => $logger_object

Specify a logger object.

To disable logging, just set logger to the empty string.

The default value is an object of type Log::Handler.

o maxlevel => $level

This option is only used if Graph::Easy::Marpa::Parser creates an object of type Log::Handler.

See Log::Handler::Levels.

The default 'maxlevel' is 'info'. A typical choice is 'debug'.

o minlevel => $level

This option is only used if Graph::Easy::Marpa::Parser creates an object of type Log::Handler.

See Log::Handler::Levels.

The default 'minlevel' is 'error'.

No lower levels are used.

o output_file => $file_name

Specify the name of the output file to write.

The default value is ''.

You can also pass this value into "run(%arg)".

The value passed in to run() takes precedence over the value passed in to new().

o rankdir => $direction

$direction must be one of: LR or RL or TB or BT.

Specify the rankdir of the graph as a whole.

The value for rankdir is passed to Graph::Easy::Marpa::Renderer::GraphViz2.

Default: 'TB'.

Methods ^

dot_input_file([$file_name])

Here, the [] indicate an optional parameter.

Get or set the name of the file into which the rendering engine will write to input to dot (or whatever).

You can pass 'dot_input_file' as a key into new() and run().

The value passed in to run() takes precedence over the value passed in to new().

format([$format])

Here, the [] indicate an optional parameter.

Get or set the format of the output file.

You can pass 'format' as a key into new() and run().

The value passed in to run() takes precedence over the value passed in to new().

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.

You can pass 'logger' as a key into new() and run().

The value passed in to run() takes precedence over the value passed in to new().

maxlevel([$string])

Here, the [] indicate an optional parameter.

Get or set the value used by the logger object.

This option is only used if Graph::Easy::Marpa::Parser creates an object of type Log::Handler.

See Log::Handler::Levels.

minlevel([$string])

Here, the [] indicate an optional parameter.

Get or set the value used by the logger object.

This option is only used if Graph::Easy::Marpa::Parser creates an object of type Log::Handler.

See Log::Handler::Levels.

output_file([$file_name])

Here, the [] indicate an optional parameter.

Get or set the name of the output file.

The default is ''.

You can pass 'output_file' as a key into new() and run().

The value passed in to run() takes precedence over the value passed in to new().

rankdir([$direction])

Here, the [] indicate an optional parameter.

Get or set the rankdir of the graph as a whole.

The default is 'TB' (top to bottom).

run(%arg)

Renders a set of items as an image, using GraphViz2.

Keys and values in %arg are:

o format => $format

The format (e.g. 'svg') to pass to the rendering engine.

The value passed in to run() takes precedence over the value passed in to new().

o items => $arrayref

This arrayref, passed from Graph::Easy::Marpa::Parser is the result of parsing the Graph::Easy-style graph definition (data/*.ge) file.

Each element of this arrayref is a hashref with these key-value pairs:

o count => $integer
o name => $string
o type => $string
o value => $string
o logger => $logger_object
o output_file => $file_name

This is where the output of 'dot' will be written.

FAQ ^

What are the defaults for GraphViz2?

         GraphViz2 -> new
         (
                edge    => $class{edge}   || {color => 'grey'},
                global  => $class{global} || {directed => 1},
                graph   => $class{graph}  || {rankdir => $self -> rankdir},
                logger  => $self -> logger,
                node    => $class{node} || {shape => 'oval'},
                verbose => 0,
         )

where $class($name) etc are taken from the class declarations, if any, at the start of the input stream.

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.

Support ^

Email the author, or log a bug on RT:

https://rt.cpan.org/Public/Dist/Display.html?Name=Graph::Easy::Marpa.

Author ^

Graph::Easy::Marpa was written by Ron Savage <ron@savage.net.au> in 2011.

Home page: http://savage.net.au/index.html.

Copyright ^

Australian copyright (c) 2011, 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, a copy of which is available at:
        http://www.opensource.org/licenses/index.html
syntax highlighting: