Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
A while ago I started on a data dumper that wasn't designed to be eval-able (like Data::Dumper) but human-readable and - more importantly - accurate.

I've just more-or-less finished the first version which fairly decently meets these goals, by doing a breadth-first walk and making use of B to analyze the data.

An example of what Data::XDumper does:

use Data::XDumper qw(Dump); sub Test { unshift @_, { y => \@_ }; \@_ } my $x = "foo"; my $data = Test($x, substr($x, 1, 2)); bless $data, 'Quux'; bless \$data, 'Bar'; Dump $data, $data;
with default settings produces the output:
$L001:  Bar \
@L003:     Quux @(
              {y => \@L003},
$L002:        'foo',
              substr($L002, 1, 2)
           )
        $L001
Here are direct links to the sources: Data::XDumper 1.03 and its prerequisite B::More 1.01. You can also browse them at CPAN.

•Update: found a major memory leak, fixed Feb 20 13:11:50 CET 2003 in 1.03

And a syntax-highlighted version for online reading (also updated)

I hope I can get some feedback on my approach and layout, and I need to know how robust it is. I've tried all kinds of input but the possibilities are endless, so perhaps other people can find things it breaks on.

•Update: what I mean with the above paragraph is: Could you please run the most disgusting piece of data you can think of through XDumper and report the results? :-)


In reply to Data::XDumper by xmath

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (7)
    As of 2020-07-07 12:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?