Cal Henderson > Language-Homespring-Visualise-GraphViz-0.04 > Language::Homespring::Visulaise::GraphViz

Download:
Language-Homespring-Visualise-GraphViz-0.04.tar.gz

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

Language::Homespring::Visulaise::GraphViz - A visual op-tree viewer for "Homespring"

SYNOPSIS ^

  use Language::Homespring;
  use Language::Homespring::Visualise::GraphViz;

  my $code = "bear hatchery Hello,. World ..\n powers";

  my $hs = new Language::Homespring();
  $hs->parse($code);

  my $vis = new Language::Homespring::Visualise::GraphViz({'interp' => $hs});
  print $vis->do()->as_gif;

DESCRIPTION ^

This module implements a viewer for Homespring op-trees, using the GraphViz program. You can now see the rivers that your code produces :)

METHODS ^

new({'interp' => $hs})

Creates a new Language::Homespring::Visualise::GraphViz object. The single hash argument contains initialisation info. The only key currently required is 'interp', which should point to the Language::Homespring object you wish to visualise.

Other optional keys are:

node_col

The background color to use for reserved word nodes. Specified in GraphViz format (#rrggbb is ok). Defaults to white.

spring_col

The background color to use for spring nodes. Specified in GraphViz format (#rrggbb is ok). Defaults to #c0c0ff (light blue).

fontname

The name of the font to use. Defaults to "Times".

Important: If the font file cannot be found (for "Times", "Times.ttf" must be in the font seach path - remember case sensitivity on unix etc.) then a built in font will be used, BUT the labels will not be centered in the nodes.

fontsize

The size of the font in points. Defaults to 12.

do()

Returns a GraphViz object, with all nodes and edges for the current state of the op-tree. You can then call standard GraphViz methods on this object such as as_gif() and as_png() to output an image.

EXAMPLES ^

The examples folder in this distribution contains an example script (example.pl) and three example GIFs. The GIFs are visual representations of the .hs files of the same name from the Language::Homespring distribution.

AUTHOR ^

Copyright (C) 2003 Cal Henderson <cal@iamcal.com>

SEE ALSO ^

perl

Language::Homespring

http://www.graphviz.org/

syntax highlighting: