B::Graph, version 0.03 Copyright (C) 1997,1998 Stephen McCamant. All rights reserved. This program is free software; you can redistribute and/or modify it under the same terms as Perl itself. Module list information: B::Graph adpr Perl Compiler backend to diagram OP trees This module is a layer between the perl-internals-examining parts of Malcolm Beattie's perl compiler (the B::* classes) and your favorite graph layout tool (currently Dot and VGC are supported, but adding others would be easy). It examines the internal structures that perl builds to represent your code (OPs and SVs), and generates specifications for multicolored boxes and arrows to represent them. New in this version: - Limited length of string values printed - Limited number of edges from one node for VCG - Made FILEGV links optional - Eliminated `pp_' prefix on OP nodes - Enhanced OP_NULL handling to show op_targ as old type - Shortened private [INP]OK abbreviations - Made special SVs SV-shaped - Cleaned up globals to make multiple calls possible (for mod_perl) Other things you need: perl 5.004 (some 5.003_?? versions might work, as would 5.003 with tweaking) Compiler-a3 (on CPAN; other versions might work too. Note that perl 5.004 added a new opcode, so you'll want to apply the included patch. This problem should be fixed in 5.005, whenever it's released.) The graph visualization package from from AT&T (contains Dot) http://www.research.att.com/sw/tools/graphviz/ OR Visualization of Compiler Graphs (`the VGC tool') http://www.cs.uni-sb.de/RW/users/sander/html/gsvcg1.htm (VCG has Windows and X11 interfaces, and is good for interactive viewing; Dot is a batch program that generates good PostScript, so you'll need either a printer or an previewer) A basic understanding of how perl's internals work (see perlguts(1)) OR A willingness to stare at complicated-looking diagrams, most of which you don't understand (Seriously, this module can be a good tool for learning about how perl works inside -- for instance, its output is a lot more intutive that `perl -Dx''s, IMHO) BUILDING Just like any other module: % perl Makefile.PL % make % make install (`make test' currently doesn't do anything interesting) EXAMPLE % perl -MO=Graph,-vcg -e '$a = $b + $c' >graph.vcg % xvcg graph.vcg OR % perl -MO=Graph,-dot -e '$a = $b + $x' | dot -Tps >graph.ps % gv graph.ps (or your favorite PostScript previewer) (depending on your shell, you might be able to do everyting in one line -- in zsh, say % xvcg =(perl -MO=Graph,-vcg -e '...') ) You may notice that this is the same example used in perlguts (the section titled `code tree'). A comparison to the ASCII art there will give you an idea of what `slightly more complicated' means. For more detailed information, see the POD at the end of Graph.pm. Send questions, bug reports, and feature requests to me, Stephen McCamant .