Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

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

I'm in the middle of writing a script to handle a large volume of data, and populate a series of database tables with subsets of that data.

I've been using Data::Dumper to output the data at periods such that I could validate it's consistancy with what I expect to have been pulled in.

Now, I'm reading some 16,000 data items, and hashing them on a variety of keys such that I end up with a 3-level-deep hash of hashes: %hash -> $key1 -> $key2 -> $key3 -> values.
The final data values are largely scalars, except one, which is an array of 50 data values for the record for a series of potential situations that we have to store data on.

I have attempted to output, using print Dumper \%hash, both the entire hash, and subsets of the hash (even down to an individual record), but it appears that Data::Dumper simply can't cope with the structure of the data. The script locks, waiting for the Dumper to return, and basically just sits there, eating system resources until the box locks up.

Data::Dumper works fine if I prevent the final array of values from being added to the hash. I have gone ahead and added the array data to the database, and validated it that way, so I am 100% certain that the array is being assigned correctly to the hash ($hash{$key1}{$key2}{$key3} = \@array;).

Basically, I'm interested to know if anyone else has experienced a simliar issue with Data::Dumper and very deep HOHs and HOHOA. If anyone's aware of a workaround, that'd be very useful too - it's vital I have some convenient method of data validation.

I'd like to post some code regarding the population of the hash, but it's huge (750 lines+) and I don't see the necessity. I'm certain the hash is populated correctly from the database; I'd just welcome a way of validating that data before it gets to the DB, which is what Data::Dumper was previously being used for.

Cheers ..
-- Foxcub


In reply to Data::Dumper Limitations by Tanalis

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 pondering the Monastery: (5)
    As of 2021-02-27 19:43 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?