|Do you know where your variables are?|
Graphical debugging of WebApps (and analyzing Wikis)by neniro (Priest)
|on Nov 01, 2005 at 16:41 UTC||Need Help??|
The following examples refer to my wiki-node a quick and dirty Wiki - but the code is quite easy to transfer to all kind of webapps.
If you debug CGIs you've possbily utilized sometimes something like this:
This works fine and I used it quite often. But sometimes it would be cool to have a more vizualized output (even if you just want to impress your coworkers/boss). There is a cool module for this on cpan called GraphViz::Data::Grapher - but how can you use it in your CGI?
Alternatively I could have dumped $q->form or something else. The trick is to use base64-encoding as described in this RFC (The "data" URL scheme) http://www.ietf.org/rfc/rfc2397.txt to embed the GraphViz-dump in your html. This doesn't work for IE-users and beside that it isn't a good idea to try to dump bigger amounts of data this way.
I wanted to know which nodes in my wiki refer to other nodes. GraphViz::Data::Grapher won't do the trick but GraphViz (http://www.research.att.com/sw/tools/graphviz/) and the GraphViz - module are still the right tools for this. If you've read my wiki-node you know that I've put the whole wiki in a simple hash-ref. It's easy to build a graph out of this structure:
As you see it's also just a few lines of code but you get a real cool picture of the relations within the wiki.
I hope you like it and maybe you've now some cool ideas of what you want to vizualize in your next webapp.