This is a really quick hack. I wanted to see which modules used which in my debugging session. This is exactly what Devel::TraceUse does.
I wanted to be able to see those relationship and be able to doodle on a piece of paper and stuff. So, here goes, thanks to GraphViz:
#!/usr/bin/env perl use strict; use warnings; use GraphViz; my $png = shift || 'use.png'; my $g = GraphViz->new( rankdir => 1 ); my @stack; while (<>) { # first node /^Modules used from (.*):/ && do { $g->add_node($1); @stack = ($1); }; # all other nodes /^((?: )+)(\S+),/ && do { my $idx = length($1) / 2; $stack[$idx] = $2; $g->add_node($2); $g->add_edge( $stack[ $idx - 1 ] => $2 ); }; # ignore all other lines } $g->as_png($png);