Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2020-01-25 05:01 GMT
Find Nodes?
    Voting Booth?