Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Release history of B-Graph
tag: 0.02

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


B::Graph, version 0.02

Copyright (C) 1997 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.

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 -a4, when it's released.)

The graph visualization package from from AT&T (contains Dot)
Visualization of Compiler Graphs (`the VGC tool')
(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))
A willingness to stare and 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)


Just like any other module:
% perl Makefile.PL
% make
% make install

(`make test' currently doesn't do anything interesting) 


% perl -MO=Graph,-vcg -e '$a = $b + $c' >graph.vcg
% xvcg graph.vcg
% perl -MO=Graph,-dot -e '$a = $b + $x' | dot -Tps >
% gv (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

Send questions, bug reports, and feature requests to me, Stephen
McCamant <>.
Something went wrong with that request. Please try again.