Devel::Command::Viz - graph data structures under the debugger


Devel-Command-Viz documentation Contained in the Devel-Command-Viz distribution.

Index


Code Index:

NAME

Top

Devel::Command::Viz - graph data structures under the debugger

SYNOPSIS

Top

  # in .perldb:
  use Devel::Command;
  sub afterinit {
     Devel::Command->install;
  }

  # In the debugger:
  DB<1> my $a = [1, 2, {3=>4}, [5.6]]
  DB<2> viz $a

  # A 'dotty' window pops up, showing the data structure.

DESCRIPTION

Top

Devel::Command::Viz is a debugger extension command plugin for Devel::Command. It uses GraphViz::Data::Structure to visualize a Perl data structure and dotty to display the resultant graph.

ROUTINES

Top

command

Standard Devel::Command wrapper code to parse a debugger command line, render the graph, and display it.

BUGS

Top

None known; it's possible that the resultant graphs may have probelms due to as-yet-uncaught bugs in GraphViz::Data::Structure.

The command will not work if you have no way of running dotty, which requires X Windows to be running.

SEE ALSO

Top

perl5db.pl, Devel::Command, dotty

AUTHOR

Top

Joe McMahon, <mcmahon@cpan.org>

COPYRIGHT AND LICENSE

Top


Devel-Command-Viz documentation Contained in the Devel-Command-Viz distribution.

package Devel::Command::Viz;

use 5.006;
use strict;
use warnings;
use GraphViz::Data::Structure;
use File::Temp qw(tempfile);

use base qw(Devel::Command);

our $VERSION = '0.02';

sub command {
  my ($arg) = (shift =~ /viz\s+(.*)/);
  chomp $arg;
  my $gvds = new GraphViz::Data::Structure(&eval($arg));
  my ($fh, $filename) = tempfile();
  print $fh $gvds->graph->as_canon;
  close $fh;
  system "dotty $filename";
  1;
}

1;
__END__