Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Release history of B-Graph
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


B::Graph, version 0.50

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	bdpr	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:
        - Moved to beta-level along with rest of compiler
        - Increased version number to 0.50 for beta
        - Cleanups motivated by -w
        - Fixed dual string/numeric value SVs
        - Made all SV field labels all-caps
        - Added edge classes for VCG
        - Removed PMOP fields gone in recent development versions
        - Made op_seq and op_type optional
        - Made -run_order actually walk in run-order
        - Distinguished between op_nexts and other runtime pointers
        - Removed `op_' prefix on OP fields 
        - Removed bogus `CVOP' class

Other things you need:

* perl 5.005

(Older versions of perl will work to various extents with old alpha
versions of the compiler, but the version in 5.005 has several fixes,
so it is recommended.)

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


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

(`make test' currently doesn't do anything interesting. Also, with
5.005 it may fail to find the `Perl_byterun' symbol, but B::Graph will
still run fine. If you just want to test whether B::Graph works on
your platform (hello CPAN testers!), just run one of the examples
below and check that the output doesn't look like an error message.)


(Add `-Mblib' if you haven't done `make install')

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