Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • As far as testing code before committing ... two ideas:

    1. File Timestamps: Have the Teardown method or a special final test put a timestamp in a file (say, .last_tested). Configure your versioning software to check for the existence of this file, and if it exists, look for any source code with a more recent modification time. This might be a pain, as it will show the tests as expired if you update POD, or something else that changes a source file's mtime.

    2. File Hash: Create a simple perl/shell script that accepts a single directory as an argument, and looks at all files below that directory matching a certain pattern ("*.pm", "*.pl","*.t", etc.), running a hash (for example, /usr/bin/md5sum) over them, and then producing a final hash for all those hashes, printing it to standard out. Have this script run as your last test, and have it store the ultra-mega-mega hash in a file, checked in the same manner as #1 above by your versioning system.

    They're both the same really, just one looks at the actual file's contents. The hash version seems more robust to me though, because you could, for example, filter each source file to remove all comments before calculating the hash, to test code only. Or run it through PPI and remove all POD ;). Also, the hash version can be run to compare files on two separate servers, if your versioning system worked entirely on another server. I'm sure there are many more ways to make it more robust... :)