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

Comment on

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

If I find that something that "something absolutely *should* work", yet doesn't, I create an override for the data by replacing the normal input with hardcoded values that test all possible conditions.

For example, just before entering into the "if" statement, hardcode %sections to contain:

$sections{'procs'} = 'service.exe'; # Should result in success #$sections{'procs'} = 'failure.exe'; # Should now result in failure

If the successful hardcode fails, then you have half-split the problem to determine that your logic is incorrect, rather than the data than is being supplied to it. If it works as expected, then your data is the problem.

Pretty basic stuff, but tricks like this allow you to remove all assumptions about the data you think you are processing.


What can be asserted without proof can be dismissed without proof. - Christopher Hitchens, 1949-2011

In reply to Re: Check for data in array by thezip
in thread Check for data in array by fazedandconfused

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 meditating upon the Monastery: (9)
    As of 2014-09-02 19:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite cookbook is:










      Results (29 votes), past polls