Revision 4 - 2009-06-17 at 14:42:31

Visualizing Paths in MojoMojo

Overview

I just stumbled across CatalystX::Dispatcher::AsGraph which enables one to create a graph of the private actions in their Catalyst application. Reading t/05graph.t_ got me started and now I'm ready to apply the module to make a graph of routes in MojoMojo.

The Script

This script will generate a .dot graph file of the MojoMojo private actions:

use strict;
use warnings;
use CatalystX::Dispatcher::AsGraph;
use lib '/path/to/MojoMojo/lib'my $graph = CatalystX::Dispatcher::AsGraph->new(
    appname => 'MojoMojo',
);
$graph->run;

#print $graph->graph->as_ascii;
if (open(my $dot'>''MojoMojo.dot')) {
    print $dot $graph->graph->as_graphviz;
    close($dot);
}

Make an image from the Graph data -- .dot to png

dot -Tpng -o MojoMojo-routes.png MojoMojo.dot

The Result

My tags:
 
Popular tags:
  visualize
Powered by Catalyst