prereq-grapher - generate dependency graph for perl module or source
prereq-grapher [options] Foo::Bar .. Foo::Baz Options: -o <file> The file to write the graph into -d <int> Stop recursing at the specified depth -t <seconds> Timeout for when generating SVG or HTML output -nc Don't include core modules in dependency graph -nrc Show core modules, but not their dependencies -dot Generate graph in dot format (used by GraphViz) -svg Generate graph as Scalable Vector Graphics -html Generate graph as HTML -gml Generate graph as GraphML -vcg Generate graph in VCG format -verbose Display verbose messages as we run -h --help This help
prereq-grapher parses perl source and looks for prerequisites, such as modules that are
require'd. All of those modules are then parsed in turn, looking for their dependencies.
Once all files have been parsed, prereq-grapher will write out the dependency graph in one of the five formats supported.
The simplest way to run prereq-grapher is just giving a module name:
% prereq-grapher Module::Path 6 modules processed. Graph written to dependencies.dot
By default prereq-grapher generates the dependency graph in
dot format, and writes it to a file called
dependencies.dot. You can explicitly specify the output format and filename:
% prereq-grapher -svg -o class-inspector-path.svg Class::Inspector 9 modules processed. Graph written to class-inspector.svg
If the complete dependency graph is very large, it can be hard to get your head around it. In this case you could start off generating the first few levels of dependencies, using the -depth (or -d) option:
% prereq-grapher App::PrereqGrapher 305 modules processed. Graph written to dependencies.dot % prereq-grapher -depth 2 App::PrereqGrapher 10 modules processed. Graph written to dependencies.dot
The name of the file that the dependency graph should be written to. If not specified, prereq-grapher will write the graph in a file called
dependencies, and the extension will indicate the format (dot, svg, html, gml, or vcg).
Generate the dependency graph to a depth of no more than N links.
Specifies the timeout that should be passed to Graph::Easy when generating the output graph. Mainly relevant for SVG and HTML formats.
Don't include any core dependencies in the generated dependency graph.
Include core modules in the output, but don't include any of their dependencies.
Generate the dependency graph in the Dot format supported by the GraphViz tools.
Generate the dependency graph as Scalable Vector Graphics.
Generate the dependency graph as an HTML file with embedded CSS. Note: I haven't got this to work yet, but it's one of the output formats supported by Graph::Easy.
Display verbose messages as the script runs. If a module is use'd or require'd, but not installed locally, then by default it will be silently ignored. In verbose mode you'll hear about all such modules.
For the dot format, see http://www.graphviz.org. There are graphical tools for viewing direct graphs, or you can use the
dot program on the command-line to generate an image, postscript, or many other things besides.
For GraphML (the gml export format), see <the GraphML home page|http://graphml.graphdrawing.org>.
I haven't been able to get the HTML version to work for any dependency graph I've tried.
For VCG, see The VCG home page.
Neil Bowers <firstname.lastname@example.org>
This software is copyright (c) 2012 by Neil Bowers.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.