I rewrote it. I thought I had everything together, used the same SQL queries, but I wanted to be sure it kicked out the same output.
So, I wrote tests using Perl's Test::Most and
A few weeks ago, I knew Perl testing existed but I didn't know much about it. Now it's practical.