Vienna QA Hackathon, Day 2 - Extending the Perl Debugger

Hate the Perl debugger? Want it to do more? I do. For example, I hate it when I see this:

  DB<1> x $before                                                                                            
0  HASH(0x100e37fd8)
   'foo' => ARRAY(0x100c5f1d8)
      0  1
      1  2
      2  4
   'guess' => CODE(0x100dc0d78)
      -> &main::__ANON__[run.pl:13] in run.pl:10-13
   'this' => 'that'
   'uno' => HASH(0x100db9000)
      'this' => 'that'
      'what?' => HASH(0x10088dfc0)
         'this' => 'them'

So I've extended it to allow you to type xx $var:

  DB<2> xx $after                                                                                            
{
  foo => [
    1,
    2,
    4
  ],
  guess => sub {
      my $x = shift @_;
      return $x + 1;
  },
  this => "that",
  uno => {
    this => "that",
    "what?" => {
      this => "them"
    }
  }
}

That's the same data structure, but it's much easier to read.

It's build on top of Marcel Grünauer's DB::Pluggable, but I can't release it yet because we've agreed that some of my work should be pushed back into the pluggable layer. Later, I'll make it more extensible, including changing serialisation options.

5 Comments

How do you deal with circulars?

That's really nice. Are you using Data::Dumper::Streamer for this?

Love it!

Leave a comment

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/