I built a framework where you create a database table and then you get online forms to go with it. Sort of a limited version of MS Access where the forms are on the web browser. Metadata about forms (titles, button and field names an locations, permissions, etc) are also stored in tables, so there is no hard coded UI elements. All UI is generated dynamically from data in tables for every request. There is generic code to search, display, edit, print, export, etc but when needed you can override the default code to do something more specific like a complicated report that joins tables. I currently generate the HTML to present to the user by just concatenating HTML tags into a string, and then returning the string. I also print the forms by generating similar HTML in a similar way and then use HTMLDOC to generate a PDF. HTML::Tiny should clean that both of those processes up.