
This project aims at graphing the usage tree of Perl packages. This is slightly
different as dependency-trees
in that it tracks which packages are actually use
'd and require
'd
by a specific class.
Thus it enables you to find out what packages will be actually loaded when you do a
use Package;
.
Look at the examples page to see some example outputs.
Modes of Operation: Recursing vs. Traversing
gen_graph
has two modes. The default is traverse: If you throw
it a file or source code path, then it will parse this file, or all .pm files found in the path
and create a graph from them. If you do not specify the --inc
option,
then gen_graph
will use @INC
e.g. the installed Perl packages.
Yes, this means you can feed it the entire Perl source like this:
./gen_graph --inc=/usr/src/blead/lib
Be warned, though, the resulting usage.png
file will be huge!
The other mode is called recurse and switched on by using the
--recurse=Package::Name
option. It works good with no --inc
option (using the installed Perl packages), but you can also use a different Perl source
tree:
./gen_graph --inc=/usr/src/blead/lib --recurse=vars ./gen_graph --recurse=vars
The first example uses the blead Perl source tree, the second one the installed version.
recurse mode is very usefull for feeding it your own package and see what it will all pull in - often enough third party packages load a lot of stuff that you didn't expect.
Limitations
There are currently three limitating factors:
- Graph::Easy - this makes HTML and ASCII output only feasable for small to medium sized graphs
- dot - the creation of huge graphs as PNG and SVG is possible (unlike with Graph::Easy), but dot doesn't do a good job in creating a usable/readable graph. The resulting graphic is huge, and unreadable/unmanagable and the lines cross so much that it is very confusing.
- The code parses the package files and figures out VERSIONS (if
--versions
is used) and use and require statements by some dirty hacks. This means it will occasionally get things wrong. If you notice something faulty, please report it as bug!
Read more details about the current limitations in the Graph::Easy package and how I want to overcome them.