2009-05-09 Oddmuse Testing

When I’m working on Oddmuse, I will often edit a test file, first. Today, for example, I edited `t/history.t` and was interested in the state of things once it had run. Usually I’d run `perl t/history.t` and then something like `perl wiki.pl action=index` and look at the HTML code. But this time I wanted to see it in a browser. And I didn’t want to setup my local webserver to use the test data directory. So I wrote a little shell script:

#!/bin/sh
export WikiDataDir=test-data
exec perl wiki.pl $* | perl -e 'undef $/; $_=<STDIN>;
 s/.*?\r?\n\r?\n//s; print $_;' | w3m -T text/html

I called it `oddview` and run it from my `oddmuse` directory like this: `oddview action=index` and I’ll get the index action result as a web page displayed in the the text browser w3m. Yay! 😄

w3m

​#Oddmuse