I have a suugestion that, whenever someone give a piece of demo code or some solutions on this site, the author should always state:
  1. whether the code is tested
  2. which version of perl is used for testing. Specify if you didn't test with -w.
Sounds like a small deal, but this helps. Some time, I do see pieces of code which are obviously not tested. I am not saying one can not post non-tested code, there might time-restriction etc. But it is better to let the readers be aware of this.

What do you think?

Replies are listed 'Best First'.
Re: To test demos and solutions
by theorbtwo (Prior) on Jan 12, 2003 at 22:36 UTC

    My basic assumption is that, unless stated otherwise, code is typed off the top of the posters head, and is completly untested. For a while, I've been explicitly stating that.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

      Hm;-)...However my assumption is (no, WAS) that code is tested, unless stated otherwise, and that's what I did, I always test my code, before post it. I feel uncomfortable to post untested code, well, that's just my feeling.

        And I've always thought that theorbtwo's disclaimer is redundant. It's always been my assumption that all code under SoPW and all responses (to anything) is untested. I generally expect obfuscations, snippets and other prepared examples to have been tested beforehand. Outside of that no one should expect that the code is of any particular quality.

        In fact, frequently I post code not because I expect the user to copy and paste it but that I expect the user to read it and write it down themselves. How else is the person asking the question supposed to learn things anyway if they just copy/paste prewritten code examples.

Re: To test demos and solutions
by Aristotle (Chancellor) on Jan 13, 2003 at 09:45 UTC
    Most code I post is untested, and the majority of that carries a note. Usually a simple "Untested:" which doesn't take much time to type and makes it blindingly obvious that it isn't to be expected to work as is. If I test it, it's always under all warnings and strictures. I don't see this periodically appearing topic requiring a lot of discussion - typing "untested" takes about 3 seconds and preempts any doubts.

    Makeshifts last the longest.