I've used OpenSCAD quite a bit for 3D design but I had forgotten that it will export to DXF. I don't know how I would write code in Perl to create OpenSCAD code. That would be an interesting project for a new module. I have about 6,000 drawings to create this way daily so it would need to be a general solution.
I have been planning to create SVG in Perl and then automate converting that to DXF with Inkscape. OpenSCAD might be even better at the SVG to DXF conversion. Thanks for the suggestion.