I’m developing a web app right now and as some of you might know there is a very popular javascript command which is used for debugging. It’s invoked via console.log() and takes anything as an argument. If you use Firefox with Firebug or Safari 4 the value you pass to console.log will be printed and introspected via a debug window.

The problem is that I forget on a regular basis to remove those console.log statements. I wrote a very quick and dirty perl script which searches files with an .js extension for console.log. I put that script in the t/ folder and named it forbidden_words.t.

It works great so far and my test suite fails as soon as there is still a console.log around. I plan to extend this script to something like Test::ForbiddenWords or something where you can specify file extensions and strings (or regexes).

I couldn’t find anything like this on the CPAN, so give me a comment if you like the idea or know something better.