Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Check for data in array

by thezip (Vicar)
on Feb 08, 2012 at 15:28 UTC ( #952520=note: print w/ replies, xml ) Need Help??


in reply to Check for data in array


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


Comment on Re: Check for data in array
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://952520]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2014-10-24 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (131 votes), past polls