Drinking the Data::Printer Kool-Aid

A long-time user of Data::Dumper, here. I have seen several talks about using Data::Printer in cases when you want the output to be readable by humans, not machines. I've always meant to eventually get around to checking it out. Today was that day.

I had a huge data structure at work, nested many layers deep and full of repetition with slight variances. My job was to find out what was wrong with it. After looking at the Dumper output for about 10 minutes, I became aware that I had actually stopped looking at the Dumper output a few minutes prior and my mind had wandered somewhere else (squirrel!) So, I decided to see if Data::Printer made the job any easier.

The first challenge was getting the module to install. Using cpanm, I was able to get it to install with just three tries and 44 dependencies to install. (By the way, DateTime::Duration, and Digest::MD4 are both undocumented dependencies somewhere along that dependency tree, don't ask me where.)

After that, I found that Data::Printer made the simple, simple. Dumping an object is very simple:

p $obj;

With with power comes complexity, however. Data::Printer has a lot of stuff that you can configure. Way more than I wanted to read about to accomplish my simple project. But at least the simple stuff was easy, and that's enough to get me past day 1 and make me want to learn more about it later.

Leave a comment

Name

Email Address

URL

Remember personal info?

Comments
(You may use HTML tags for style)

About Dan Wright

I'm the Treasurer for The Perl Foundation. I have also organized Perl events including 5 Pittsburgh Perl Workshops and one YAPC. In my day job, I'm the director of technical operations for pairNIC.com and I supervise a team of Perl developers.