# Visualizing Paths in MojoMojo
## Overview
While surfing Perl blogs, I just stumbled across {{cpan CatalystX::Dispatcher::AsGraph}}. This module enables one to create a graph of the private actions in their Catalyst application. The documentation is sparse but reading <em>t/05_graph.t</em> got me started. Now I'm ready to use the module to make a graph of routes in the Catalyst application MojoMojo.
## The Script
This script will generate a .dot graph file of the MojoMojo private actions:
<pre lang="Perl">
use strict;
use warnings;
use CatalystX::Dispatcher::AsGraph;
use lib '/path/to/MojoMojo/lib';
my $graph = CatalystX::Dispatcher::AsGraph->new(
appname => 'MojoMojo',
output => 'MojoMojo_graph',
);
$graph->run;
#print $graph->graph->as_ascii;
if (open(my $dot, '>', 'MojoMojo.dot')) {
print $dot $graph->graph->as_graphviz;
close($dot);
}
</pre>
## Make an image from the Graph data -- .dot to png
<pre>
dot -Tpng -o MojoMojo-routes.png MojoMojo.dot
</pre>
## The Result
<img src="http://mojomojo.org/documentation/MojoMojo_Private_Paths_Visualized.attachment/72/view" />
</div>
<a href="http://mojomojo.org/documentation/mojomojo_private_paths_visualized.attachment/297/view" >
<img src="http://mojomojo.org/documentation/mojomojo_private_paths_visualized.attachment/297/thumb" />
<a href="http://mojomojo.org/documentation/mojomojo_private_paths_visualized.attachment/102/view" >
<img src="http://mojomojo.org/documentation/mojomojo_private_paths_visualized.attachment/102/thumb" />
</a>