View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Tels > Graph-Usage-0.12 > perl_graph_usage


Annotate this POD

View/Report Bugs


perl_graph_usage - generate graph with usage patterns from Perl packages


        ./gen_graph --inc=lib/ --format=graphviz --output=usage_graph
        ./gen_graph --nocolor --inc=lib --format=ascii
        ./gen_graph --recurse=Graph::Easy
        ./gen_graph --recurse=Graph::Easy --format=graphviz --ext=svg
        ./gen_graph --recurse=var --format=graphviz --ext=jpg
        ./gen_graph --recurse=Math::BigInt --skip='^[a-z]+\z'
        ./gen_graph --use=Graph::Usage::MySubClass --recurse=Math::BigInt


        --color=X               0: uncolored output
                                1: default, colorize nodes on how much packages they use
                                2: colorize nodes on how much packages use them
        --nocolor               Sets color to 0 (like --color=0, no color at all)

        --inc=path[,path2,..]   Path to source tree or a single file
                                if not specified, @INC from Perl will be used
        --recurse=p[,p2,..]     recursively track all packages from package "p"
        --skip=regexp           Skip packages that match the given regexp. Example:
                                  -skip='^[a-z]+\z'             skip all pragmas
                                  -skip='^Math::BigInt\z'       skip only Math::BigInt
                                  -skip='^Math'                 skip all Math packages

        --output                Base-name of the output file, default "usage".
        --format                The output format, default "graphviz", valid are:
                                  ascii (via Graph::Easy)
                                  html (via Graph::Easy)
                                  svg (via Graph:Easy)
                                  dot (via Graph:Easy)
                                  graphviz (see --generator below)
        --generator             Feed the graphviz output to this program, default "dot".
                                It must be installed and in your path.
        --extension             Extension of the output file. For "graphviz" it will
                                change the format of the output to produce the appr.
                                file type.  For all other formats it will merely set
                                the filename extension. It defaults to:
                                  Format        Extension
                                  ascii         txt
                                  html          html
                                  svg           svg
                                  dot           dot
                                  graphviz      png
        --flow                  The output flows into this direction. Default "south".
                                Possible are:
        --versions              include package version number in graph nodes.

        --debug                 print some timing and statistics info.

Help and version:

        --help                  print this help and exit
        --version               print version and exit


This script traces the usage of Perl packages by other Perl packages from use and require statements and plots the result as a graph.

Due to the nature of the parsing it might miss a few connections, or even generate wrong positives. However, the goal is to provide a map of what packages your module/package really uses. This can be quite different from what the dependency-tree in Makefile.PL states.


Output formats

Formats rendered via Graph::Easy (HTML, ASCII and SVG) have a few limitations and only work good for small to medium sized graphs.

The output format graphviz is rendered via dot or other programs and can have arbitrary large graphs.

However, for entire source trees like the complete Perl source, the output becomes unlegible and cramped even when using dot.

I hope I can improve this in time.


This library is free software; you can redistribute it and/or modify it under the same terms of the GPL version 2. See the LICENSE file for information.


(c) 2005 by Tels

syntax highlighting: