I've started work on a Perl DUNDi library. At this point it does some basic parsing of input, but nothing regarding output.
You can follow along at https://www.zmonkey.org/blog/project/perl-dundi-library/about. Source is on Github at https://github.com/heytensai/dundi.
To learn more about DUNDi, see http://www.voip-info.org/wiki/view/Asterisk+DUNDi+Call+Routing.
For archive purposes, I've made a copy of the DUNDi RFC draft at https://www.zmonkey.org/dundi.txt.