Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: The Joy of Test

by drewbie (Chaplain)
on Apr 12, 2002 at 14:23 UTC ( #158583=note: print w/replies, xml ) Need Help??

in reply to The Joy of Test

Further, once I find I need to rework the inner magic of my code, I am confident that I can make nice, sweeping changes and still run my tests and know instantly what went wrong. As this is a research project for my work, I've repeatedly been forced to rework things to try new ideas.

Pure bliss :) Tests. Don't leave home without 'em.

You summed up perfectly the reason we need tests! Code changes, bugs are fixed/introduced. Bugs are bad, so we need to know when they spring to life. Tests are a simple way to quickly & easily verify your code works as expected. As we all know, lazyiness & hubris are the virtues esposed by perl programmers. You put in a little time up front to save a lot of time & headache further down the line. I hate repetition, and anything to reduce it is good in my book. Without tests, there is always a chance that you've missed something. I was sucked in by the excellent article on which should be required reading for newbie testers.

IMHO, there is not a good excuse to NOT write tests. It could probably be argued that not writing them is a bit negligent on the programmer's part (not to start a flame war...). And with the wonderful modules that the ingenius Michael Schwern has given us, tests are so simple. Witness Test::Simple, Test::More, Test::Harness, and most recently Test::Inline (Write tests inline in POD!). Is there really a good reason to not write tests? I definitely realize that some things are hard to test (like web app controllers - I'd love to hear how you test those), but I do think everything deserves at least a simple test or two. Even if it's just use_ok('My::Module::Name');

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://158583]
[atcroft]: abner: Do you mean something like SELECT `foo`, `bar` FROM `table_name' WHERE (( `foo` = "asdf" ) OR ( `bar` = 'asdw' )); Or something else?
[abner]: yes. i am familiar with mysql but ignorant about how to get around the fact that placeholders can only represent single scalar values.
[abner]: my $sth = $dbh->prepare(' SELECT * FROM charge WHERE cpt = ?') or die "Couldn't prepare statement: " . $dbh->errstr;
[abner]: what if i want SELECT * FROM charge WHERE col1 = x and col2 = y?
[atcroft]: abner: So you are wanting to do something like my $sth = $dbh->prepare(' SELECT * FROM charge WHERE col1 = ? and col2 = ?;'); $sth->execute(' asdf', 'asdw');?

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2017-01-24 03:50 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (201 votes). Check out past polls.