ikegami, I cannot begin to express just how happy you've made me. Having simple, elegant, and understandable code that solves a problem that I've been beating my head against for days is stunningly good.

You've been added with an appropriate attribution to the AUTHORS file, and you can expect a future release of autodie to be named in your honour. ;)

Really, you rock. Thank-you so much for taking the time to show me a solution, it's exactly what I've been trying (and failing) to do.