Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Thankyou Aristotle.

In it's veryCompact form the output is exactly what I was looking for:

P:\test>perl -MDumpvalue -e" $d=new Dumpvalue; $h{ $_ } = [ map{ $_ & 1 ? { 'a'..'z' } : [ 1..100 ] } 1 .. 10 ] for 'a' .. 'j'; $d->veryCompact(1); $d->dumpValue( \%h )" 'a' => ARRAY(0x1871700) 0 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 1 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 3 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 4 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 5 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 6 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 7 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 8 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 9 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 'b' => ARRAY(0x18757e4) 0 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 1 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 3 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 4 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 5 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 6 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 7 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 8 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 9 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 'c' => ARRAY(0x18794fc) 0 'a' => 'b', 'c' => 'd', 'e' => 'f', 'g' => 'h', 'i' => 1 0..99 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

And it even has an option to see through overloading and handle what comes out -- at least part way.

P:\test>p1 perl> use Math::Pari qw[ :int factorint sqrtint divisors PARI ];; perl> $f = factorint 1000000;; perl> use Dumpvalue;; perl> $d = new Dumpvalue;; perl> $d->veryCompact( 1 );; perl> $d->set( bareStringify => 1 );; perl> { local $\; $d->dumpValue( $f ) };; 0 Math::Pari=ARRAY(0x1a3702c) 0 Math::Pari=SCALAR(0x1a3c9ec) -> 33884400 1 Math::Pari=SCALAR(0x1a3ec7c) -> 33884376 1 Math::Pari=ARRAY(0x1a36f54) 0 Math::Pari=SCALAR(0x1a3ec70) -> 33884388 1 Math::Pari=SCALAR(0x1a3ec94) -> 33884364 perl> Terminating on signal SIGINT(2)

All it needs is to not de-overload the final SCALAR values so that Math::Pari will return the numbers, which as it's in Perl, I can fix.

It also does circularity testing:

perl> $r = \$r;; perl> $d->dumpValue( $r );; -> REF(0x22ac9c) -> REUSED_ADDRESS

But dumping my testcase above, it uses less than 50% extra memory--a considerable saving over the 250% of Data::Dumper. Though I now realise that a large proportion of the extra memory is DD consumes is used by building the output in memory rather than dumping straight the select'd output handle.

I think I can see how to reduce that further still--though it may slow it down a little.

And it's been sat there on my machine the whole time! It's a bit embarrassing that I've never noticed it, but I don't ever recall it being mentioned.

Not only did someone else see the need for what I was asking for, they wrote it, covered all the bases and dropped it on my machine without telling me:)

Once again, thanks Aristotle.


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.

In reply to Re^2: In need of a Dumper that has no pretentions to being anything else. by BrowserUk
in thread In need of a Dumper that has no pretentions to being anything else. by BrowserUk

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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 musing on the Monastery: (6)
    As of 2014-12-27 12:49 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (177 votes), past polls