- CGI script: (use CGI)
- Get title and page-text and other fields from database (use DBI and use DBD)
- massage title and text according to your needs.
- prepare new page from the template (HTML::Template).
- fill the title and text and other fields in the page.
- print the page.
You might want to look at princepawn's homenode
for your framework for further exploration.