martes, 10 de febrero de 2009

Better dumps with Data::Dumper::Perltidy

I recently discovered a new module that subclasses Data::Dumper . It outputs the same as D::D but more compressed to fit more data in a screen, and followng perltidy recommendations.

great for my huge debug dumps of arrays of hashes of arrays...
Here's a sample of what it outputs with a not-so-trivial structure.

$VAR1 = [
[ '183', '8', [ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' ] ],
[ '184', '7', [ '0', '1', '0', '0', '0', '0', '0', '0', '0', '0' ] ],
[ '185', '7', [ '0', '0', '0', '1', '0', '0', '0', '0', '0', '0' ] ]
];
Here's the cpan page

It's usage is as simple as including it and use Dumper as if you were using Data::Dumper, but instead it will use Data::Dumper::Perltidy.

Byez!