Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Pretty printing of Data::Dumper (and other recursive structures)

by zerohero (Monk)
on Feb 05, 2009 at 17:26 UTC ( [id://741614]=perlquestion: print w/replies, xml ) Need Help??

zerohero has asked for the wisdom of the Perl Monks concerning the following question:

I'm fairly certain there are a few elegant ways to do this that will obviate me hacking my own solution.

I'm using Dumper to print recursive structures (nested anonymous, hashes, arrays, etc.), i.e. print Dumper ($v), "\n". The one thing I'd like to improve is that Dumper prints everything on its own line (hash braces, array braces, single items), for simplicity. It would be nice if I could pass the string from Dumper to a pretty printer that put a few things on a line (depending on a specified width perhaps). So some routine that will transform Dumper output and make it more "horizontally oriented." It would be best if the output was "eval-able" like Dumper.

Anyone care to share their favorite way of doing this?

  • Comment on Pretty printing of Data::Dumper (and other recursive structures)

Replies are listed 'Best First'.
Re: Pretty printing of Data::Dumper (and other recursive structures)
by samtregar (Abbot) on Feb 05, 2009 at 18:19 UTC
    Perl::Tidy! It does a great job of formatting Perl structures for readability and it's very configurable.

    -sam

Re: Pretty printing of Data::Dumper (and other recursive structures)
by zentara (Archbishop) on Feb 05, 2009 at 17:39 UTC
Re: Pretty printing of Data::Dumper (and other recursive structures)
by planetscape (Chancellor) on Feb 05, 2009 at 19:04 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://741614]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-16 15:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found