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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
... I'm dealing with large hash structures and big input data ... I'm usually don't even want to supress the error (this usually means the input data is wrong and I need to deal with it) ...

The point raised by haukex here is critical: you're really dealing with input data validation, not a way to flag the use of an undef value that might be present if your input data was invalid. In other words, don't bother trying to lock the barn door after the horse has bolted. The ideal time to deal with bad data is when you get it, not after it's drifted downstream and had a chance to gum up other processes.

The only way I can think of to validate a data structure is to write a validation function specific to that structure and invoke it as soon as possible after the structure is captured:
    my %bigdata = capture_big_input_data($inputstream);
    validate_bigdata(\%bigdata);
Obviously, the bigger your data, the bigger your validation job, but that's life. (You may even decide that certain missing data fields can, in fact, be fixed up with a zero, an empty string or whatever; if so, the  validate_bigdata() function is the ideal place to do this patching.)

The other variation on this theme is when you read your input data on a line-by-line or block-by-block basis. In this case, you must figure out a way to validate each line or block as it is read — at least, that's what I would do. Anyway, you get the idea...


Give a man a fish:  <%-{-{-{-<


In reply to Re^3: determine the variable causing the error: Use of uninitialized value by AnomalousMonk
in thread determine the variable causing the error: Use of uninitialized value by ruqui

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-19 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found